mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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]
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue