diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index 3882735b30..d588c7b1da 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -1268,7 +1268,7 @@ CreateStyleContextForAnimationValue(nsCSSPropertyID aProperty, rules.AppendObject(styleRule); nsStyleSet* styleSet = - aBaseStyleContext->PresContext()->StyleSet()->AsGecko(); + aBaseStyleContext->PresContext()->StyleSet(); RefPtr styleContext = styleSet->ResolveStyleByAddingRules(aBaseStyleContext, rules); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 52117bf7f6..a5b67b6b13 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -245,8 +245,6 @@ #include "mozilla/dom/BoxObject.h" #include "gfxPrefs.h" #include "nsISupportsPrimitives.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/dom/SVGSVGElement.h" @@ -2073,7 +2071,7 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets() if (sheet->IsApplicable()) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveDocStyleSheet(sheet); + shell->StyleSet()->RemoveDocStyleSheet(sheet->AsGecko()); } } // XXX Tell observers? @@ -2092,7 +2090,7 @@ nsDocument::RemoveStyleSheetsFromStyleSets( if (sheet->IsApplicable()) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveStyleSheet(aType, sheet); + shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsGecko()); } } // XXX Tell observers? @@ -2158,18 +2156,18 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI) } static void -AppendSheetsToStyleSet(StyleSetHandle aStyleSet, +AppendSheetsToStyleSet(nsStyleSet* aStyleSet, const nsTArray>& aSheets, SheetType aType) { for (StyleSheet* sheet : Reversed(aSheets)) { - aStyleSet->AppendStyleSheet(aType, sheet); + aStyleSet->AppendStyleSheet(aType, sheet->AsGecko()); } } void -nsDocument::FillStyleSet(StyleSetHandle aStyleSet) +nsDocument::FillStyleSet(nsStyleSet* aStyleSet) { NS_PRECONDITION(aStyleSet, "Must have a style set"); NS_PRECONDITION(aStyleSet->SheetCount(SheetType::Doc) == 0, @@ -2179,21 +2177,21 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet) for (StyleSheet* sheet : Reversed(mStyleSheets)) { if (sheet->IsApplicable()) { - aStyleSet->AddDocStyleSheet(sheet, this); + aStyleSet->AddDocStyleSheet(sheet->AsGecko(), this); } } nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { - aStyleSet->AppendStyleSheet(SheetType::Doc, sheet); + aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko()); } } // Iterate backwards to maintain order for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) { if (sheet->IsApplicable()) { - aStyleSet->PrependStyleSheet(SheetType::Agent, sheet); + aStyleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } @@ -3431,7 +3429,7 @@ nsDocument::TryChannelCharset(nsIChannel *aChannel, already_AddRefed nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager, - StyleSetHandle aStyleSet) + nsStyleSet* aStyleSet) { // Don't add anything here. Add it to |doCreateShell| instead. // This exists so that subclasses can pass other values for the 4th @@ -3441,7 +3439,7 @@ nsDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager, already_AddRefed nsDocument::doCreateShell(nsPresContext* aContext, - nsViewManager* aViewManager, StyleSetHandle aStyleSet) + nsViewManager* aViewManager, nsStyleSet* aStyleSet) { NS_ASSERTION(!mPresShell, "We have a presshell already!"); @@ -3809,7 +3807,7 @@ nsDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet) // do not override Firefox OS/Mobile's content.css sheet. Maybe we should // have an insertion point to match the order of // nsDocumentViewer::CreateStyleSet though? - shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet); + shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet->AsGecko()); } } @@ -3821,7 +3819,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->AddDocStyleSheet(aSheet, this); + shell->StyleSet()->AddDocStyleSheet(aSheet->AsGecko(), this); } } @@ -3888,7 +3886,7 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveDocStyleSheet(aSheet); + shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsGecko()); } } @@ -4104,7 +4102,7 @@ nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aShee nsCOMPtr shell = GetShell(); if (shell) { SheetType type = ConvertAdditionalSheetType(aType); - shell->StyleSet()->AppendStyleSheet(type, aSheet); + shell->StyleSet()->AppendStyleSheet(type, aSheet->AsGecko()); } // Passing false, so documet.styleSheets.length will not be affected by @@ -4132,7 +4130,7 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet nsCOMPtr shell = GetShell(); if (shell) { SheetType type = ConvertAdditionalSheetType(aType); - shell->StyleSet()->RemoveStyleSheet(type, sheetRef); + shell->StyleSet()->RemoveStyleSheet(type, sheetRef->AsGecko()); } } @@ -12157,7 +12155,7 @@ nsIDocument::FlushUserFontSet() nsTArray rules; nsIPresShell* shell = GetShell(); if (shell) { - if (!shell->StyleSet()->AsGecko()->AppendFontFaceRules(rules)) { + if (!shell->StyleSet()->AppendFontFaceRules(rules)) { return; } } diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 923fb49ae9..22157500a0 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -43,7 +43,7 @@ #include "nsGkAtoms.h" #include "nsIApplicationCache.h" #include "nsIApplicationCacheContainer.h" -#include "mozilla/StyleSetHandle.h" +#include "nsStyleSet.h" #include "PLDHashTable.h" #include "nsAttrAndChildArray.h" #include "nsDOMAttributeMap.h" @@ -426,7 +426,7 @@ public: virtual already_AddRefed CreateShell( nsPresContext* aContext, nsViewManager* aViewManager, - mozilla::StyleSetHandle aStyleSet) override; + nsStyleSet* aStyleSet) override; virtual void DeleteShell() override; virtual nsresult GetAllowPlugins(bool* aAllowPlugins) override; @@ -1113,14 +1113,14 @@ public: protected: already_AddRefed doCreateShell(nsPresContext* aContext, nsViewManager* aViewManager, - mozilla::StyleSetHandle aStyleSet); + nsStyleSet* aStyleSet); void RemoveDocStyleSheetsFromStyleSets(); void RemoveStyleSheetsFromStyleSets( const nsTArray>& aSheets, mozilla::SheetType aType); void ResetStylesheetsToURI(nsIURI* aURI); - void FillStyleSet(mozilla::StyleSetHandle aStyleSet); + void FillStyleSet(nsStyleSet* aStyleSet); // Return whether all the presshells for this document are safe to flush bool IsSafeToFlush() const; diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index b7e67600c5..90c0668e2e 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -96,6 +96,7 @@ class nsWindowSizes; class nsDOMCaretPosition; class nsViewportInfo; class nsIGlobalObject; +class nsStyleSet; struct nsCSSSelectorList; namespace mozilla { @@ -103,7 +104,6 @@ class CSSStyleSheet; class ErrorResult; class EventStates; class PendingAnimationTracker; -class StyleSetHandle; class SVGAttrAnimationRuleProcessor; template class OwningNonNull; @@ -781,7 +781,7 @@ public: virtual already_AddRefed CreateShell( nsPresContext* aContext, nsViewManager* aViewManager, - mozilla::StyleSetHandle aStyleSet) = 0; + nsStyleSet* aStyleSet) = 0; virtual void DeleteShell() = 0; nsIPresShell* GetShell() const diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 0314664343..a7d937fd3c 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -121,8 +121,7 @@ #include "nsFontMetrics.h" #include "Units.h" #include "CanvasUtils.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "mozilla/layers/CanvasClient.h" #undef free // apparently defined by some windows header, clashing with a free() @@ -2670,7 +2669,7 @@ GetFontParentStyleContext(Element* aElement, nsIPresShell* aPresShell, // otherwise inherit from default (10px sans-serif) - nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko(); + nsStyleSet* styleSet = aPresShell->StyleSet(); if (!styleSet) { aError.Throw(NS_ERROR_FAILURE); return nullptr; @@ -2711,7 +2710,7 @@ GetFontStyleContext(Element* aElement, const nsAString& aFont, nsAString& aOutUsedFont, ErrorResult& aError) { - nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko(); + nsStyleSet* styleSet = aPresShell->StyleSet(); if (!styleSet) { aError.Throw(NS_ERROR_FAILURE); return nullptr; @@ -2785,7 +2784,7 @@ ResolveStyleForFilter(const nsAString& aFilterString, nsStyleContext* aParentContext, ErrorResult& aError) { - nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko(); + nsStyleSet* styleSet = aPresShell->StyleSet(); if (!styleSet) { aError.Throw(NS_ERROR_FAILURE); return nullptr; diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index b34f10df6e..8375c6df8e 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -103,8 +103,7 @@ #include "mozilla/dom/HTMLBodyElement.h" #include "imgIContainer.h" #include "nsComputedDOMStyle.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "ReferrerPolicy.h" #include "mozilla/dom/HTMLLabelElement.h" @@ -3019,7 +3018,7 @@ IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell) return false; } - StyleSetHandle styleSet = aPresShell->StyleSet(); + nsStyleSet* styleSet = aPresShell->StyleSet(); RefPtr sc; for (int32_t i = elementsToCheck.Length() - 1; i >= 0; --i) { if (sc) { diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index bfce03ec63..fd8f460738 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -273,7 +273,7 @@ nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, already_AddRefed nsHTMLDocument::CreateShell(nsPresContext* aContext, nsViewManager* aViewManager, - StyleSetHandle aStyleSet) + nsStyleSet* aStyleSet) { return doCreateShell(aContext, aViewManager, aStyleSet); } diff --git a/dom/html/nsHTMLDocument.h b/dom/html/nsHTMLDocument.h index 582ac8f5b2..d7e6f88429 100644 --- a/dom/html/nsHTMLDocument.h +++ b/dom/html/nsHTMLDocument.h @@ -55,7 +55,7 @@ public: virtual already_AddRefed CreateShell( nsPresContext* aContext, nsViewManager* aViewManager, - mozilla::StyleSetHandle aStyleSet) override; + nsStyleSet* aStyleSet) override; virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, diff --git a/gfx/layers/apz/util/ActiveElementManager.cpp b/gfx/layers/apz/util/ActiveElementManager.cpp index 20d34aa2bb..a51b038d9c 100644 --- a/gfx/layers/apz/util/ActiveElementManager.cpp +++ b/gfx/layers/apz/util/ActiveElementManager.cpp @@ -6,8 +6,6 @@ #include "ActiveElementManager.h" #include "mozilla/EventStateManager.h" #include "mozilla/EventStates.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "mozilla/Preferences.h" #include "base/message_loop.h" #include "base/task.h" @@ -166,7 +164,7 @@ ElementHasActiveStyle(dom::Element* aElement) if (!pc) { return false; } - StyleSetHandle styleSet = pc->StyleSet(); + nsStyleSet* styleSet = pc->StyleSet(); for (dom::Element* e = aElement; e; e = e->GetParentElement()) { if (styleSet->HasStateDependentStyle(e, NS_EVENT_STATE_ACTIVE)) { AEM_LOG("Element %p's style is dependent on the active state\n", e); diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 8bbbe6407b..23eaea9355 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -3869,7 +3869,7 @@ RestyleManager::ComputeAndProcessStyleChange(nsStyleContext* aNewContext, nsStyleSet* ElementRestyler::StyleSet() const { - return mPresContext->StyleSet()->AsGecko(); + return mPresContext->StyleSet(); } AutoDisplayContentsAncestorPusher::AutoDisplayContentsAncestorPusher( diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index c20f96979d..199587d82c 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -458,7 +458,7 @@ public: private: inline nsStyleSet* StyleSet() const { - return PresContext()->StyleSet()->AsGecko(); + return PresContext()->StyleSet(); } /* aMinHint is the minimal change that should be made to the element */ diff --git a/layout/base/RestyleManagerBase.cpp b/layout/base/RestyleManagerBase.cpp index 192c0df99e..94e03b9031 100644 --- a/layout/base/RestyleManagerBase.cpp +++ b/layout/base/RestyleManagerBase.cpp @@ -5,8 +5,7 @@ #include "mozilla/RestyleManagerBase.h" #include "mozilla/RestyleManager.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" // for Ptr::HasStateDependentStyle +#include "nsStyleSet.h" // for HasStateDependentStyle #include "ActiveLayerTracker.h" #include "nsCSSFrameConstructor.h" #include "nsCSSRendering.h" @@ -52,7 +51,7 @@ RestyleManagerBase::ContentStateChangedInternal(Element* aElement, MOZ_ASSERT(aOutChangeHint); MOZ_ASSERT(aOutRestyleHint); - StyleSetHandle styleSet = PresContext()->StyleSet(); + nsStyleSet* styleSet = PresContext()->StyleSet(); NS_ASSERTION(styleSet, "couldn't get style set"); *aOutChangeHint = nsChangeHint(0); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index d6176bd945..e6a7c76dd8 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -34,8 +34,7 @@ #include "nsPresShell.h" #include "nsIPresShell.h" #include "nsUnicharUtils.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsViewManager.h" #include "nsStyleConsts.h" #include "nsIDOMXULElement.h" @@ -1837,7 +1836,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat MOZ_ASSERT(aParentContent->IsElement()); - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); // Probe for the existence of the pseudo-element RefPtr pseudoStyleContext; @@ -2691,11 +2690,11 @@ nsCSSFrameConstructor::ConstructRootFrame() { AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC); - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); // Set up our style rule observer. // XXXbz wouldn't this make more sense as part of presshell init? - styleSet->AsGecko()->SetBindingManager(mDocument->BindingManager()); + styleSet->SetBindingManager(mDocument->BindingManager()); // --------- BUILD VIEWPORT ----------- RefPtr viewportPseudoStyle = @@ -2860,7 +2859,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement) // Start off with the viewport as parent; we'll adjust it as needed. nsContainerFrame* parentFrame = viewportFrame; - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); // If paginated, make sure we don't put scrollbars in if (!isScrollable) { rootPseudoStyle = styleSet->ResolveAnonymousBoxStyle(rootPseudo, @@ -2961,7 +2960,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell, nsContainerFrame*& aCanvasFrame) { nsStyleContext* parentStyleContext = aParentFrame->StyleContext(); - StyleSetHandle styleSet = aPresShell->StyleSet(); + nsStyleSet* styleSet = aPresShell->StyleSet(); RefPtr pagePseudoStyle; pagePseudoStyle = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::page, @@ -4560,7 +4559,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState, aNewFrame = gfxScrollFrame; // we used the style that was passed in. So resolve another one. - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); RefPtr scrolledChildStyle = styleSet->ResolveAnonymousBoxStyle(aScrolledPseudo, contentStyle); @@ -5014,7 +5013,7 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext, nsFrameConstructorState* aState, Element* aOriginatingElementOrNull) { - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); aContent->OwnerDoc()->FlushPendingLinkUpdates(); RefPtr result; @@ -5096,7 +5095,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState, nsStyleContext* parentContext = nsFrame::CorrectStyleParentFrame(aParentFrame, anonPseudo)->StyleContext(); - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); RefPtr blockContext; blockContext = styleSet-> ResolveAnonymousBoxStyle(anonPseudo, parentContext); @@ -11031,7 +11030,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame( // get a proper style context for it (the one passed in is for the // letter frame and will have the float property set on it; the text // frame shouldn't have that set). - StyleSetHandle styleSet = mPresShell->StyleSet(); + nsStyleSet* styleSet = mPresShell->StyleSet(); RefPtr textSC = styleSet-> ResolveStyleForText(aTextContent, aStyleContext); aTextFrame->SetStyleContextWithoutNotification(textSC); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 1068669a8a..75d42ebe04 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -19,8 +19,7 @@ #include "nsIDocument.h" #include "nsPresContext.h" #include "nsIPresShell.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsIFrame.h" #include "nsIWritablePropertyBag2.h" #include "nsSubDocumentFrame.h" @@ -679,12 +678,12 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) "Someone should have destroyed the presshell!"); // Create the style set... - StyleSetHandle styleSet = CreateStyleSet(mDocument); + nsStyleSet* styleSet = CreateStyleSet(mDocument); // Now make the shell for the document mPresShell = mDocument->CreateShell(mPresContext, mViewManager, styleSet); if (!mPresShell) { - styleSet->Delete(); + delete styleSet; return NS_ERROR_FAILURE; } @@ -2268,7 +2267,7 @@ nsDocumentViewer::RequestWindowClose(bool* aCanClose) return NS_OK; } -StyleSetHandle +nsStyleSet* nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) { // Make sure this does the same thing as PresShell::AddSheet wrt ordering. @@ -2276,7 +2275,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) // this should eventually get expanded to allow for creating // different sets for different media - StyleSetHandle styleSet = new nsStyleSet(); + nsStyleSet* styleSet = new nsStyleSet(); styleSet->BeginUpdate(); @@ -2307,7 +2306,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) } if (sheet) - styleSet->AppendStyleSheet(SheetType::User, sheet); + styleSet->AppendStyleSheet(SheetType::User, sheet->AsGecko()); // Append chrome sheets (scrollbars + forms). bool shouldOverride = false; @@ -2343,7 +2342,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) cssLoader->LoadSheetSync(uri, &chromeSheet); if (!chromeSheet) continue; - styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet); + styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsGecko()); shouldOverride = true; } free(str); @@ -2354,7 +2353,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) if (!shouldOverride) { sheet = cache->ScrollbarsSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } @@ -2370,12 +2369,12 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) sheet = cache->NumberControlSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } sheet = cache->FormsSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } if (aDocument->LoadsFullXULStyleSheetUpFront()) { @@ -2383,7 +2382,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) // up-front here. sheet = cache->XULSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } @@ -2391,25 +2390,25 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) if (sheet) { // Load the minimal XUL rules for scrollbars and a few other XUL things // that non-XUL (typically HTML) documents commonly use. - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } sheet = cache->CounterStylesSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) { sheet = cache->NoScriptSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) { sheet = cache->NoFramesSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } @@ -2418,26 +2417,26 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) sheet = cache->HTMLSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } styleSet->PrependStyleSheet(SheetType::Agent, - cache->UASheet()); + cache->UASheet()->AsGecko()); } else { // SVG documents may have scrollbars and need the scrollbar styling. sheet = cache->MinimalXULSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); } } nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) { - styleSet->AppendStyleSheet(SheetType::Agent, sheet); + styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); } for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) { - styleSet->PrependStyleSheet(SheetType::User, sheet); + styleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko()); } } diff --git a/layout/base/nsFrameManagerBase.h b/layout/base/nsFrameManagerBase.h index 1f0daa7fec..2ae1ea0ed6 100644 --- a/layout/base/nsFrameManagerBase.h +++ b/layout/base/nsFrameManagerBase.h @@ -24,6 +24,7 @@ class nsIFrame; class nsIPresShell; +class nsStyleSet; class nsFrameManagerBase { diff --git a/layout/base/nsIDocumentViewerPrint.h b/layout/base/nsIDocumentViewerPrint.h index e3c397f3a3..c0d730dc00 100644 --- a/layout/base/nsIDocumentViewerPrint.h +++ b/layout/base/nsIDocumentViewerPrint.h @@ -8,10 +8,8 @@ #include "nsISupports.h" class nsIDocument; -namespace mozilla { -class StyleSetHandle; -} // namespace mozilla class nsIPresShell; +class nsStyleSet; class nsPresContext; class nsViewManager; @@ -38,7 +36,7 @@ public: // The style set returned by CreateStyleSet is in the middle of an // update batch so that the caller can add sheets to it if needed. // Callers should call EndUpdate() on it when ready to use. - virtual mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) = 0; + virtual nsStyleSet* CreateStyleSet(nsIDocument* aDocument) = 0; virtual void IncrementDestroyRefCount() = 0; virtual void DecrementDestroyRefCount() = 0; @@ -74,7 +72,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewerPrint, bool GetIsPrinting() override; \ void SetIsPrintPreview(bool aIsPrintPreview) override; \ bool GetIsPrintPreview() override; \ - mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) override; \ + nsStyleSet* CreateStyleSet(nsIDocument* aDocument) override; \ void IncrementDestroyRefCount() override; \ void DecrementDestroyRefCount() override; \ void ReturnToGalleyPresentation() override; \ diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index cf19867ef0..5ae95d5825 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -24,7 +24,6 @@ #include "mozilla/EventForwards.h" #include "mozilla/MemoryReporting.h" #include "mozilla/StaticPtr.h" -#include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSheet.h" #include "mozilla/WeakPtr.h" #include "gfxPoint.h" @@ -62,6 +61,7 @@ class nsIPageSequenceFrame; class nsCanvasFrame; class nsAString; class nsCaret; +class nsStyleSet; namespace mozilla { class AccessibleCaretEventHub; class CSSStyleSheet; @@ -323,7 +323,7 @@ public: #endif #ifdef MOZILLA_INTERNAL_API - mozilla::StyleSetHandle StyleSet() const { return mStyleSet; } + nsStyleSet* StyleSet() const { return mStyleSet; } nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; } @@ -1722,7 +1722,7 @@ protected: // we must share ownership. nsCOMPtr mDocument; RefPtr mPresContext; - mozilla::StyleSetHandle mStyleSet; // [OWNS] + nsStyleSet* mStyleSet; // [OWNS] nsCSSFrameConstructor* mFrameConstructor; // [OWNS] nsViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to nsPresArena mFrameArena; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 88b109e6da..d1baeb0d1c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -114,8 +114,7 @@ #include "mozilla/EventDispatcher.h" #include "mozilla/EventStateManager.h" #include "mozilla/RuleNodeCacheConditions.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "RegionBuilder.h" #include "SVGSVGElement.h" #include "nsDocument.h" diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 785b54bbc7..f473619537 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -18,8 +18,7 @@ #include "nsDocShell.h" #include "nsIContentViewer.h" #include "nsPIDOMWindow.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsIContent.h" #include "nsIFrame.h" #include "nsIDocument.h" @@ -1142,18 +1141,18 @@ nsPresContext::CompatibilityModeChanged() return; } - StyleSetHandle styleSet = mShell->StyleSet(); + nsStyleSet* styleSet = mShell->StyleSet(); auto cache = nsLayoutStylesheetCache::Get(); StyleSheet* sheet = cache->QuirkSheet(); if (needsQuirkSheet) { // quirk.css needs to come after html.css; we just keep it at the end. DebugOnly rv = - styleSet->AppendStyleSheet(SheetType::Agent, sheet); + styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css"); } else { DebugOnly rv = - styleSet->RemoveStyleSheet(SheetType::Agent, sheet); + styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsGecko()); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css"); } @@ -1375,7 +1374,7 @@ GetPropagatedScrollStylesForViewport(nsPresContext* aPresContext, } // Check the style on the document root element - StyleSetHandle styleSet = aPresContext->StyleSet(); + nsStyleSet* styleSet = aPresContext->StyleSet(); RefPtr rootStyle; rootStyle = styleSet->ResolveStyleFor(docElement, nullptr); if (CheckOverflow(rootStyle->StyleDisplay(), aStyles)) { @@ -1882,7 +1881,7 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint, // MediumFeaturesChanged updates the applied rules, so it always gets called. if (mShell) { - if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) { + if (mShell->StyleSet()->MediumFeaturesChanged()) { aRestyleHint |= eRestyle_Subtree; } } @@ -2135,7 +2134,7 @@ nsPresContext::NotifyMissingFonts() void nsPresContext::EnsureSafeToHandOutCSSRules() { - nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko(); + nsStyleSet* styleSet = mShell->StyleSet(); if (!styleSet) { return; } @@ -2475,7 +2474,7 @@ nsPresContext::HasCachedStyleData() return false; } - nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko(); + nsStyleSet* styleSet = mShell->StyleSet(); if (!styleSet) { return mShell->DidInitialize(); } diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index b90c96c477..d904948c86 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -229,7 +229,7 @@ public: } #ifdef MOZILLA_INTERNAL_API - mozilla::StyleSetHandle StyleSet() { return GetPresShell()->StyleSet(); } + nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); } nsFrameManager* FrameManager() { return PresShell()->FrameManager(); } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index aba11e4c04..43a644a2b7 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -190,8 +190,6 @@ #include "mozilla/layers/InputAPZContext.h" #include "mozilla/layers/ScrollInputMethods.h" #include "nsStyleSet.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/dom/ImageTracker.h" @@ -848,7 +846,7 @@ PresShell::~PresShell() MOZ_ASSERT(mAllocatedPointers.IsEmpty(), "Some pres arena objects were not freed"); - mStyleSet->Delete(); + delete mStyleSet; delete mFrameConstructor; mCurrentEventContent = nullptr; @@ -864,7 +862,7 @@ void PresShell::Init(nsIDocument* aDocument, nsPresContext* aPresContext, nsViewManager* aViewManager, - StyleSetHandle aStyleSet) + nsStyleSet* aStyleSet) { NS_PRECONDITION(aDocument, "null ptr"); NS_PRECONDITION(aPresContext, "null ptr"); @@ -1400,7 +1398,7 @@ PresShell::UpdatePreferenceStyles() RemovePreferenceStyles(); - mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet); + mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsGecko()); mPrefStyleSheet = newPrefSheet; mStyleSet->EndUpdate(); @@ -1410,7 +1408,7 @@ void PresShell::RemovePreferenceStyles() { if (mPrefStyleSheet) { - mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet); + mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsGecko()); mPrefStyleSheet = nullptr; } } @@ -1433,13 +1431,13 @@ PresShell::AddUserSheet(nsISupports* aSheet) // Iterate forwards when removing so the searches for RemoveStyleSheet are as // short as possible. for (StyleSheet* sheet : userSheets) { - mStyleSet->RemoveStyleSheet(SheetType::User, sheet); + mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsGecko()); } // Now iterate backwards, so that the order of userSheets will be the same as // the order of sheets from it in the style set. for (StyleSheet* sheet : Reversed(userSheets)) { - mStyleSet->PrependStyleSheet(SheetType::User, sheet); + mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko()); } mStyleSet->EndUpdate(); @@ -1457,7 +1455,7 @@ PresShell::AddAgentSheet(nsISupports* aSheet) return; } - mStyleSet->AppendStyleSheet(SheetType::Agent, sheet); + mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); RestyleForCSSRuleChanges(); } @@ -1474,9 +1472,9 @@ PresShell::AddAuthorSheet(nsISupports* aSheet) StyleSheet* firstAuthorSheet = mDocument->GetFirstAdditionalAuthorSheet(); if (firstAuthorSheet) { - mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet, firstAuthorSheet); + mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsGecko(), firstAuthorSheet->AsGecko()); } else { - mStyleSet->AppendStyleSheet(SheetType::Doc, sheet); + mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko()); } RestyleForCSSRuleChanges(); @@ -1490,7 +1488,7 @@ PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet) return; } - mStyleSet->RemoveStyleSheet(aType, sheet); + mStyleSet->RemoveStyleSheet(aType, sheet->AsGecko()); RestyleForCSSRuleChanges(); } @@ -4168,7 +4166,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged"); NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); - nsStyleSet* styleSet = mStyleSet->GetAsGecko(); + nsStyleSet* styleSet = mStyleSet; if (!styleSet) { return; } @@ -8772,19 +8770,23 @@ PresShell::GetAgentStyleSheets(nsTArray>& aSheets) nsresult PresShell::SetAgentStyleSheets(const nsTArray>& aSheets) { - return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets); + nsTArray> newSheets(aSheets.Length()); + for (auto& sheet : aSheets) { + newSheets.AppendElement(sheet->AsGecko()); + } + return mStyleSet->ReplaceSheets(SheetType::Agent, newSheets); } nsresult PresShell::AddOverrideStyleSheet(StyleSheet* aSheet) { - return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet); + return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsGecko()); } nsresult PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet) { - return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet); + return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsGecko()); } static void @@ -9957,7 +9959,7 @@ PresShell::VerifyIncrementalReflow() // Create a new presentation shell to view the document. Use the // exact same style information that this document has. - nsAutoPtr newSet(CloneStyleSet(mStyleSet->AsGecko())); + nsAutoPtr newSet(CloneStyleSet(mStyleSet)); nsCOMPtr sh = mDocument->CreateShell(cx, vm, newSet.get()); NS_ENSURE_TRUE(sh, false); newSet.forget(); @@ -10802,7 +10804,7 @@ PresShell::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf, *aPresShellSize += mFramesToDirty.ShallowSizeOfExcludingThis(aMallocSizeOf); *aPresShellSize += aArenaObjectsSize->mOther; - if (nsStyleSet* styleSet = StyleSet()->GetAsGecko()) { + if (nsStyleSet* styleSet = StyleSet()) { *aStyleSetsSize += styleSet->SizeOfIncludingThis(aMallocSizeOf); } @@ -11010,7 +11012,7 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType, } *aRetVal = false; - if (nsStyleSet* styleSet = mStyleSet->GetAsGecko()) { + if (nsStyleSet* styleSet = mStyleSet) { *aRetVal = styleSet->HasRuleProcessorUsedByMultipleStyleSets(type); } return NS_OK; diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index fbbcfc7ecd..f47711253c 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -34,13 +34,13 @@ #include "mozilla/Attributes.h" #include "mozilla/EventForwards.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/StyleSetHandle.h" #include "mozilla/UniquePtr.h" #include "MobileViewportManager.h" #include "ZoomConstraintsClient.h" class nsIDocShell; class nsRange; +class nsStyleSet; struct RangePaintInfo; struct nsCallbackEventRequest; @@ -100,7 +100,7 @@ public: static bool IsTargetIframe(nsINode* aTarget); void Init(nsIDocument* aDocument, nsPresContext* aPresContext, - nsViewManager* aViewManager, mozilla::StyleSetHandle aStyleSet); + nsViewManager* aViewManager, nsStyleSet* aStyleSet); virtual void Destroy() override; virtual void MakeZombie() override; diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index 5113572995..608273a539 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -8,8 +8,7 @@ #include "nsGkAtoms.h" #include "nsCSSPseudoElements.h" #include "nsNameSpaceManager.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsDisplayList.h" #include "nsITheme.h" #include "nsFrame.h" @@ -376,7 +375,7 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext) { // get all the styles nsStyleContext* context = mFrame->StyleContext(); - StyleSetHandle styleSet = aPresContext->StyleSet(); + nsStyleSet* styleSet = aPresContext->StyleSet(); #ifdef DEBUG if (mInnerFocusStyle) { diff --git a/layout/forms/nsColorControlFrame.cpp b/layout/forms/nsColorControlFrame.cpp index 63aee814aa..2ba410c31f 100644 --- a/layout/forms/nsColorControlFrame.cpp +++ b/layout/forms/nsColorControlFrame.cpp @@ -14,8 +14,7 @@ #include "nsIDOMHTMLInputElement.h" #include "nsIDOMNode.h" #include "nsIFormControl.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsIDocument.h" using mozilla::dom::Element; diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 2d0395d7a1..e6b2de334d 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -30,8 +30,7 @@ #include "nsIDocument.h" #include "nsIScrollableFrame.h" #include "nsListControlFrame.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" #include "nsLayoutUtils.h" @@ -1358,7 +1357,7 @@ nsComboboxControlFrame::CreateFrameForDisplayNode() // Get PresShell nsIPresShell *shell = PresContext()->PresShell(); - StyleSetHandle styleSet = shell->StyleSet(); + nsStyleSet* styleSet = shell->StyleSet(); // create the style contexts for the anonymous block frame and text frame RefPtr styleContext; diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index 768abbc21d..fd125896c7 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -6,8 +6,7 @@ #include "nsGfxButtonControlFrame.h" #include "nsIFormControl.h" #include "nsGkAtoms.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsContentUtils.h" // MouseEvent suppression in PP #include "nsContentList.h" diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index e90bbb4667..4d040f5c29 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -21,8 +21,6 @@ #include "nsContentList.h" #include "nsCSSPseudoElements.h" #include "nsStyleSet.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "nsThemeConstants.h" #include diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index 3e625d39af..1bae906b16 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -22,8 +22,6 @@ #include "nsContentList.h" #include "nsCSSPseudoElements.h" #include "nsStyleSet.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "nsIDOMMutationEvent.h" #include "nsThreadUtils.h" #include "mozilla/FloatingPoint.h" diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index c734787d24..1cd10da66d 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -21,8 +21,6 @@ #include "nsContentList.h" #include "nsCSSPseudoElements.h" #include "nsStyleSet.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "nsThemeConstants.h" #include diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index 7ed05a21c4..6d60372463 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -24,8 +24,7 @@ #include "nsNodeInfoManager.h" #include "nsRenderingContext.h" #include "mozilla/dom/Element.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsThemeConstants.h" #ifdef ACCESSIBILITY @@ -84,7 +83,7 @@ nsRangeFrame::Init(nsIContent* aContent, } aContent->AddEventListener(NS_LITERAL_STRING("touchstart"), mDummyTouchListener, false); - StyleSetHandle styleSet = PresContext()->StyleSet(); + nsStyleSet* styleSet = PresContext()->StyleSet(); mOuterFocusStyle = styleSet->ProbePseudoElementStyle(aContent->AsElement(), diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index fd89ad075e..ad1af13221 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -44,8 +44,7 @@ #include "mozilla/TextEditRules.h" #include "nsContentUtils.h" #include "nsTextNode.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/HTMLTextAreaElement.h" #include "mozilla/dom/ScriptSettings.h" diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index f4e63cfea4..c0247f0b99 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -53,8 +53,7 @@ #include "nsISelection.h" #include "mozilla/dom/HTMLDetailsElement.h" #include "mozilla/dom/HTMLSummaryElement.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsBidiPresUtils.h" diff --git a/layout/generic/nsFirstLetterFrame.cpp b/layout/generic/nsFirstLetterFrame.cpp index a038c48694..f436245929 100644 --- a/layout/generic/nsFirstLetterFrame.cpp +++ b/layout/generic/nsFirstLetterFrame.cpp @@ -11,8 +11,7 @@ #include "nsIContent.h" #include "nsLineLayout.h" #include "nsGkAtoms.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsFrameManager.h" #include "mozilla/RestyleManagerHandle.h" #include "mozilla/RestyleManagerHandleInlines.h" diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 01d9f78154..73a59ae739 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -29,8 +29,7 @@ #include "nsIDOMMutationEvent.h" #include "nsNameSpaceManager.h" #include "nsCSSAnonBoxes.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "mozilla/dom/Element.h" #include "nsDisplayList.h" #include "nsNodeUtils.h" @@ -802,7 +801,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus); nsIPresShell *shell = aPresContext->PresShell(); - StyleSetHandle styleSet = shell->StyleSet(); + nsStyleSet* styleSet = shell->StyleSet(); GetParent()->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index d6f47f2e42..6afdeef618 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -71,8 +71,7 @@ #include "gfxRect.h" #include "ImageLayers.h" #include "ImageContainer.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsBlockFrame.h" #include "nsStyleStructInlines.h" diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index 8f24af73c1..c15e33cb6c 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -19,8 +19,7 @@ #include "nsDisplayList.h" #include "mozilla/Likely.h" #include "SVGTextFrame.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #ifdef DEBUG #undef NOISY_PUSHING diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 7e73692c42..a07fb749a9 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -63,8 +63,7 @@ #include "nsIWordBreaker.h" #include "nsGenericDOMDataNode.h" #include "nsIFrameInlines.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include #include diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index f60cfd073f..5e0cb208a8 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -48,8 +48,7 @@ #include "nsCSSProps.h" #include "nsCSSValue.h" #include "nsColor.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsStyleUtil.h" #include "nsQueryObject.h" @@ -87,7 +86,7 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength, nsIPresShell* presShell = document->GetShell(); if (presShell) { - StyleSetHandle styleSet = presShell->StyleSet(); + nsStyleSet* styleSet = presShell->StyleSet(); SheetType sheetType = SheetType::Agent; for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); @@ -97,7 +96,7 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength, sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); } AutoTArray xblSheetArray; - styleSet->AsGecko()->AppendAllXBLStyleSheets(xblSheetArray); + styleSet->AppendAllXBLStyleSheets(xblSheetArray); // The XBL stylesheet array will quite often be full of duplicates. Cope: nsTHashtable> sheetSet; diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index acb69e3879..680a64dd55 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -15,8 +15,7 @@ #include "gfxMathTable.h" // used to map attributes into CSS rules -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsDisplayList.h" #include "nsRenderingContext.h" diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index d232b669bb..e17e0b8a08 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -125,8 +125,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsIChannel.h" #include "xpcpublic.h" #include "nsVariant.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" using namespace mozilla; using namespace mozilla::dom; @@ -2239,12 +2238,12 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO) rv = aPO->mViewManager->Init(printData->mPrintDC); NS_ENSURE_SUCCESS(rv,rv); - StyleSetHandle styleSet = mDocViewerPrint->CreateStyleSet(aPO->mDocument); + nsStyleSet* styleSet = mDocViewerPrint->CreateStyleSet(aPO->mDocument); aPO->mPresShell = aPO->mDocument->CreateShell(aPO->mPresContext, aPO->mViewManager, styleSet); if (!aPO->mPresShell) { - styleSet->Delete(); + delete styleSet; return NS_ERROR_FAILURE; } diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index 46bd866569..dedf017834 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -17,8 +17,7 @@ #include "nsTArray.h" #include "nsTHashtable.h" #include "nsUnicodeProperties.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" namespace mozilla { @@ -2028,9 +2027,9 @@ CounterStyleManager::BuildCounterStyle(const nsSubstring& aName) // It is intentional that the predefined names are case-insensitive // but the user-defined names case-sensitive. - StyleSetHandle styleSet = mPresContext->StyleSet(); + nsStyleSet* styleSet = mPresContext->StyleSet(); nsCSSCounterStyleRule* rule = - styleSet->AsGecko()->CounterStyleRuleForName(aName); + styleSet->CounterStyleRuleForName(aName); if (rule) { data = new (mPresContext) CustomCounterStyle(aName, this, rule); } else { @@ -2070,9 +2069,9 @@ CounterStyleManager::NotifyRuleChanged() RefPtr& style = iter.Data(); bool toBeUpdated = false; bool toBeRemoved = false; - StyleSetHandle styleSet = mPresContext->StyleSet(); + nsStyleSet* styleSet = mPresContext->StyleSet(); nsCSSCounterStyleRule* newRule = - styleSet->AsGecko()->CounterStyleRuleForName(iter.Key()); + styleSet->CounterStyleRuleForName(iter.Key()); if (!newRule) { if (style->IsCustomStyle()) { toBeRemoved = true; diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index 2f40533970..1a46ef7592 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -3261,7 +3261,7 @@ ComputeValuesFromStyleRule(nsCSSPropertyID aProperty, return false; } - nsStyleSet* styleSet = aStyleContext->PresContext()->StyleSet()->AsGecko(); + nsStyleSet* styleSet = aStyleContext->PresContext()->StyleSet(); RefPtr tmpStyleContext; if (aIsContextSensitive) { diff --git a/layout/style/StyleSetHandle.h b/layout/style/StyleSetHandle.h deleted file mode 100644 index 6d17c71605..0000000000 --- a/layout/style/StyleSetHandle.h +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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_StyleSetHandle_h -#define mozilla_StyleSetHandle_h - -#include "mozilla/EventStates.h" -#include "mozilla/RefPtr.h" -#include "mozilla/SheetType.h" -#include "mozilla/StyleSheet.h" -#include "nsChangeHint.h" -#include "nsCSSPseudoElements.h" -#include "nsTArray.h" - -namespace mozilla { -class CSSStyleSheet; -namespace dom { -class Element; -} // namespace dom -} // namespace mozilla -class nsIAtom; -class nsIContent; -class nsIDocument; -class nsStyleContext; -class nsStyleSet; -class nsPresContext; -struct TreeMatchContext; - -namespace mozilla { - -/** - * Smart pointer class that can hold a pointer to an nsStyleSet. - */ -class StyleSetHandle -{ -public: - // We define this Ptr class with a StyleSet API that forwards on to the - // wrapped pointer, rather than putting these methods on StyleSetHandle - // itself, so that we can have StyleSetHandle behave like a smart pointer and - // be dereferenced with operator->. - class Ptr - { - public: - friend class ::mozilla::StyleSetHandle; - - nsStyleSet* AsGecko() - { - return reinterpret_cast(mValue); - } - - nsStyleSet* GetAsGecko() { return AsGecko(); } - - const nsStyleSet* AsGecko() const - { - return const_cast(this)->AsGecko(); - } - - const nsStyleSet* GetAsGecko() const { return AsGecko(); } - - // These inline methods are defined in StyleSetHandleInlines.h. - inline void Delete(); - - // Style set interface. These inline methods are defined in - // StyleSetHandleInlines.h and just forward to the underlying - // nsStyleSet. See corresponding comments in nsStyleSet.h for - // descriptions of these methods. - - inline void Init(nsPresContext* aPresContext); - inline void BeginShutdown(); - inline void Shutdown(); - inline bool GetAuthorStyleDisabled() const; - inline nsresult SetAuthorStyleDisabled(bool aStyleDisabled); - inline void BeginUpdate(); - inline nsresult EndUpdate(); - inline already_AddRefed - ResolveStyleFor(dom::Element* aElement, - nsStyleContext* aParentContext); - inline already_AddRefed - ResolveStyleFor(dom::Element* aElement, - nsStyleContext* aParentContext, - TreeMatchContext& aTreeMatchContext); - inline already_AddRefed - ResolveStyleForText(nsIContent* aTextNode, - nsStyleContext* aParentContext); - inline already_AddRefed - ResolveStyleForOtherNonElement(nsStyleContext* aParentContext); - inline already_AddRefed - ResolvePseudoElementStyle(dom::Element* aParentElement, - mozilla::CSSPseudoElementType aType, - nsStyleContext* aParentContext, - dom::Element* aPseudoElement); - inline already_AddRefed - ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext, - uint32_t aFlags = 0); - inline nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet); - inline nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet); - inline nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet); - inline nsresult ReplaceSheets(SheetType aType, - const nsTArray>& aNewSheets); - inline nsresult InsertStyleSheetBefore(SheetType aType, - StyleSheet* aNewSheet, - StyleSheet* aReferenceSheet); - inline int32_t SheetCount(SheetType aType) const; - inline StyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const; - inline nsresult RemoveDocStyleSheet(StyleSheet* aSheet); - inline nsresult AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument); - inline already_AddRefed - ProbePseudoElementStyle(dom::Element* aParentElement, - mozilla::CSSPseudoElementType aType, - nsStyleContext* aParentContext); - inline already_AddRefed - ProbePseudoElementStyle(dom::Element* aParentElement, - mozilla::CSSPseudoElementType aType, - nsStyleContext* aParentContext, - TreeMatchContext& aTreeMatchContext, - dom::Element* aPseudoElement = nullptr); - inline nsRestyleHint HasStateDependentStyle(dom::Element* aElement, - EventStates aStateMask); - inline nsRestyleHint HasStateDependentStyle( - dom::Element* aElement, - mozilla::CSSPseudoElementType aPseudoType, - dom::Element* aPseudoElement, - EventStates aStateMask); - - inline void RootStyleContextAdded(); - inline void RootStyleContextRemoved(); - - private: - // Stores a pointer to an nsStyleSet. The least - // significant bit is 0 for the former, 1 for the latter. This is - // valid as the least significant bit will never be used for a pointer - // value on platforms we care about. - uintptr_t mValue; - }; - - StyleSetHandle() { mPtr.mValue = 0; } - StyleSetHandle(const StyleSetHandle& aOth) { mPtr.mValue = aOth.mPtr.mValue; } - MOZ_IMPLICIT StyleSetHandle(nsStyleSet* aSet) { *this = aSet; } - - StyleSetHandle& operator=(nsStyleSet* aStyleSet) - { - mPtr.mValue = reinterpret_cast(aStyleSet); - return *this; - } - - // Make StyleSetHandle usable in boolean contexts. - explicit operator bool() const { return !!mPtr.mValue; } - bool operator!() const { return !mPtr.mValue; } - - // Make StyleSetHandle behave like a smart pointer. - Ptr* operator->() { return &mPtr; } - const Ptr* operator->() const { return &mPtr; } - -private: - Ptr mPtr; -}; - -} // namespace mozilla - -#endif // mozilla_StyleSetHandle_h diff --git a/layout/style/StyleSetHandleInlines.h b/layout/style/StyleSetHandleInlines.h deleted file mode 100644 index f99842f822..0000000000 --- a/layout/style/StyleSetHandleInlines.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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_StyleSetHandleInlines_h -#define mozilla_StyleSetHandleInlines_h - -#include "mozilla/StyleSheetInlines.h" -#include "nsStyleSet.h" - -namespace mozilla { - -void -StyleSetHandle::Ptr::Delete() -{ - if (mValue) { - delete AsGecko(); - } -} - -void -StyleSetHandle::Ptr::Init(nsPresContext* aPresContext) -{ - AsGecko()->Init(aPresContext); -} - -void -StyleSetHandle::Ptr::BeginShutdown() -{ - AsGecko()->BeginShutdown(); -} - -void -StyleSetHandle::Ptr::Shutdown() -{ - AsGecko()->Shutdown(); -} - -bool -StyleSetHandle::Ptr::GetAuthorStyleDisabled() const -{ - return AsGecko()->GetAuthorStyleDisabled(); -} - -nsresult -StyleSetHandle::Ptr::SetAuthorStyleDisabled(bool aStyleDisabled) -{ - return AsGecko()->SetAuthorStyleDisabled(aStyleDisabled); -} - -void -StyleSetHandle::Ptr::BeginUpdate() -{ - AsGecko()->BeginUpdate(); -} - -nsresult -StyleSetHandle::Ptr::EndUpdate() -{ - return AsGecko()->EndUpdate(); -} - -// resolve a style context -already_AddRefed -StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement, - nsStyleContext* aParentContext) -{ - return AsGecko()->ResolveStyleFor(aElement, aParentContext); -} - -already_AddRefed -StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement, - nsStyleContext* aParentContext, - TreeMatchContext& aTreeMatchContext) -{ - return AsGecko()->ResolveStyleFor(aElement, aParentContext, aTreeMatchContext); -} - -already_AddRefed -StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode, - nsStyleContext* aParentContext) -{ - return AsGecko()->ResolveStyleForText(aTextNode, aParentContext); -} - -already_AddRefed -StyleSetHandle::Ptr::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext) -{ - return AsGecko()->ResolveStyleForOtherNonElement(aParentContext); -} - -already_AddRefed -StyleSetHandle::Ptr::ResolvePseudoElementStyle(dom::Element* aParentElement, - CSSPseudoElementType aType, - nsStyleContext* aParentContext, - dom::Element* aPseudoElement) -{ - return AsGecko()->ResolvePseudoElementStyle( - aParentElement, aType, aParentContext, aPseudoElement); -} - -// aFlags is an nsStyleSet flags bitfield -already_AddRefed -StyleSetHandle::Ptr::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, - nsStyleContext* aParentContext, - uint32_t aFlags) -{ - return AsGecko()->ResolveAnonymousBoxStyle(aPseudoTag, aParentContext, aFlags); -} - -// manage the set of style sheets in the style set -nsresult -StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet) -{ - return AsGecko()->AppendStyleSheet(aType, aSheet->AsGecko()); -} - -nsresult -StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet) -{ - return AsGecko()->PrependStyleSheet(aType, aSheet->AsGecko()); -} - -nsresult -StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet) -{ - return AsGecko()->RemoveStyleSheet(aType, aSheet->AsGecko()); -} - -nsresult -StyleSetHandle::Ptr::ReplaceSheets(SheetType aType, - const nsTArray>& aNewSheets) -{ - nsTArray> newSheets(aNewSheets.Length()); - for (auto& sheet : aNewSheets) { - newSheets.AppendElement(sheet->AsGecko()); - } - return AsGecko()->ReplaceSheets(aType, newSheets); -} - -nsresult -StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType, - StyleSheet* aNewSheet, - StyleSheet* aReferenceSheet) -{ - return AsGecko()->InsertStyleSheetBefore( - aType, aNewSheet->AsGecko(), aReferenceSheet->AsGecko()); -} - -int32_t -StyleSetHandle::Ptr::SheetCount(SheetType aType) const -{ - return AsGecko()->SheetCount(aType); -} - -StyleSheet* -StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const -{ - return AsGecko()->StyleSheetAt(aType, aIndex); -} - -nsresult -StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet) -{ - return AsGecko()->RemoveDocStyleSheet(aSheet->AsGecko()); -} - -nsresult -StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet, - nsIDocument* aDocument) -{ - return AsGecko()->AddDocStyleSheet(aSheet->AsGecko(), aDocument); -} - -// check whether there is ::before/::after style for an element -already_AddRefed -StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement, - CSSPseudoElementType aType, - nsStyleContext* aParentContext) -{ - return AsGecko()->ProbePseudoElementStyle(aParentElement, aType, aParentContext); -} - -already_AddRefed -StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement, - CSSPseudoElementType aType, - nsStyleContext* aParentContext, - TreeMatchContext& aTreeMatchContext, - dom::Element* aPseudoElement) -{ - return AsGecko()->ProbePseudoElementStyle( - aParentElement, aType, aParentContext, aTreeMatchContext, aPseudoElement); -} - -nsRestyleHint -StyleSetHandle::Ptr::HasStateDependentStyle(dom::Element* aElement, - EventStates aStateMask) -{ - return AsGecko()->HasStateDependentStyle(aElement, aStateMask); -} - -nsRestyleHint -StyleSetHandle::Ptr::HasStateDependentStyle(dom::Element* aElement, - CSSPseudoElementType aPseudoType, - dom::Element* aPseudoElement, - EventStates aStateMask) -{ - return AsGecko()->HasStateDependentStyle(aElement, aPseudoType, aPseudoElement, aStateMask); -} - -void -StyleSetHandle::Ptr::RootStyleContextAdded() -{ - AsGecko()->RootStyleContextAdded(); -} - -void -StyleSetHandle::Ptr::RootStyleContextRemoved() -{ - RootStyleContextAdded(); -} - -} // namespace mozilla - -#endif // mozilla_StyleSetHandleInlines_h diff --git a/layout/style/moz.build b/layout/style/moz.build index 9452ff15ce..2f78f7772e 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -88,8 +88,6 @@ EXPORTS.mozilla += [ 'SheetType.h', 'StyleAnimationValue.h', 'StyleComplexColor.h', - 'StyleSetHandle.h', - 'StyleSetHandleInlines.h', 'StyleSheet.h', 'StyleSheetInfo.h', 'StyleSheetInlines.h', diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index bfcf413ad6..f5f5eeed86 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -525,7 +525,7 @@ ResolvedStyleCache::Get(nsPresContext *aPresContext, nsCOMArray rules; rules.AppendObject(aKeyframeDeclaration); - RefPtr resultStrong = aPresContext->StyleSet()->AsGecko()-> + RefPtr resultStrong = aPresContext->StyleSet()-> ResolveStyleByAddingRules(aParentStyleContext, rules); mCache.Put(aKeyframeDeclaration, resultStrong); result = resultStrong; @@ -1052,7 +1052,7 @@ CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext, StyleAnimationValue computedValue; if (!mStyleWithoutAnimation) { - mStyleWithoutAnimation = aPresContext->StyleSet()->AsGecko()-> + mStyleWithoutAnimation = aPresContext->StyleSet()-> ResolveStyleWithoutAnimation(mTarget, mStyleContext, eRestyle_AllHintsWithAnimations); } @@ -1098,7 +1098,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, nsCSSKeyframesRule* rule = src.GetName().IsEmpty() ? nullptr - : mPresContext->StyleSet()->AsGecko()->KeyframesRuleForName(src.GetName()); + : mPresContext->StyleSet()->KeyframesRuleForName(src.GetName()); if (!rule) { continue; } diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 006d8ffbba..68cbdbea2e 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -35,8 +35,7 @@ #include "nsIDocument.h" #include "nsCSSPseudoElements.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "imgIRequest.h" #include "nsLayoutUtils.h" #include "nsCSSKeywords.h" @@ -504,7 +503,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement, if (!presContext) return nullptr; - StyleSetHandle styleSet = presShell->StyleSet(); + nsStyleSet* styleSet = presShell->StyleSet(); RefPtr sc; if (aPseudo) { @@ -543,7 +542,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement, rules[i].swap(rules[length - i - 1]); } - sc = styleSet->AsGecko()->ResolveStyleForRules(parentContext, rules); + sc = styleSet->ResolveStyleForRules(parentContext, rules); } return sc.forget(); diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp index 7b68990333..ebdbb6641c 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -18,7 +18,8 @@ #include "nsWrapperCacheInlines.h" #include "nsIFrame.h" #include "ActiveLayerTracker.h" -#include "StyleSetHandle.h" + +class nsStyleSet; using namespace mozilla; using namespace mozilla::dom; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index f2b914931f..1bba07ce6b 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1659,7 +1659,7 @@ nsRuleNode::nsRuleNode(nsPresContext* aContext, nsRuleNode* aParent, NS_ASSERTION(IsRoot() || GetLevel() == aLevel, "not enough bits"); NS_ASSERTION(IsRoot() || IsImportantRule() == aIsImportant, "yikes"); - aContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ false); + aContext->StyleSet()->RuleNodeUnused(this, /* aMayGC = */ false); // nsStyleSet::GetContext depends on there being only one animation // rule. @@ -3903,7 +3903,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, if (variantAlternates & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) { // fetch the feature lookup object from the styleset aFont->mFont.featureValueLookup = - aPresContext->StyleSet()->AsGecko()->GetFontFeatureValuesLookup(); + aPresContext->StyleSet()->GetFontFeatureValuesLookup(); NS_ASSERTION(variantAlternatesValue->GetPairValue().mYValue.GetUnit() == eCSSUnit_List, "function list not a list value"); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index da0853c7cc..3ffb04bdc2 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -31,8 +31,6 @@ #include "RubyUtils.h" #include "mozilla/Preferences.h" #include "mozilla/ArenaObjectID.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" #include "mozilla/ReflowInput.h" #include "nsLayoutUtils.h" @@ -160,7 +158,7 @@ nsStyleContext::~nsStyleContext() #endif nsPresContext *presContext = PresContext(); - DebugOnly styleSet = presContext->PresShell()->StyleSet()->GetAsGecko(); + DebugOnly styleSet = presContext->PresShell()->StyleSet(); NS_ASSERTION(!styleSet || styleSet->GetRuleTree() == mRuleNode->RuleTree() || styleSet->IsInRuleTreeReconstruct(), diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index 18fcd3f47a..3cda29b90d 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -11,16 +11,13 @@ #include "mozilla/Assertions.h" #include "mozilla/RestyleLogging.h" #include "nsCSSAnonBoxes.h" +#include "nsCSSPseudoElements.h" #include "nsStyleSet.h" #include "nsRuleNode.h" class nsIAtom; class nsPresContext; -namespace mozilla { -enum class CSSPseudoElementType : uint8_t; -} // namespace mozilla - /** * An nsStyleContext represents the computed style data for an element. * The computed style data are stored in a set of structs (see diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index 16ade5cc70..cdba2744ce 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -580,7 +580,7 @@ inline void nsRuleNode::AddRef() { if (mRefCnt++ == 0) { - mPresContext->StyleSet()->AsGecko()->RuleNodeInUse(this); + mPresContext->StyleSet()->RuleNodeInUse(this); } } @@ -588,7 +588,7 @@ inline void nsRuleNode::Release() { if (--mRefCnt == 0) { - mPresContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ true); + mPresContext->StyleSet()->RuleNodeUnused(this, /* aMayGC = */ true); } } #endif diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 00fdd2592d..8590501c79 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -530,7 +530,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement, // not stopping or starting right now. RefPtr afterChangeStyle; if (collection) { - nsStyleSet* styleSet = mPresContext->StyleSet()->AsGecko(); + nsStyleSet* styleSet = mPresContext->StyleSet(); afterChangeStyle = styleSet->ResolveStyleWithoutAnimation(aElement, newStyleContext, eRestyle_CSSTransitions); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index cf4231c01f..24bb28b73a 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -38,8 +38,7 @@ #include "nsFrameManager.h" #include "nsError.h" #include "nsCSSFrameConstructor.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "mozilla/gfx/Helpers.h" #include "nsDisplayList.h" #include "nsIScrollableFrame.h" diff --git a/layout/xul/nsListBoxBodyFrame.cpp b/layout/xul/nsListBoxBodyFrame.cpp index 0ff07bd912..4d57d0963d 100644 --- a/layout/xul/nsListBoxBodyFrame.cpp +++ b/layout/xul/nsListBoxBodyFrame.cpp @@ -26,8 +26,7 @@ #include "nsStyleContext.h" #include "nsFontMetrics.h" #include "nsITimer.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsPIBoxObject.h" #include "nsLayoutUtils.h" #include "nsPIListBoxObject.h" diff --git a/layout/xul/nsSplitterFrame.cpp b/layout/xul/nsSplitterFrame.cpp index 468ccc6826..568bc83714 100644 --- a/layout/xul/nsSplitterFrame.cpp +++ b/layout/xul/nsSplitterFrame.cpp @@ -29,8 +29,7 @@ #include "nsIServiceManager.h" #include "nsContainerFrame.h" #include "nsContentCID.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" +#include "nsStyleSet.h" #include "nsLayoutUtils.h" #include "nsDisplayList.h" #include "nsContentUtils.h" diff --git a/layout/xul/tree/nsTreeStyleCache.cpp b/layout/xul/tree/nsTreeStyleCache.cpp index a8802fe042..96aa489fee 100644 --- a/layout/xul/tree/nsTreeStyleCache.cpp +++ b/layout/xul/tree/nsTreeStyleCache.cpp @@ -6,8 +6,6 @@ #include "nsTreeStyleCache.h" #include "nsStyleSet.h" #include "mozilla/dom/Element.h" -#include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSetHandleInlines.h" nsTreeStyleCache::Transition::Transition(DFAState aState, nsIAtom* aSymbol) : mState(aState), mInputSymbol(aSymbol) @@ -78,7 +76,7 @@ nsTreeStyleCache::GetStyleContext(nsICSSPseudoComparator* aComparator, } if (!result) { // We missed the cache. Resolve this pseudo-style. - RefPtr newResult = aPresContext->StyleSet()->AsGecko()-> + RefPtr newResult = aPresContext->StyleSet()-> ResolveXULTreePseudoStyle(aContent->AsElement(), aPseudoElement, aContext, aComparator); diff --git a/widget/gtk/nsMenu.cpp b/widget/gtk/nsMenu.cpp index 073a4acf65..e0f5a5f5ba 100644 --- a/widget/gtk/nsMenu.cpp +++ b/widget/gtk/nsMenu.cpp @@ -9,7 +9,6 @@ #include "mozilla/GuardObjects.h" #include "mozilla/MouseEvents.h" #include "mozilla/Move.h" -#include "mozilla/StyleSetHandleInlines.h" #include "nsAutoPtr.h" #include "nsBindingManager.h" #include "nsComponentManagerUtils.h" @@ -115,8 +114,7 @@ AttachXBLBindings(nsIContent* aContent) { } RefPtr sc = - shell->StyleSet()->AsGecko()->ResolveStyleFor(aContent->AsElement(), - nullptr); + shell->StyleSet()->ResolveStyleFor(aContent->AsElement(), nullptr); if (!sc) { return; }