summaryrefslogtreecommitdiffstats
path: root/servo/components/style/dom.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /servo/components/style/dom.rs
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/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> {