style: Introduce TNode::is_in_document.

MozReview-Commit-ID: BrhhoOghtUL
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-10-27 12:18:27 +02:00
parent 93272f46a5
commit f993693eb2
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 13 additions and 1 deletions

View file

@ -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 {

View file

@ -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())
}