style: Add a fast-path for GeckoElement::is_root.

This commit is contained in:
Emilio Cobos Álvarez 2017-12-01 20:17:53 +01:00
parent 712d75af01
commit 382a89511a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1917,6 +1917,15 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
#[inline]
fn is_root(&self) -> bool {
let parent_node = match self.as_node().parent_node() {
Some(parent_node) => parent_node,
None => return false,
};
if !parent_node.is_document() {
return false;
}
unsafe {
Gecko_IsRootElement(self.0)
}