Bug 1422633: Inline the Rust bits of GetDocumentState too. r?xidorn
MozReview-Commit-ID: 9zvZF72ljS
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -305,22 +305,16 @@ Gecko_IsPrivateBrowsingEnabled(const nsI
}
EventStates::ServoType
Gecko_ElementState(RawGeckoElementBorrowed aElement)
{
return aElement->StyleState().ServoValue();
}
-EventStates::ServoType
-Gecko_DocumentState(const nsIDocument* aDocument)
-{
- return aDocument->ThreadSafeGetDocumentState().ServoValue();
-}
-
bool
Gecko_IsRootElement(RawGeckoElementBorrowed aElement)
{
return aElement->OwnerDoc()->GetRootElement() == aElement;
}
bool
Gecko_MatchesElement(CSSPseudoClassType aType,
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -174,17 +174,16 @@ Gecko_LoadStyleSheet(mozilla::css::Loade
mozilla::css::LoaderReusableStyleSheets* reusable_sheets,
RawGeckoURLExtraData* base_url_data,
const uint8_t* url_bytes,
uint32_t url_length,
RawServoMediaListStrong media_list);
// Selector Matching.
uint64_t Gecko_ElementState(RawGeckoElementBorrowed element);
-uint64_t Gecko_DocumentState(const nsIDocument* aDocument);
bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
bool Gecko_MatchesElement(mozilla::CSSPseudoClassType type, RawGeckoElementBorrowed element);
nsAtom* Gecko_Namespace(RawGeckoElementBorrowed element);
bool Gecko_MatchLang(RawGeckoElementBorrowed element,
nsAtom* override_lang, bool has_override_lang,
const char16_t* value);
nsAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed element);
nsIDocument::DocumentTheme Gecko_GetDocumentLWTheme(const nsIDocument* aDocument);
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -25,17 +25,17 @@ use element_state::{ElementState, Docume
use error_reporting::ParseErrorReporter;
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
use gecko::data::PerDocumentStyleData;
use gecko::global_style_data::GLOBAL_STYLE_DATA;
use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
use gecko::snapshot_helpers;
use gecko_bindings::bindings;
use gecko_bindings::bindings::{Gecko_ConstructStyleChildrenIterator, Gecko_DestroyStyleChildrenIterator};
-use gecko_bindings::bindings::{Gecko_DocumentState, Gecko_ElementState, Gecko_GetDocumentLWTheme};
+use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
use gecko_bindings::bindings::{Gecko_IsRootElement, Gecko_MatchesElement, Gecko_Namespace};
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
use gecko_bindings::bindings::Gecko_GetActiveLinkAttrDeclarationBlock;
@@ -664,22 +664,21 @@ 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 document_state(&self) -> DocumentState {
- let node = self.as_node();
- unsafe {
- let states = Gecko_DocumentState(node.owner_doc().0);
- DocumentState::from_bits_truncate(states)
- }
+ DocumentState::from_bits_truncate(
+ self.as_node().owner_doc().0.mDocumentState.mStates
+ )
}
#[inline]
fn may_have_class(&self) -> bool {
self.as_node()
.get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
}