diff --git a/dom/animation/KeyframeUtils.cpp b/dom/animation/KeyframeUtils.cpp index 59f05652a..a3702dbe4 100644 --- a/dom/animation/KeyframeUtils.cpp +++ b/dom/animation/KeyframeUtils.cpp @@ -323,7 +323,7 @@ public: // ------------------------------------------------------------------ inline bool -IsInvalidValuePair(const PropertyValuePair& aPair, StyleBackendType aBackend) +IsInvalidValuePair(const PropertyValuePair& aPair) { // There are three types of values we store as token streams: // @@ -595,8 +595,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray& aKeyframes, MOZ_ASSERT(aStyleContext); MOZ_ASSERT(aElement); - StyleBackendType styleBackend = aElement->OwnerDoc()->GetStyleBackendType(); - const size_t len = aKeyframes.Length(); nsTArray result(len); @@ -605,7 +603,7 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray& aKeyframes, ComputedKeyframeValues* computedValues = result.AppendElement(); for (const PropertyValuePair& pair : PropertyPriorityIterator(frame.mPropertyValues)) { - if (IsInvalidValuePair(pair, styleBackend)) { + if (IsInvalidValuePair(pair)) { continue; } @@ -1496,8 +1494,6 @@ HasImplicitKeyframeValues(const nsTArray& aKeyframes, } }; - StyleBackendType styleBackend = aDocument->GetStyleBackendType(); - for (size_t i = 0, len = aKeyframes.Length(); i < len; i++) { const Keyframe& frame = aKeyframes[i]; @@ -1513,7 +1509,7 @@ HasImplicitKeyframeValues(const nsTArray& aKeyframes, : computedOffset; for (const PropertyValuePair& pair : frame.mPropertyValues) { - if (IsInvalidValuePair(pair, styleBackend)) { + if (IsInvalidValuePair(pair)) { continue; } diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 68f07deb8..cb1d588e2 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -3394,7 +3394,7 @@ nsDOMWindowUtils::AddSheet(nsIPreloadedStyleSheet* aSheet, uint32_t aSheetType) StyleSheet* sheet = nullptr; auto preloadedSheet = static_cast(aSheet); - nsresult rv = preloadedSheet->GetSheet(doc->GetStyleBackendType(), &sheet); + nsresult rv = preloadedSheet->GetSheet(&sheet); NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index ea702105f..91660017b 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -2171,8 +2171,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI) mozAutoDocUpdate upd(this, UPDATE_STYLE, true); if (mStyleSetFilled) { // Skip removing style sheets from the style set if we know we haven't - // filled the style set. (This allows us to avoid calling - // GetStyleBackendType() too early.) + // filled the style set. RemoveDocStyleSheetsFromStyleSets(); RemoveStyleSheetsFromStyleSets(mOnDemandBuiltInUASheets, SheetType::Agent); RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], SheetType::Agent); @@ -12568,16 +12567,6 @@ nsIDocument::ReportHasScrollLinkedEffect() "ScrollLinkedEffectFound2"); } -void -nsIDocument::UpdateStyleBackendType() -{ - MOZ_ASSERT(mStyleBackendType == StyleBackendType(0), - "no need to call UpdateStyleBackendType now"); - - // Assume Gecko by default. - mStyleBackendType = StyleBackendType::Gecko; -} - /** * Helper function for |nsDocument::PrincipalFlashClassification| * diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 77c349ead..f41000553 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -36,7 +36,6 @@ #include "mozilla/dom/DocumentOrShadowRoot.h" #include "mozilla/dom/Dispatcher.h" #include "mozilla/LinkedList.h" -#include "mozilla/StyleBackendType.h" #include "mozilla/StyleSheet.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" @@ -1198,16 +1197,6 @@ public: return mCSSLoader; } - mozilla::StyleBackendType GetStyleBackendType() const { - if (mStyleBackendType == mozilla::StyleBackendType(0)) { - const_cast(this)->UpdateStyleBackendType(); - } - MOZ_ASSERT(mStyleBackendType != mozilla::StyleBackendType(0)); - return mStyleBackendType; - } - - void UpdateStyleBackendType(); - /** * Get this document's StyleImageLoader. This is guaranteed to not return null. */ @@ -3252,10 +3241,6 @@ protected: // Our readyState ReadyState mReadyState; - // Whether this document has (or will have, once we have a pres shell) a - // Gecko- or Servo-backed style system. - mozilla::StyleBackendType mStyleBackendType; - #ifdef MOZILLA_INTERNAL_API // Our visibility state mozilla::dom::VisibilityState mVisibilityState; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 2366059f2..a5cd94c08 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -36,7 +36,6 @@ #include "mozilla/TouchEvents.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" -#include "mozilla/StyleBackendType.h" #include #ifdef XP_WIN @@ -872,8 +871,7 @@ PresShell::Init(nsIDocument* aDocument, // Bind the context to the presentation shell. mPresContext = aPresContext; - StyleBackendType backend = StyleBackendType::Gecko; - aPresContext->AttachShell(this, backend); + aPresContext->AttachShell(this); // Now we can initialize the style set. Make sure to set the member before // calling Init, since various subroutines need to find the style set off diff --git a/layout/base/RestyleManagerHandle.h b/layout/base/RestyleManagerHandle.h index 813dab3ad..2d774faab 100644 --- a/layout/base/RestyleManagerHandle.h +++ b/layout/base/RestyleManagerHandle.h @@ -11,7 +11,6 @@ #include "mozilla/EventStates.h" #include "mozilla/HandleRefPtr.h" #include "mozilla/RefCountType.h" -#include "mozilla/StyleBackendType.h" #include "nsChangeHint.h" namespace mozilla { @@ -50,11 +49,6 @@ public: public: friend class ::mozilla::RestyleManagerHandle; - StyleBackendType BackendType() const - { - return StyleBackendType::Gecko; - } - RestyleManager* AsGecko() { return reinterpret_cast(mValue); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index b7da7f9da..1f3210c39 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -9137,14 +9137,6 @@ nsLayoutUtils::GetCumulativeApzCallbackTransform(nsIFrame* aFrame) return delta; } -/* static */ bool -nsLayoutUtils::SupportsServoStyleBackend(nsIDocument* aDocument) -{ - return StyloEnabled() && - aDocument->IsHTMLOrXHTML() && - static_cast(aDocument)->IsContentDocument(); -} - static bool LineHasNonEmptyContentWorker(nsIFrame* aFrame) diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index ac889c47c..f0de05d82 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2394,13 +2394,6 @@ public: return sTextCombineUprightDigitsEnabled; } - // Stylo (the Servo backend for Gecko's style system) is generally enabled - // or disabled at compile-time. However, we provide the additional capability - // to disable it dynamically in stylo-enabled builds via a pref. - static bool StyloEnabled() { - return false; - } - static uint32_t IdlePeriodDeadlineLimit() { return sIdlePeriodDeadlineLimit; } @@ -2828,14 +2821,6 @@ public: */ static CSSPoint GetCumulativeApzCallbackTransform(nsIFrame* aFrame); - /* - * Returns whether the given document supports being rendered with a - * Servo-backed style system. This checks whether Stylo is enabled - * globally, that the document is an HTML document, and that it is - * being presented in a content docshell. - */ - static bool SupportsServoStyleBackend(nsIDocument* aDocument); - /* * Checks whether a node is an invisible break. * If not, returns the first frame on the next line if such a next line exists. diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index f9f74015a..491fbafdf 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -889,7 +889,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext) // Note: We don't hold a reference on the shell; it has a reference to // us void -nsPresContext::AttachShell(nsIPresShell* aShell, StyleBackendType aBackendType) +nsPresContext::AttachShell(nsIPresShell* aShell) { MOZ_ASSERT(!mShell); mShell = aShell; diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index e21342109..9d5f16371 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -42,7 +42,6 @@ #include "mozilla/RestyleManagerHandle.h" #include "prenv.h" #include "mozilla/StaticPresData.h" -#include "mozilla/StyleBackendType.h" class nsAString; class nsIPrintSettings; @@ -166,7 +165,7 @@ public: * Set and detach presentation shell that this context is bound to. * A presentation context may only be bound to a single shell. */ - void AttachShell(nsIPresShell* aShell, mozilla::StyleBackendType aBackendType); + void AttachShell(nsIPresShell* aShell); void DetachShell(); diff --git a/layout/style/CSS.cpp b/layout/style/CSS.cpp index 1078945ee..49ea6ee59 100644 --- a/layout/style/CSS.cpp +++ b/layout/style/CSS.cpp @@ -24,7 +24,6 @@ struct SupportsParsingInfo nsIURI* mDocURI; nsIURI* mBaseURI; nsIPrincipal* mPrincipal; - StyleBackendType mStyleBackendType; }; static nsresult @@ -44,7 +43,6 @@ GetParsingInfo(const GlobalObject& aGlobal, aInfo.mDocURI = nsCOMPtr(doc->GetDocumentURI()).get(); aInfo.mBaseURI = nsCOMPtr(doc->GetBaseURI()).get(); aInfo.mPrincipal = win->GetPrincipal(); - aInfo.mStyleBackendType = doc->GetStyleBackendType(); return NS_OK; } diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 18ab53890..825e39dd9 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -369,7 +369,7 @@ CSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const CSSStyleSheet::CSSStyleSheet(css::SheetParsingMode aParsingMode, CORSMode aCORSMode, ReferrerPolicy aReferrerPolicy) - : StyleSheet(StyleBackendType::Gecko, aParsingMode), + : StyleSheet(aParsingMode), mParent(nullptr), mOwnerRule(nullptr), mDirty(false), @@ -385,7 +385,7 @@ CSSStyleSheet::CSSStyleSheet(css::SheetParsingMode aParsingMode, CORSMode aCORSMode, ReferrerPolicy aReferrerPolicy, const SRIMetadata& aIntegrity) - : StyleSheet(StyleBackendType::Gecko, aParsingMode), + : StyleSheet(aParsingMode), mParent(nullptr), mOwnerRule(nullptr), mDirty(false), diff --git a/layout/style/Declaration.h b/layout/style/Declaration.h index f149a09b1..62cc02f14 100644 --- a/layout/style/Declaration.h +++ b/layout/style/Declaration.h @@ -92,7 +92,7 @@ public: * |mData|) and cannot be used until its |CompressFrom| method or * |InitializeEmpty| method is called. */ - Declaration() : DeclarationBlock(StyleBackendType::Gecko) {} + Declaration() : DeclarationBlock() {} Declaration(const Declaration& aCopy); diff --git a/layout/style/DeclarationBlock.h b/layout/style/DeclarationBlock.h index b7863150c..5ab2441aa 100644 --- a/layout/style/DeclarationBlock.h +++ b/layout/style/DeclarationBlock.h @@ -13,7 +13,6 @@ #define mozilla_DeclarationBlock_h #include "mozilla/ServoUtils.h" -#include "mozilla/StyleBackendType.h" #include "nsCSSPropertyID.h" @@ -31,11 +30,11 @@ class Rule; class DeclarationBlock { protected: - explicit DeclarationBlock(StyleBackendType aType) - : mImmutable(false), mType(aType) { mContainer.mRaw = 0; } + explicit DeclarationBlock() + : mImmutable(false) { mContainer.mRaw = 0; } DeclarationBlock(const DeclarationBlock& aCopy) - : DeclarationBlock(aCopy.mType) {} + : DeclarationBlock() {} public: MOZ_DECL_STYLO_METHODS(css::Declaration) @@ -137,8 +136,6 @@ private: // set when declaration put in the rule tree; // also by ToString (hence the 'mutable'). mutable bool mImmutable; - - const StyleBackendType mType; }; } // namespace mozilla diff --git a/layout/style/PreloadedStyleSheet.cpp b/layout/style/PreloadedStyleSheet.cpp index 709d3d077..5740ce786 100644 --- a/layout/style/PreloadedStyleSheet.cpp +++ b/layout/style/PreloadedStyleSheet.cpp @@ -39,10 +39,8 @@ PreloadedStyleSheet::Create(nsIURI* aURI, RefPtr preloadedSheet = new PreloadedStyleSheet(aURI, aParsingMode); - auto type = nsLayoutUtils::StyloEnabled() ? StyleBackendType::Servo - : StyleBackendType::Gecko; StyleSheet* sheet; - nsresult rv = preloadedSheet->GetSheet(type, &sheet); + nsresult rv = preloadedSheet->GetSheet(&sheet); NS_ENSURE_SUCCESS(rv, rv); preloadedSheet.forget(aResult); @@ -57,23 +55,21 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(PreloadedStyleSheet) NS_IMPL_CYCLE_COLLECTING_RELEASE(PreloadedStyleSheet) -NS_IMPL_CYCLE_COLLECTION(PreloadedStyleSheet, mGecko, mServo) +NS_IMPL_CYCLE_COLLECTION(PreloadedStyleSheet, mStyleSheet) nsresult -PreloadedStyleSheet::GetSheet(StyleBackendType aType, StyleSheet** aResult) +PreloadedStyleSheet::GetSheet(StyleSheet** aResult) { *aResult = nullptr; - RefPtr& sheet = mGecko; - - if (!sheet) { + if (!mStyleSheet) { RefPtr loader = new css::Loader(); - nsresult rv = loader->LoadSheetSync(mURI, mParsingMode, true, &sheet); + nsresult rv = loader->LoadSheetSync(mURI, mParsingMode, true, &mStyleSheet); NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(sheet); } - *aResult = sheet; + *aResult = mStyleSheet; return NS_OK; } diff --git a/layout/style/PreloadedStyleSheet.h b/layout/style/PreloadedStyleSheet.h index 5e427a557..47f005b8a 100644 --- a/layout/style/PreloadedStyleSheet.h +++ b/layout/style/PreloadedStyleSheet.h @@ -27,7 +27,7 @@ public: // *aResult is not addrefed, since the PreloadedStyleSheet holds a strong // reference to the sheet. - nsresult GetSheet(StyleBackendType aType, StyleSheet** aResult); + nsresult GetSheet(StyleSheet** aResult); protected: virtual ~PreloadedStyleSheet() {} @@ -35,8 +35,7 @@ protected: private: PreloadedStyleSheet(nsIURI* aURI, css::SheetParsingMode aParsingMode); - RefPtr mGecko; - RefPtr mServo; + RefPtr mStyleSheet; nsCOMPtr mURI; css::SheetParsingMode mParsingMode; diff --git a/layout/style/ServoDeclarationBlock.h b/layout/style/ServoDeclarationBlock.h index 8f78b772c..2d0ce2574 100644 --- a/layout/style/ServoDeclarationBlock.h +++ b/layout/style/ServoDeclarationBlock.h @@ -16,7 +16,7 @@ class ServoDeclarationBlock final : public DeclarationBlock public: explicit ServoDeclarationBlock( already_AddRefed aRaw) - : DeclarationBlock(StyleBackendType::Servo), mRaw(aRaw) {} + : DeclarationBlock(), mRaw(aRaw) {} ServoDeclarationBlock() : ServoDeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {} diff --git a/layout/style/ServoStyleSheet.cpp b/layout/style/ServoStyleSheet.cpp index 674adebdc..ae303dc6b 100644 --- a/layout/style/ServoStyleSheet.cpp +++ b/layout/style/ServoStyleSheet.cpp @@ -7,7 +7,6 @@ #include "mozilla/ServoStyleSheet.h" #include "mozilla/css/Rule.h" -#include "mozilla/StyleBackendType.h" #include "mozilla/ServoBindings.h" #include "mozilla/ServoCSSRuleList.h" #include "mozilla/dom/CSSRuleList.h" @@ -22,7 +21,7 @@ ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode, CORSMode aCORSMode, net::ReferrerPolicy aReferrerPolicy, const dom::SRIMetadata& aIntegrity) - : StyleSheet(StyleBackendType::Servo, aParsingMode) + : StyleSheet(aParsingMode) , mSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity) { } diff --git a/layout/style/StyleBackendType.h b/layout/style/StyleBackendType.h deleted file mode 100644 index f02b86213..000000000 --- a/layout/style/StyleBackendType.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_StyleBackendType_h -#define mozilla_StyleBackendType_h - -namespace mozilla { - -/** - * Enumeration that represents one of the two supported style system backends. - */ -enum class StyleBackendType : uint8_t -{ - Gecko = 1, - Servo -}; - -} // namespace mozilla - -#endif // mozilla_StyleBackendType_h diff --git a/layout/style/StyleSetHandle.h b/layout/style/StyleSetHandle.h index a2580fa91..378fbd662 100644 --- a/layout/style/StyleSetHandle.h +++ b/layout/style/StyleSetHandle.h @@ -11,7 +11,6 @@ #include "mozilla/RefPtr.h" #include "mozilla/ServoTypes.h" #include "mozilla/SheetType.h" -#include "mozilla/StyleBackendType.h" #include "mozilla/StyleSheet.h" #include "nsChangeHint.h" #include "nsCSSPseudoElements.h" @@ -48,11 +47,6 @@ public: public: friend class ::mozilla::StyleSetHandle; - StyleBackendType BackendType() const - { - return StyleBackendType::Gecko; - } - nsStyleSet* AsGecko() { return reinterpret_cast(mValue); diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index c55c40d69..f2ed540a0 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -18,11 +18,10 @@ namespace mozilla { -StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode) +StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode) : mDocument(nullptr) , mOwningNode(nullptr) , mParsingMode(aParsingMode) - , mType(aType) , mDisabled(false) , mDocumentAssociationMode(NotOwnedByDocument) { @@ -35,7 +34,6 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy, , mDocument(aDocumentToUse) , mOwningNode(aOwningNodeToUse) , mParsingMode(aCopy.mParsingMode) - , mType(aCopy.mType) , mDisabled(aCopy.mDisabled) // We only use this constructor during cloning. It's the cloner's // responsibility to notify us if we end up being owned by a document. diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index 5472143bb..853439df1 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -10,7 +10,6 @@ #include "mozilla/css/SheetParsingMode.h" #include "mozilla/dom/CSSStyleSheetBinding.h" #include "mozilla/net/ReferrerPolicy.h" -#include "mozilla/StyleBackendType.h" #include "mozilla/CORSMode.h" #include "mozilla/ServoUtils.h" @@ -44,7 +43,7 @@ class StyleSheet : public nsIDOMCSSStyleSheet , public nsWrapperCache { protected: - StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode); + StyleSheet(css::SheetParsingMode aParsingMode); StyleSheet(const StyleSheet& aCopy, nsIDocument* aDocumentToUse, nsINode* aOwningNodeToUse); @@ -245,7 +244,6 @@ protected: // and/or useful in user sheets. css::SheetParsingMode mParsingMode; - const StyleBackendType mType; bool mDisabled; // mDocumentAssociationMode determines whether mDocument directly owns us (in diff --git a/layout/style/moz.build b/layout/style/moz.build index 6f6037ad4..abe7bd00c 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -107,7 +107,6 @@ EXPORTS.mozilla += [ 'ServoUtils.h', 'SheetType.h', 'StyleAnimationValue.h', - 'StyleBackendType.h', 'StyleComplexColor.h', 'StyleContextSource.h', 'StyleSetHandle.h',