mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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.
This commit is contained in:
parent
c465dd0375
commit
c533097e20
11 changed files with 102 additions and 67 deletions
|
@ -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() }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue