mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Avoid unconditional FFI calls to get the element state.
This commit is contained in:
parent
d1eef9d08a
commit
7e35f6b4be
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