mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #16929 - emilio:more-bits, r=bzbarsky
stylo: Avoid unconditional FFI calls to get the element state. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16929) <!-- Reviewable:end -->
This commit is contained in:
commit
448422c9a4
1 changed files with 9 additions and 3 deletions
|
@ -432,6 +432,14 @@ impl<'le> GeckoElement<'le> {
|
|||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementHasID)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_state_internal(&self) -> u64 {
|
||||
if !self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementHasLockedStyleStates) {
|
||||
return self.0.mState.mStates;
|
||||
}
|
||||
unsafe { Gecko_ElementState(self.0) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn may_have_class(&self) -> bool {
|
||||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
|
||||
|
@ -630,9 +638,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn get_state(&self) -> ElementState {
|
||||
unsafe {
|
||||
ElementState::from_bits_truncate(Gecko_ElementState(self.0))
|
||||
}
|
||||
ElementState::from_bits_truncate(self.get_state_internal())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue