aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_wrapper.rs
diff options
context:
space:
mode:
authorCameron McCormack <cam@mcc.id.au>2017-06-09 12:05:39 +0800
committerCameron McCormack <cam@mcc.id.au>2017-06-09 18:37:35 +0800
commitc533097e20483004405cae9496126f0b981386c8 (patch)
treee070452b2c6c2843024e9c97245de69e74aca26d /components/script/layout_wrapper.rs
parentc465dd0375657c9784507185bbd99d0cd7a661b4 (diff)
downloadservo-c533097e20483004405cae9496126f0b981386c8.tar.gz
servo-c533097e20483004405cae9496126f0b981386c8.zip
style: Distinguish between the tree structures used for traversal and selector matching.
This patch renames TNode::parent_element to traversal_parent, since it returns the parent from the perspective of traversal (which in Gecko uses the flattened tree). It also renames TNode::children to traversal_children for the saem reason. We keep parent_element and children functions on TNode to use for selector matching, which must be done on the real DOM tree structure.
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r--components/script/layout_wrapper.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 80f87eb8504..f8ddbc485a1 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -165,12 +165,26 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
transmute(node)
}
- fn children(self) -> LayoutIterator<ServoChildrenIterator<'ln>> {
+ fn parent_node(&self) -> Option<Self> {
+ unsafe {
+ self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))
+ }
+ }
+
+ fn children(&self) -> LayoutIterator<ServoChildrenIterator<'ln>> {
LayoutIterator(ServoChildrenIterator {
current: self.first_child(),
})
}
+ fn traversal_parent(&self) -> Option<ServoLayoutElement<'ln>> {
+ self.parent_element()
+ }
+
+ fn traversal_children(&self) -> LayoutIterator<ServoChildrenIterator<'ln>> {
+ self.children()
+ }
+
fn opaque(&self) -> OpaqueNode {
unsafe { self.get_jsmanaged().opaque() }
}
@@ -199,12 +213,6 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
self.node.set_flag(CAN_BE_FRAGMENTED, value)
}
- fn parent_node(&self) -> Option<ServoLayoutNode<'ln>> {
- unsafe {
- self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))
- }
- }
-
fn is_in_doc(&self) -> bool {
unsafe { (*self.node.unsafe_get()).is_in_doc() }
}