aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-19 06:44:25 -0500
committerGitHub <noreply@github.com>2017-05-19 06:44:25 -0500
commit448422c9a4f0cf28b92fd9e1479aa3d013b703f7 (patch)
tree69f71baaf4ee3a4f2fe9d801d50a56f6616881cc
parent0edc0f547dfca72cd97626350caa2a19f705175b (diff)
parent7e35f6b4be6832eb0dd092b6f1ba0abd53476be8 (diff)
downloadservo-448422c9a4f0cf28b92fd9e1479aa3d013b703f7.tar.gz
servo-448422c9a4f0cf28b92fd9e1479aa3d013b703f7.zip
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 -->
-rw-r--r--components/style/gecko/wrapper.rs12
1 files changed, 9 insertions, 3 deletions
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
@@ -433,6 +433,14 @@ impl<'le> GeckoElement<'le> {
}
#[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]