diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 3d8ab270658..e043ff57223 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -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]