summaryrefslogtreecommitdiffstats
path: root/servo/components/style/dom.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /servo/components/style/dom.rs
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/dom.rs')
-rw-r--r--servo/components/style/dom.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/servo/components/style/dom.rs b/servo/components/style/dom.rs
index 554d79fdb3..358d788845 100644
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -207,6 +207,17 @@ pub trait TNode: Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
}
}
+ /// Returns the depth of this node in the DOM.
+ fn depth(&self) -> usize {
+ let mut depth = 0;
+ let mut curr = *self;
+ while let Some(parent) = curr.traversal_parent() {
+ depth += 1;
+ curr = parent.as_node();
+ }
+ depth
+ }
+
/// Get this node's parent element from the perspective of a restyle
/// traversal.
fn traversal_parent(&self) -> Option<Self::ConcreteElement>;
@@ -398,18 +409,6 @@ pub trait TElement:
true
}
- /// Returns the depth of this element in the DOM.
- fn depth(&self) -> usize {
- let mut depth = 0;
- let mut curr = *self;
- while let Some(parent) = curr.traversal_parent() {
- depth += 1;
- curr = parent;
- }
-
- depth
- }
-
/// Get this node's parent element from the perspective of a restyle
/// traversal.
fn traversal_parent(&self) -> Option<Self> {