From 0deac30454d326e20b8e29abf71a647d1cfa9f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 4 Dec 2017 00:19:44 +0100 Subject: [PATCH] Bug 1422636: Inline Gecko_Namespace. r=xidorn MozReview-Commit-ID: FFdmaYCDxnv --- dom/base/nsNameSpaceManager.h | 11 ++++------- layout/style/ServoBindings.cpp | 7 ------- layout/style/ServoBindings.h | 1 - layout/style/ServoBindings.toml | 3 +++ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/dom/base/nsNameSpaceManager.h b/dom/base/nsNameSpaceManager.h index c62e0368649a..6a4100bebaa8 100644 --- a/dom/base/nsNameSpaceManager.h +++ b/dom/base/nsNameSpaceManager.h @@ -43,15 +43,12 @@ public: // Returns the atom for the namespace URI associated with the given ID. The // ID must be within range and not be kNameSpaceID_None (i.e. zero); + // + // NB: The requirement of mapping from the first entry to the empty atom is + // necessary for Servo, though it can be removed if needed adding a branch in + // GeckoElement::get_namespace(). nsAtom* NameSpaceURIAtom(int32_t aNameSpaceID) { MOZ_ASSERT(aNameSpaceID > 0); - return NameSpaceURIAtomForServo(aNameSpaceID); - } - - // NB: This function should only be called by Servo code (and the above - // accessor), which uses the empty atom to represent kNameSpaceID_None. - nsAtom* NameSpaceURIAtomForServo(int32_t aNameSpaceID) { - MOZ_ASSERT(aNameSpaceID >= 0); MOZ_ASSERT((int64_t) aNameSpaceID < (int64_t) mURIArray.Length()); return mURIArray.ElementAt(aNameSpaceID); } diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 610c53b1ef33..cf2ba992d5c6 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -323,13 +323,6 @@ Gecko_MatchesElement(CSSPseudoClassType aType, return nsCSSPseudoClasses::MatchesElement(aType, aElement).value(); } -nsAtom* -Gecko_Namespace(RawGeckoElementBorrowed aElement) -{ - int32_t id = aElement->NodeInfo()->NamespaceID(); - return nsContentUtils::NameSpaceManager()->NameSpaceURIAtomForServo(id); -} - // Dirtiness tracking. void Gecko_SetNodeFlags(RawGeckoNodeBorrowed aNode, uint32_t aFlags) diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 4cc3d8a895b4..a9edc8743cfe 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -181,7 +181,6 @@ Gecko_LoadStyleSheet(mozilla::css::Loader* loader, uint64_t Gecko_ElementState(RawGeckoElementBorrowed element); 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); diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index 2cca15a9f5c0..0ef8581d2d8c 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -75,6 +75,8 @@ headers = [ "mozilla/SizeOfState.h", "nsCSSCounterStyleRule.h", "nsCSSFontFaceRule.h", + "nsContentUtils.h", + "nsNameSpaceManager.h", "nsMediaFeatures.h", "nsXBLBinding.h", ] @@ -206,6 +208,7 @@ whitelist-vars = [ "kNameSpaceID_.*", "kGenericFont_.*", "kPresContext_.*", + "nsContentUtils_.*", ] whitelist-types = [ "RawGecko.*",