mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Add a fast-path for GeckoElement::is_root.
This commit is contained in:
parent
712d75af01
commit
382a89511a
1 changed files with 9 additions and 0 deletions
|
@ -1917,6 +1917,15 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_root(&self) -> bool {
|
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 {
|
unsafe {
|
||||||
Gecko_IsRootElement(self.0)
|
Gecko_IsRootElement(self.0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue