зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1719824 - Inline GeckoNode::prev_sibling. r=smaug
It's very hot when matching some kind of selectors like the ones in bug 1717267, and the two function calls show up in the profiles. Differential Revision: https://phabricator.services.mozilla.com/D119505
This commit is contained in:
Родитель
1bbbede5ea
Коммит
ca8a794bb9
|
@ -130,10 +130,6 @@ const nsINode* Gecko_GetLastChild(const nsINode* aNode) {
|
|||
return aNode->GetLastChild();
|
||||
}
|
||||
|
||||
const nsINode* Gecko_GetPreviousSibling(const nsINode* aNode) {
|
||||
return aNode->GetPreviousSibling();
|
||||
}
|
||||
|
||||
const nsINode* Gecko_GetFlattenedTreeParentNode(const nsINode* aNode) {
|
||||
return aNode->GetFlattenedTreeParentNodeForStyle();
|
||||
}
|
||||
|
|
|
@ -76,8 +76,6 @@ void Gecko_Snapshot_DebugListAttributes(const mozilla::ServoElementSnapshot*,
|
|||
bool Gecko_IsSignificantChild(const nsINode*, bool whitespace_is_significant);
|
||||
|
||||
const nsINode* Gecko_GetLastChild(const nsINode*);
|
||||
const nsINode* Gecko_GetPreviousSibling(const nsINode*);
|
||||
|
||||
const nsINode* Gecko_GetFlattenedTreeParentNode(const nsINode*);
|
||||
const mozilla::dom::Element* Gecko_GetBeforeOrAfterPseudo(
|
||||
const mozilla::dom::Element*, bool is_before);
|
||||
|
|
|
@ -152,7 +152,7 @@ pub trait TNode: Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
|
|||
/// Get this node's first child.
|
||||
fn first_child(&self) -> Option<Self>;
|
||||
|
||||
/// Get this node's first child.
|
||||
/// Get this node's last child.
|
||||
fn last_child(&self) -> Option<Self>;
|
||||
|
||||
/// Get this node's previous sibling.
|
||||
|
|
|
@ -414,9 +414,11 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
#[inline]
|
||||
fn prev_sibling(&self) -> Option<Self> {
|
||||
unsafe {
|
||||
bindings::Gecko_GetPreviousSibling(self.0)
|
||||
.as_ref()
|
||||
.map(GeckoNode)
|
||||
let prev_or_last = GeckoNode::from_content(self.0.mPreviousOrLastSibling.as_ref()?);
|
||||
if prev_or_last.0.mNextSibling.raw::<nsIContent>().is_null() {
|
||||
return None;
|
||||
}
|
||||
Some(prev_or_last)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче