mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Introduce TNode::is_in_document.
MozReview-Commit-ID: BrhhoOghtUL Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
93272f46a5
commit
f993693eb2
3 changed files with 13 additions and 1 deletions
|
@ -191,6 +191,9 @@ pub trait TNode : Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
|
|||
DomChildren(self.first_child())
|
||||
}
|
||||
|
||||
/// Returns whether the node is attached to a document.
|
||||
fn is_in_document(&self) -> bool;
|
||||
|
||||
/// Iterate over the DOM children of a node, in preorder.
|
||||
fn dom_descendants(&self) -> DomDescendants<Self> {
|
||||
DomDescendants {
|
||||
|
|
|
@ -292,6 +292,11 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
GeckoDocument(unsafe { &*self.node_info().mDocument })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_in_document(&self) -> bool {
|
||||
self.get_bool_flag(nsINode_BooleanFlag::IsInDocument)
|
||||
}
|
||||
|
||||
fn traversal_parent(&self) -> Option<GeckoElement<'ln>> {
|
||||
self.flattened_tree_parent().and_then(|n| n.as_element())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue