From 2f49a48a09cd49f854dd2d03a365216f95d21655 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Mon, 26 Sep 2016 22:03:25 +1000 Subject: [PATCH] Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam This commit is generated by the following commands with some minor manual adjustment: find . \( -name '*.h' -or -name '*.cpp' \) -not -path './layout/style/StyleSheet*' -exec sed -i -b \ -e '/^\(#include\|using\)/s/StyleSheetHandle/StyleSheet/g' \ -e 's/\(mozilla::\)\?StyleSheetHandle::RefPtr/RefPtr<\1StyleSheet>/g' \ -e 's/StyleSheetHandle()/nullptr/g' \ -e 's/->AsStyleSheet()//g' \ -e 's/StyleSheetHandle/StyleSheet*/g' {} + sed -i -b 's/sheet->AsVoidPtr()/sheet.get()/' layout/style/Loader.cpp sed -i -b 's/AsHandle()/this/' layout/style/StyleSheet.cpp MozReview-Commit-ID: 7abdvlKHukd --HG-- extra : source : e5682242db07203b5a91810fe1e243c955310588 --- chrome/nsChromeRegistry.cpp | 24 ++--- dom/base/ShadowRoot.cpp | 10 +- dom/base/ShadowRoot.h | 6 +- dom/base/nsContentSink.cpp | 2 +- dom/base/nsContentSink.h | 2 +- dom/base/nsDocument.cpp | 104 ++++++++++---------- dom/base/nsDocument.h | 48 ++++----- dom/base/nsIDocument.h | 32 +++--- dom/base/nsIDocumentInlines.h | 2 +- dom/base/nsIDocumentObserver.h | 38 +++---- dom/base/nsIStyleSheetLinkingElement.h | 6 +- dom/base/nsStyleLinkElement.cpp | 8 +- dom/base/nsStyleLinkElement.h | 6 +- dom/html/nsHTMLDocument.cpp | 12 +-- dom/ipc/ContentParent.cpp | 10 +- dom/svg/SVGDocument.cpp | 8 +- dom/xbl/nsBindingManager.cpp | 2 +- dom/xbl/nsBindingManager.h | 4 +- dom/xbl/nsXBLPrototypeBinding.cpp | 14 +-- dom/xbl/nsXBLPrototypeBinding.h | 12 +-- dom/xbl/nsXBLPrototypeResources.cpp | 22 ++--- dom/xbl/nsXBLPrototypeResources.h | 14 +-- dom/xbl/nsXBLResourceLoader.cpp | 8 +- dom/xbl/nsXBLResourceLoader.h | 2 +- dom/xml/nsXMLContentSink.cpp | 2 +- dom/xml/nsXMLContentSink.h | 2 +- dom/xslt/xslt/txMozillaXMLOutput.cpp | 2 +- dom/xslt/xslt/txMozillaXMLOutput.h | 2 +- dom/xul/XULDocument.cpp | 8 +- dom/xul/XULDocument.h | 6 +- editor/libeditor/EditorBase.cpp | 4 +- editor/libeditor/EditorBase.h | 6 +- editor/libeditor/HTMLEditor.cpp | 22 ++--- editor/libeditor/HTMLEditor.h | 12 +-- editor/libeditor/StyleSheetTransactions.cpp | 12 +-- editor/libeditor/StyleSheetTransactions.h | 10 +- layout/base/nsDocumentViewer.cpp | 12 +-- layout/base/nsIPresShell.h | 10 +- layout/base/nsPresContext.cpp | 6 +- layout/base/nsPresShell.cpp | 38 +++---- layout/base/nsPresShell.h | 12 +-- layout/base/nsStyleSheetService.cpp | 16 +-- layout/base/nsStyleSheetService.h | 12 +-- layout/style/CSSStyleSheet.cpp | 2 +- layout/style/CSSStyleSheet.h | 2 +- layout/style/FontFaceSet.cpp | 2 +- layout/style/FontFaceSet.h | 2 +- layout/style/HandleRefPtr.h | 2 +- layout/style/Loader.cpp | 74 +++++++------- layout/style/Loader.h | 28 +++--- layout/style/ServoStyleSet.cpp | 2 +- layout/style/StyleSetHandle.h | 20 ++-- layout/style/StyleSetHandleInlines.h | 18 ++-- layout/style/StyleSheet.cpp | 2 +- layout/style/nsICSSLoaderObserver.h | 4 +- layout/style/nsLayoutStylesheetCache.cpp | 58 +++++------ layout/style/nsLayoutStylesheetCache.h | 88 ++++++++--------- layout/style/nsMediaFeatures.cpp | 4 +- layout/style/nsStyleSet.cpp | 10 +- 59 files changed, 454 insertions(+), 454 deletions(-) diff --git a/chrome/nsChromeRegistry.cpp b/chrome/nsChromeRegistry.cpp index af5578370d9fc..7381ca95ab523 100644 --- a/chrome/nsChromeRegistry.cpp +++ b/chrome/nsChromeRegistry.cpp @@ -29,14 +29,14 @@ #include "nsIScriptError.h" #include "nsIWindowMediator.h" #include "nsIPrefService.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" nsChromeRegistry* nsChromeRegistry::gChromeRegistry; // DO NOT use namespace mozilla; it'll break due to a naming conflict between // mozilla::TextRange and a TextRange in OSX headers. -using mozilla::StyleSheetHandle; +using mozilla::StyleSheet; using mozilla::dom::IsChromeURI; //////////////////////////////////////////////////////////////////////////////// @@ -402,17 +402,17 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) nsCOMPtr shell = document->GetShell(); if (shell) { // Reload only the chrome URL agent style sheets. - nsTArray agentSheets; + nsTArray> agentSheets; rv = shell->GetAgentStyleSheets(agentSheets); NS_ENSURE_SUCCESS(rv, rv); - nsTArray newAgentSheets; - for (StyleSheetHandle sheet : agentSheets) { + nsTArray> newAgentSheets; + for (StyleSheet* sheet : agentSheets) { nsIURI* uri = sheet->GetSheetURI(); if (IsChromeURI(uri)) { // Reload the sheet. - StyleSheetHandle::RefPtr newSheet; + RefPtr newSheet; rv = document->LoadChromeSheetSync(uri, true, &newSheet); if (NS_FAILED(rv)) return rv; if (newSheet) { @@ -433,26 +433,26 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) int32_t count = document->GetNumberOfStyleSheets(); // Build an array of style sheets we need to reload. - nsTArray oldSheets(count); - nsTArray newSheets(count); + nsTArray> oldSheets(count); + nsTArray> newSheets(count); // Iterate over the style sheets. for (int32_t i = 0; i < count; i++) { // Get the style sheet - StyleSheetHandle styleSheet = document->GetStyleSheetAt(i); + StyleSheet* styleSheet = document->GetStyleSheetAt(i); oldSheets.AppendElement(styleSheet); } // Iterate over our old sheets and kick off a sync load of the new // sheet if and only if it's a non-inline sheet with a chrome URL. - for (StyleSheetHandle sheet : oldSheets) { + for (StyleSheet* sheet : oldSheets) { MOZ_ASSERT(sheet, "GetStyleSheetAt shouldn't return nullptr for " "in-range sheet indexes"); nsIURI* uri = sheet->GetSheetURI(); if (!sheet->IsInline() && IsChromeURI(uri)) { // Reload the sheet. - StyleSheetHandle::RefPtr newSheet; + RefPtr newSheet; // XXX what about chrome sheets that have a title or are disabled? This // only works by sheer dumb luck. document->LoadChromeSheetSync(uri, false, &newSheet); diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index 120aeb34d2fb5..63c7ecf4815d6 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -17,8 +17,8 @@ #include "mozilla/dom/HTMLContentElement.h" #include "mozilla/dom/HTMLShadowElement.h" #include "nsXBLPrototypeBinding.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla; using namespace mozilla::dom; @@ -132,7 +132,7 @@ ShadowRoot::StyleSheetChanged() } void -ShadowRoot::InsertSheet(StyleSheetHandle aSheet, +ShadowRoot::InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent) { nsCOMPtr @@ -163,7 +163,7 @@ ShadowRoot::InsertSheet(StyleSheetHandle aSheet, } void -ShadowRoot::RemoveSheet(StyleSheetHandle aSheet) +ShadowRoot::RemoveSheet(StyleSheet* aSheet) { mProtoBinding->RemoveStyleSheet(aSheet); @@ -756,7 +756,7 @@ ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound) // XXXheycam Return null until ServoStyleSheet implements the right // DOM interfaces. - StyleSheetHandle sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex); + StyleSheet* sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex); if (sheet->IsServo()) { NS_ERROR("stylo: can't return ServoStyleSheets to script yet"); return nullptr; diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index 7a08201dd4b4e..7fea65eef2bf8 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -9,7 +9,7 @@ #include "mozilla/dom/DocumentFragment.h" #include "mozilla/dom/StyleSheetList.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsIContentInlines.h" @@ -47,8 +47,8 @@ class ShadowRoot final : public DocumentFragment, void AddToIdTable(Element* aElement, nsIAtom* aId); void RemoveFromIdTable(Element* aElement, nsIAtom* aId); - void InsertSheet(StyleSheetHandle aSheet, nsIContent* aLinkingContent); - void RemoveSheet(StyleSheetHandle aSheet); + void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent); + void RemoveSheet(StyleSheet* aSheet); bool ApplyAuthorStyles(); void SetApplyAuthorStyles(bool aApplyAuthorStyles); StyleSheetList* StyleSheets(); diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index d674da0a82656..9f3e1abcf9066 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -207,7 +207,7 @@ nsContentSink::Init(nsIDocument* aDoc, } NS_IMETHODIMP -nsContentSink::StyleSheetLoaded(StyleSheetHandle aSheet, +nsContentSink::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/dom/base/nsContentSink.h b/dom/base/nsContentSink.h index a5b1e2ab7c864..bd850b9df027b 100644 --- a/dom/base/nsContentSink.h +++ b/dom/base/nsContentSink.h @@ -85,7 +85,7 @@ class nsContentSink : public nsICSSLoaderObserver, NS_DECL_NSITIMERCALLBACK // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 1ed8abd08276e..4aeeced637c47 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -250,8 +250,8 @@ #include "nsISupportsPrimitives.h" #include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSetHandleInlines.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/DocLoadingTimelineMarker.h" @@ -600,7 +600,7 @@ nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound) } aFound = true; - StyleSheetHandle sheet = mDocument->GetStyleSheetAt(aIndex); + StyleSheet* sheet = mDocument->GetStyleSheetAt(aIndex); NS_ASSERTION(sheet, "Must have a sheet"); // XXXheycam Return null until ServoStyleSheet implements the right DOM @@ -619,7 +619,7 @@ nsDOMStyleSheetList::NodeWillBeDestroyed(const nsINode *aNode) } void -nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet, +nsDOMStyleSheetList::StyleSheetAdded(StyleSheet* aStyleSheet, bool aDocumentSheet) { if (aDocumentSheet && -1 != mLength) { @@ -628,7 +628,7 @@ nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet, } void -nsDOMStyleSheetList::StyleSheetRemoved(StyleSheetHandle aStyleSheet, +nsDOMStyleSheetList::StyleSheetRemoved(StyleSheet* aStyleSheet, bool aDocumentSheet) { if (aDocumentSheet && -1 != mLength) { @@ -1196,7 +1196,7 @@ nsDOMStyleSheetSetList::EnsureFresh() int32_t count = mDocument->GetNumberOfStyleSheets(); nsAutoString title; for (int32_t index = 0; index < count; index++) { - StyleSheetHandle sheet = mDocument->GetStyleSheetAt(index); + StyleSheet* sheet = mDocument->GetStyleSheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); // XXXheycam ServoStyleSheets don't expose their title yet. if (sheet->IsServo()) { @@ -1497,7 +1497,7 @@ nsDocument::~nsDocument() mCachedRootElement = nullptr; // Let the stylesheets know we're going away - for (StyleSheetHandle sheet : mStyleSheets) { + for (StyleSheet* sheet : mStyleSheets) { sheet->SetOwningDocument(nullptr); } if (mAttrStyleSheet) { @@ -2153,7 +2153,7 @@ void nsDocument::RemoveDocStyleSheetsFromStyleSets() { // The stylesheets should forget us - for (StyleSheetHandle sheet : Reversed(mStyleSheets)) { + for (StyleSheet* sheet : Reversed(mStyleSheets)) { sheet->SetOwningDocument(nullptr); if (sheet->IsApplicable()) { @@ -2168,11 +2168,11 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets() void nsDocument::RemoveStyleSheetsFromStyleSets( - const nsTArray& aSheets, + const nsTArray>& aSheets, SheetType aType) { // The stylesheets should forget us - for (StyleSheetHandle sheet : Reversed(aSheets)) { + for (StyleSheet* sheet : Reversed(aSheets)) { sheet->SetOwningDocument(nullptr); if (sheet->IsApplicable()) { @@ -2250,10 +2250,10 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI) static void AppendSheetsToStyleSet(StyleSetHandle aStyleSet, - const nsTArray& aSheets, + const nsTArray>& aSheets, SheetType aType) { - for (StyleSheetHandle sheet : Reversed(aSheets)) { + for (StyleSheet* sheet : Reversed(aSheets)) { aStyleSet->AppendStyleSheet(aType, sheet); } } @@ -2268,7 +2268,7 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet) MOZ_ASSERT(!mStyleSetFilled); - for (StyleSheetHandle sheet : Reversed(mStyleSheets)) { + for (StyleSheet* sheet : Reversed(mStyleSheets)) { if (sheet->IsApplicable()) { aStyleSet->AddDocStyleSheet(sheet, this); } @@ -2277,13 +2277,13 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet) if (aStyleSet->IsGecko()) { nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { - for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) { + for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { aStyleSet->AppendStyleSheet(SheetType::Doc, sheet); } } // Iterate backwards to maintain order - for (StyleSheetHandle sheet : Reversed(mOnDemandBuiltInUASheets)) { + for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) { if (sheet->IsApplicable()) { aStyleSet->PrependStyleSheet(SheetType::Agent, sheet); } @@ -3939,7 +3939,7 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify) } void -nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet) +nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheet* aSheet) { if (mOnDemandBuiltInUASheets.Contains(aSheet)) { return; @@ -3950,7 +3950,7 @@ nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet) } void -nsDocument::AddOnDemandBuiltInUASheet(StyleSheetHandle aSheet) +nsDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet) { MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(aSheet)); @@ -3979,20 +3979,20 @@ nsDocument::GetNumberOfStyleSheets() const return mStyleSheets.Length(); } -StyleSheetHandle +StyleSheet* nsDocument::GetStyleSheetAt(int32_t aIndex) const { - return mStyleSheets.SafeElementAt(aIndex, StyleSheetHandle()); + return mStyleSheets.SafeElementAt(aIndex, nullptr); } int32_t -nsDocument::GetIndexOfStyleSheet(const StyleSheetHandle aSheet) const +nsDocument::GetIndexOfStyleSheet(const StyleSheet* aSheet) const { return mStyleSheets.IndexOf(aSheet); } void -nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet) +nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { @@ -4023,7 +4023,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet) } while (0); void -nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet) +nsDocument::NotifyStyleSheetAdded(StyleSheet* aSheet, bool aDocumentSheet) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (aSheet, aDocumentSheet)); @@ -4036,7 +4036,7 @@ nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet) } void -nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet) +nsDocument::NotifyStyleSheetRemoved(StyleSheet* aSheet, bool aDocumentSheet) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (aSheet, aDocumentSheet)); @@ -4049,7 +4049,7 @@ nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet } void -nsDocument::AddStyleSheet(StyleSheetHandle aSheet) +nsDocument::AddStyleSheet(StyleSheet* aSheet) { NS_PRECONDITION(aSheet, "null arg"); mStyleSheets.AppendElement(aSheet); @@ -4063,7 +4063,7 @@ nsDocument::AddStyleSheet(StyleSheetHandle aSheet) } void -nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet) +nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { @@ -4072,10 +4072,10 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet) } void -nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet) +nsDocument::RemoveStyleSheet(StyleSheet* aSheet) { NS_PRECONDITION(aSheet, "null arg"); - StyleSheetHandle::RefPtr sheet = aSheet; // hold ref so it won't die too soon + RefPtr sheet = aSheet; // hold ref so it won't die too soon if (!mStyleSheets.RemoveElement(aSheet)) { NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found"); @@ -4094,8 +4094,8 @@ nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet) } void -nsDocument::UpdateStyleSheets(nsTArray& aOldSheets, - nsTArray& aNewSheets) +nsDocument::UpdateStyleSheets(nsTArray>& aOldSheets, + nsTArray>& aNewSheets) { BeginUpdate(UPDATE_STYLE); @@ -4104,7 +4104,7 @@ nsDocument::UpdateStyleSheets(nsTArray& aOldSheets, "The lists must be the same length!"); int32_t count = aOldSheets.Length(); - StyleSheetHandle::RefPtr oldSheet; + RefPtr oldSheet; int32_t i; for (i = 0; i < count; ++i) { oldSheet = aOldSheets[i]; @@ -4115,7 +4115,7 @@ nsDocument::UpdateStyleSheets(nsTArray& aOldSheets, RemoveStyleSheet(oldSheet); // This does the right notifications // Now put the new one in its place. If it's null, just ignore it. - StyleSheetHandle newSheet = aNewSheets[i]; + StyleSheet* newSheet = aNewSheets[i]; if (newSheet) { mStyleSheets.InsertElementAt(oldIndex, newSheet); newSheet->SetOwningDocument(this); @@ -4131,7 +4131,7 @@ nsDocument::UpdateStyleSheets(nsTArray& aOldSheets, } void -nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex) +nsDocument::InsertStyleSheetAt(StyleSheet* aSheet, int32_t aIndex) { NS_PRECONDITION(aSheet, "null ptr"); @@ -4148,7 +4148,7 @@ nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex) void -nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet, +nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet, bool aApplicable) { NS_PRECONDITION(aSheet, "null arg"); @@ -4214,7 +4214,7 @@ ConvertAdditionalSheetType(nsIDocument::additionalSheetType aType) } static int32_t -FindSheet(const nsTArray& aSheets, nsIURI* aSheetURI) +FindSheet(const nsTArray>& aSheets, nsIURI* aSheetURI) { for (int32_t i = aSheets.Length() - 1; i >= 0; i-- ) { bool bEqual; @@ -4258,7 +4258,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, MOZ_CRASH("impossible value for aType"); } - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet); NS_ENSURE_SUCCESS(rv, rv); @@ -4269,7 +4269,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, } nsresult -nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheetHandle aSheet) +nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aSheet) { if (mAdditionalSheets[aType].Contains(aSheet)) return NS_ERROR_INVALID_ARG; @@ -4298,11 +4298,11 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet { MOZ_ASSERT(aSheetURI); - nsTArray& sheets = mAdditionalSheets[aType]; + nsTArray>& sheets = mAdditionalSheets[aType]; int32_t i = FindSheet(mAdditionalSheets[aType], aSheetURI); if (i >= 0) { - StyleSheetHandle::RefPtr sheetRef = sheets[i]; + RefPtr sheetRef = sheets[i]; sheets.RemoveElementAt(i); BeginUpdate(UPDATE_STYLE); @@ -4324,10 +4324,10 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet } } -StyleSheetHandle +StyleSheet* nsDocument::GetFirstAdditionalAuthorSheet() { - return mAdditionalSheets[eAuthorSheet].SafeElementAt(0, StyleSheetHandle()); + return mAdditionalSheets[eAuthorSheet].SafeElementAt(0); } nsIGlobalObject* @@ -5132,7 +5132,7 @@ nsDocument::DocumentStatesChanged(EventStates aStateMask) } void -nsDocument::StyleRuleChanged(StyleSheetHandle aSheet, +nsDocument::StyleRuleChanged(StyleSheet* aSheet, css::Rule* aStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, (aSheet)); @@ -5146,7 +5146,7 @@ nsDocument::StyleRuleChanged(StyleSheetHandle aSheet, } void -nsDocument::StyleRuleAdded(StyleSheetHandle aSheet, +nsDocument::StyleRuleAdded(StyleSheet* aSheet, css::Rule* aStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, (aSheet)); @@ -5161,7 +5161,7 @@ nsDocument::StyleRuleAdded(StyleSheetHandle aSheet, } void -nsDocument::StyleRuleRemoved(StyleSheetHandle aSheet, +nsDocument::StyleRuleRemoved(StyleSheet* aSheet, css::Rule* aStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, (aSheet)); @@ -6029,7 +6029,7 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet) int32_t count = GetNumberOfStyleSheets(); nsAutoString title; for (int32_t index = 0; index < count; index++) { - StyleSheetHandle sheet = GetStyleSheetAt(index); + StyleSheet* sheet = GetStyleSheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); // XXXheycam Make this work with ServoStyleSheets. @@ -6149,7 +6149,7 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet, int32_t count = GetNumberOfStyleSheets(); nsAutoString title; for (int32_t index = 0; index < count; index++) { - StyleSheetHandle sheet = GetStyleSheetAt(index); + StyleSheet* sheet = GetStyleSheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); // XXXheycam Make this work with ServoStyleSheets. @@ -9432,7 +9432,7 @@ class StubCSSLoaderObserver final : public nsICSSLoaderObserver { ~StubCSSLoaderObserver() {} public: NS_IMETHOD - StyleSheetLoaded(StyleSheetHandle, bool, nsresult) override + StyleSheetLoaded(StyleSheet*, bool, nsresult) override { return NS_OK; } @@ -9461,7 +9461,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset, nsresult nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet, - mozilla::StyleSheetHandle::RefPtr* aSheet) + RefPtr* aSheet) { css::SheetParsingMode mode = isAgentSheet ? css::eAgentSheetFeatures @@ -9797,7 +9797,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) int32_t sheetsCount = GetNumberOfStyleSheets(); for (int32_t i = 0; i < sheetsCount; ++i) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i); + RefPtr sheet = GetStyleSheetAt(i); if (sheet) { if (sheet->IsApplicable()) { // XXXheycam Need to make ServoStyleSheet cloning work. @@ -9817,7 +9817,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) } // Iterate backwards to maintain order - for (StyleSheetHandle sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) { + for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) { if (sheet) { if (sheet->IsApplicable()) { // XXXheycam Need to make ServoStyleSheet cloning work. @@ -12009,7 +12009,7 @@ nsDocument::OnAppThemeChanged() } for (int32_t i = 0; i < GetNumberOfStyleSheets(); i++) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i); + RefPtr sheet = GetStyleSheetAt(i); if (!sheet) { continue; } @@ -12164,12 +12164,12 @@ nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const } static size_t -SizeOfOwnedSheetArrayExcludingThis(const nsTArray& aSheets, +SizeOfOwnedSheetArrayExcludingThis(const nsTArray>& aSheets, MallocSizeOf aMallocSizeOf) { size_t n = 0; n += aSheets.ShallowSizeOfExcludingThis(aMallocSizeOf); - for (StyleSheetHandle sheet : aSheets) { + for (StyleSheet* sheet : aSheets) { if (!sheet->GetOwningDocument()) { // Avoid over-reporting shared sheets. continue; diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index e21fcda98b058..4f91947482984 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -621,37 +621,37 @@ class nsDocument : public nsIDocument, virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const override; virtual Element* GetRootElementInternal() const override; - virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) override; + virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) override; /** * Get the (document) style sheets owned by this document. * These are ordered, highest priority last */ virtual int32_t GetNumberOfStyleSheets() const override; - virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override; + virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const override; virtual int32_t GetIndexOfStyleSheet( - const mozilla::StyleSheetHandle aSheet) const override; - virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override; - virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override; + const mozilla::StyleSheet* aSheet) const override; + virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) override; + virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) override; virtual void UpdateStyleSheets( - nsTArray& aOldSheets, - nsTArray& aNewSheets) override; - virtual void AddStyleSheetToStyleSets(mozilla::StyleSheetHandle aSheet); - virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheetHandle aSheet); + nsTArray>& aOldSheets, + nsTArray>& aNewSheets) override; + virtual void AddStyleSheetToStyleSets(mozilla::StyleSheet* aSheet); + virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheet* aSheet); - virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet, + virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet, int32_t aIndex) override; - virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet, + virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet, bool aApplicable) override; virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) override; virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, - mozilla::StyleSheetHandle aSheet) override; + mozilla::StyleSheet* aSheet) override; virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) override; - virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() override; + virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() override; virtual nsIChannel* GetChannel() const override { return mChannel; @@ -711,11 +711,11 @@ class nsDocument : public nsIDocument, virtual void DocumentStatesChanged( mozilla::EventStates aStateMask) override; - virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) override; - virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) override; - virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) override; virtual void FlushPendingNotifications(mozFlushType aType) override; @@ -787,7 +787,7 @@ class nsDocument : public nsIDocument, void ReportUseCounters(); private: - void AddOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet); + void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet); nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const; void SendToConsole(nsCOMArray& aMessages); @@ -970,7 +970,7 @@ class nsDocument : public nsIDocument, const nsAString& aIntegrity) override; virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet, - mozilla::StyleSheetHandle::RefPtr* aSheet) override; + RefPtr* aSheet) override; virtual nsISupports* GetCurrentContentSink() override; @@ -1288,7 +1288,7 @@ class nsDocument : public nsIDocument, void RemoveDocStyleSheetsFromStyleSets(); void RemoveStyleSheetsFromStyleSets( - const nsTArray& aSheets, + const nsTArray>& aSheets, mozilla::SheetType aType); void ResetStylesheetsToURI(nsIURI* aURI); void FillStyleSet(mozilla::StyleSetHandle aStyleSet); @@ -1342,9 +1342,9 @@ class nsDocument : public nsIDocument, // EndLoad() has already happened. nsWeakPtr mWeakSink; - nsTArray mStyleSheets; - nsTArray mOnDemandBuiltInUASheets; - nsTArray mAdditionalSheets[AdditionalSheetTypeCount]; + nsTArray> mStyleSheets; + nsTArray> mOnDemandBuiltInUASheets; + nsTArray> mAdditionalSheets[AdditionalSheetTypeCount]; // Array of observers nsTObserverArray mObservers; @@ -1498,8 +1498,8 @@ class nsDocument : public nsIDocument, friend class nsUnblockOnloadEvent; // Recomputes the visibility state but doesn't set the new value. mozilla::dom::VisibilityState GetVisibilityState() const; - void NotifyStyleSheetAdded(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet); - void NotifyStyleSheetRemoved(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet); + void NotifyStyleSheetAdded(mozilla::StyleSheet* aSheet, bool aDocumentSheet); + void NotifyStyleSheetRemoved(mozilla::StyleSheet* aSheet, bool aDocumentSheet); void PostUnblockOnloadEvent(); void DoUnblockOnload(); diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index c62fb4ee802ad..0a5f750862f76 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -34,7 +34,7 @@ #include "mozilla/UniquePtr.h" #include "mozilla/CORSMode.h" #include "mozilla/StyleBackendType.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include // for member #ifdef MOZILLA_INTERNAL_API @@ -997,7 +997,7 @@ class nsIDocument : public nsINode * TODO We can get rid of the whole concept of delayed loading if we fix * bug 77999. */ - virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) = 0; + virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) = 0; /** * Get the number of (document) stylesheets @@ -1013,7 +1013,7 @@ class nsIDocument : public nsINode * @return the stylesheet at aIndex. Null if aIndex is out of range. * @throws no exceptions */ - virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const = 0; + virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const = 0; /** * Insert a sheet at a particular spot in the stylesheet list (zero-based) @@ -1022,7 +1022,7 @@ class nsIDocument : public nsINode * adjusted for the "special" sheets. * @throws no exceptions */ - virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet, + virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet, int32_t aIndex) = 0; /** @@ -1032,7 +1032,7 @@ class nsIDocument : public nsINode * @return aIndex the index of the sheet in the full list */ virtual int32_t GetIndexOfStyleSheet( - const mozilla::StyleSheetHandle aSheet) const = 0; + const mozilla::StyleSheet* aSheet) const = 0; /** * Replace the stylesheets in aOldSheets with the stylesheets in @@ -1043,24 +1043,24 @@ class nsIDocument : public nsINode * will simply be removed. */ virtual void UpdateStyleSheets( - nsTArray& aOldSheets, - nsTArray& aNewSheets) = 0; + nsTArray>& aOldSheets, + nsTArray>& aNewSheets) = 0; /** * Add a stylesheet to the document */ - virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) = 0; + virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) = 0; /** * Remove a stylesheet from the document */ - virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) = 0; + virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) = 0; /** * Notify the document that the applicable state of the sheet changed * and that observers should be notified and style sets updated */ - virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet, + virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet, bool aApplicable) = 0; enum additionalSheetType { @@ -1073,10 +1073,10 @@ class nsIDocument : public nsINode virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) = 0; virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, - mozilla::StyleSheetHandle aSheet) = 0; + mozilla::StyleSheet* aSheet) = 0; virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) = 0; - virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() = 0; + virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() = 0; /** * Assuming that aDocSheets is an array of document-level style @@ -1397,11 +1397,11 @@ class nsIDocument : public nsINode // Observation hooks for style data to propagate notifications // to document observers - virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) = 0; - virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) = 0; - virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet, mozilla::css::Rule* aStyleRule) = 0; /** @@ -2209,7 +2209,7 @@ class nsIDocument : public nsINode * DO NOT USE FOR UNTRUSTED CONTENT. */ virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet, - mozilla::StyleSheetHandle::RefPtr* aSheet) = 0; + RefPtr* aSheet) = 0; /** * Returns true if the locale used for the document specifies a direction of diff --git a/dom/base/nsIDocumentInlines.h b/dom/base/nsIDocumentInlines.h index f760865138930..4ba21dfe6485e 100644 --- a/dom/base/nsIDocumentInlines.h +++ b/dom/base/nsIDocumentInlines.h @@ -35,7 +35,7 @@ nsIDocument::FindDocStyleSheetInsertionPoint( if (sheetDocIndex > newDocIndex) break; - mozilla::StyleSheetHandle sheetHandle = sheet; + mozilla::StyleSheet* sheetHandle = sheet; // If the sheet is not owned by the document it can be an author // sheet registered at nsStyleSheetService or an additional author diff --git a/dom/base/nsIDocumentObserver.h b/dom/base/nsIDocumentObserver.h index 0aed2a7cca037..ba73dd8cdead2 100644 --- a/dom/base/nsIDocumentObserver.h +++ b/dom/base/nsIDocumentObserver.h @@ -7,7 +7,7 @@ #define nsIDocumentObserver_h___ #include "mozilla/EventStates.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "nsISupports.h" #include "nsIMutationObserver.h" @@ -100,7 +100,7 @@ class nsIDocumentObserver : public nsIMutationObserver * @param aDocumentSheet True if sheet is in document's style sheet list, * false if sheet is not (i.e., UA or user sheet) */ - virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, bool aDocumentSheet) = 0; /** @@ -113,7 +113,7 @@ class nsIDocumentObserver : public nsIMutationObserver * @param aDocumentSheet True if sheet is in document's style sheet list, * false if sheet is not (i.e., UA or user sheet) */ - virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, + virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, bool aDocumentSheet) = 0; /** @@ -125,7 +125,7 @@ class nsIDocumentObserver : public nsIMutationObserver * * @param aStyleSheet the StyleSheet that has changed state */ - virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) = 0; + virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet) = 0; /** * A StyleRule has just been modified within a style sheet. @@ -136,7 +136,7 @@ class nsIDocumentObserver : public nsIMutationObserver * * @param aStyleSheet the StyleSheet that contians the rule */ - virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) = 0; + virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) = 0; /** * A StyleRule has just been added to a style sheet. @@ -147,7 +147,7 @@ class nsIDocumentObserver : public nsIMutationObserver * * @param aStyleSheet the StyleSheet that has been modified */ - virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) = 0; + virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) = 0; /** * A StyleRule has just been removed from a style sheet. @@ -158,7 +158,7 @@ class nsIDocumentObserver : public nsIMutationObserver * * @param aStyleSheet the StyleSheet that has been modified */ - virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) = 0; + virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) @@ -186,25 +186,25 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) mozilla::EventStates aStateMask) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED \ - virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \ + virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \ bool aDocumentSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED \ - virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \ + virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \ bool aDocumentSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED \ virtual void StyleSheetApplicableStateChanged( \ - mozilla::StyleSheetHandle aStyleSheet) override; + mozilla::StyleSheet* aStyleSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED \ - virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) override; + virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED \ - virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) override; + virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED \ - virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) override; + virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) override; #define NS_DECL_NSIDOCUMENTOBSERVER \ NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \ @@ -262,29 +262,29 @@ NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) #define NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(_class) \ void \ -_class::StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \ +_class::StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \ bool aDocumentSheet) \ { \ } \ void \ -_class::StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \ +_class::StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \ bool aDocumentSheet) \ { \ } \ void \ -_class::StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) \ +_class::StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet)\ { \ } \ void \ -_class::StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) \ +_class::StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) \ { \ } \ void \ -_class::StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) \ +_class::StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) \ { \ } \ void \ -_class::StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) \ +_class::StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) \ { \ } diff --git a/dom/base/nsIStyleSheetLinkingElement.h b/dom/base/nsIStyleSheetLinkingElement.h index d6c2440169ba7..3326838160985 100644 --- a/dom/base/nsIStyleSheetLinkingElement.h +++ b/dom/base/nsIStyleSheetLinkingElement.h @@ -8,7 +8,7 @@ #include "nsISupports.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" class nsICSSLoaderObserver; class nsIURI; @@ -28,14 +28,14 @@ class nsIStyleSheetLinkingElement : public nsISupports { * @param aStyleSheet the style sheet associated with this * element. */ - NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) = 0; + NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) = 0; /** * Used to obtain the style sheet linked in by this element. * * @return the style sheet associated with this element. */ - NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() = 0; + NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() = 0; /** * Initialize the stylesheet linking element. If aDontLoadStyle is diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index a54028e8be637..8ab2dab0bb4d9 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -12,8 +12,8 @@ #include "nsStyleLinkElement.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/css/Loader.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/FragmentOrElement.h" @@ -63,7 +63,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb) } NS_IMETHODIMP -nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet) +nsStyleLinkElement::SetStyleSheet(StyleSheet* aStyleSheet) { if (mStyleSheet) { mStyleSheet->SetOwningNode(nullptr); @@ -80,7 +80,7 @@ nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet) return NS_OK; } -NS_IMETHODIMP_(StyleSheetHandle) +NS_IMETHODIMP_(StyleSheet*) nsStyleLinkElement::GetStyleSheet() { return mStyleSheet; diff --git a/dom/base/nsStyleLinkElement.h b/dom/base/nsStyleLinkElement.h index 5baa5762a4b39..ecd84ffa9741e 100644 --- a/dom/base/nsStyleLinkElement.h +++ b/dom/base/nsStyleLinkElement.h @@ -50,8 +50,8 @@ class nsStyleLinkElement : public nsIStyleSheetLinkingElement } // nsIStyleSheetLinkingElement - NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) override; - NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() override; + NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) override; + NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() override; NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) override; NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver, bool* aWillNotify, @@ -143,7 +143,7 @@ class nsStyleLinkElement : public nsIStyleSheetLinkingElement bool* aIsAlternate, bool aForceUpdate); - mozilla::StyleSheetHandle::RefPtr mStyleSheet; + RefPtr mStyleSheet; protected: bool mDontLoadStyle; bool mUpdatesEnabled; diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index 6133e432b1af7..ac10a2d723e4f 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -114,8 +114,8 @@ #include "nsIFrame.h" #include "nsIContent.h" #include "nsLayoutStylesheetCache.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla; using namespace mozilla::dom; @@ -2550,7 +2550,7 @@ nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor) if (!presShell) return; - nsTArray agentSheets; + nsTArray> agentSheets; presShell->GetAgentStyleSheets(agentSheets); auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType()); @@ -2693,13 +2693,13 @@ nsHTMLDocument::EditingStateChanged() // Before making this window editable, we need to modify UA style sheet // because new style may change whether focused element will be focusable // or not. - nsTArray agentSheets; + nsTArray> agentSheets; rv = presShell->GetAgentStyleSheets(agentSheets); NS_ENSURE_SUCCESS(rv, rv); auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType()); - StyleSheetHandle contentEditableSheet = cache->ContentEditableSheet(); + StyleSheet* contentEditableSheet = cache->ContentEditableSheet(); if (!agentSheets.Contains(contentEditableSheet)) { agentSheets.AppendElement(contentEditableSheet); @@ -2710,7 +2710,7 @@ nsHTMLDocument::EditingStateChanged() // specific states on the elements. if (designMode) { // designMode is being turned on (overrides contentEditable). - StyleSheetHandle designModeSheet = cache->DesignModeSheet(); + StyleSheet* designModeSheet = cache->DesignModeSheet(); if (!agentSheets.Contains(designModeSheet)) { agentSheets.AppendElement(designModeSheet); } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index ea941c8f34fb5..957f878cc86db 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -187,8 +187,8 @@ #include "nsPluginHost.h" #include "nsPluginTags.h" #include "nsIBlocklistService.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "nsHostObjectProtocolHandler.h" #include "nsIBidiKeyboard.h" @@ -2267,19 +2267,19 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, // This looks like a lot of work, but in a normal browser session we just // send two loads. - for (StyleSheetHandle sheet : *sheetService->AgentStyleSheets()) { + for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) { URIParams uri; SerializeURI(sheet->GetSheetURI(), uri); Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET); } - for (StyleSheetHandle sheet : *sheetService->UserStyleSheets()) { + for (StyleSheet* sheet : *sheetService->UserStyleSheets()) { URIParams uri; SerializeURI(sheet->GetSheetURI(), uri); Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET); } - for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) { + for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { URIParams uri; SerializeURI(sheet->GetSheetURI(), uri); Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET); diff --git a/dom/svg/SVGDocument.cpp b/dom/svg/SVGDocument.cpp index 03e6cd35c42a8..9b9f2b96a81a5 100644 --- a/dom/svg/SVGDocument.cpp +++ b/dom/svg/SVGDocument.cpp @@ -20,8 +20,8 @@ #include "mozilla/dom/Element.h" #include "nsSVGElement.h" #include "mozilla/dom/SVGDocumentBinding.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla::css; using namespace mozilla::dom; @@ -157,7 +157,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded() nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), spec); if (uri) { - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; cssLoader->LoadSheetSync(uri, mozilla::css::eAgentSheetFeatures, true, &sheet); @@ -173,7 +173,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded() auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType()); - StyleSheetHandle sheet = cache->NumberControlSheet(); + StyleSheet* sheet = cache->NumberControlSheet(); if (sheet) { // number-control.css can be behind a pref EnsureOnDemandBuiltInUASheet(sheet); diff --git a/dom/xbl/nsBindingManager.cpp b/dom/xbl/nsBindingManager.cpp index 4012bd1dc611b..40e357163a01b 100644 --- a/dom/xbl/nsBindingManager.cpp +++ b/dom/xbl/nsBindingManager.cpp @@ -770,7 +770,7 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext, } void -nsBindingManager::AppendAllSheets(nsTArray& aArray) +nsBindingManager::AppendAllSheets(nsTArray& aArray) { if (!mBoundContentSet) { return; diff --git a/dom/xbl/nsBindingManager.h b/dom/xbl/nsBindingManager.h index 4b843b135a445..a70d888b9ce11 100644 --- a/dom/xbl/nsBindingManager.h +++ b/dom/xbl/nsBindingManager.h @@ -18,7 +18,7 @@ #include "nsXBLBinding.h" #include "nsTArray.h" #include "nsThreadUtils.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" struct ElementDependentRuleProcessorData; class nsIXPConnectWrappedJS; @@ -138,7 +138,7 @@ class nsBindingManager final : public nsStubMutationObserver nsresult MediumFeaturesChanged(nsPresContext* aPresContext, bool* aRulesChanged); - void AppendAllSheets(nsTArray& aArray); + void AppendAllSheets(nsTArray& aArray); void Traverse(nsIContent *aContent, nsCycleCollectionTraversalCallback &cb); diff --git a/dom/xbl/nsXBLPrototypeBinding.cpp b/dom/xbl/nsXBLPrototypeBinding.cpp index bc1b8fc7784fe..c470d887b1685 100644 --- a/dom/xbl/nsXBLPrototypeBinding.cpp +++ b/dom/xbl/nsXBLPrototypeBinding.cpp @@ -44,8 +44,8 @@ #include "mozilla/dom/CDATASection.h" #include "mozilla/dom/Comment.h" #include "mozilla/dom/Element.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #ifdef MOZ_XUL #include "nsXULElement.h" @@ -1644,14 +1644,14 @@ nsXBLPrototypeBinding::EnsureResources() } void -nsXBLPrototypeBinding::AppendStyleSheet(StyleSheetHandle aSheet) +nsXBLPrototypeBinding::AppendStyleSheet(StyleSheet* aSheet) { EnsureResources(); mResources->AppendStyleSheet(aSheet); } void -nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet) +nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheet* aSheet) { if (!mResources) { MOZ_ASSERT(false, "Trying to remove a sheet that does not exist."); @@ -1661,13 +1661,13 @@ nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet) mResources->RemoveStyleSheet(aSheet); } void -nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet) +nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet) { EnsureResources(); mResources->InsertStyleSheetAt(aIndex, aSheet); } -StyleSheetHandle +StyleSheet* nsXBLPrototypeBinding::StyleSheetAt(size_t aIndex) const { MOZ_ASSERT(mResources); @@ -1688,7 +1688,7 @@ nsXBLPrototypeBinding::HasStyleSheets() const void nsXBLPrototypeBinding::AppendStyleSheetsTo( - nsTArray& aResult) const + nsTArray& aResult) const { if (mResources) { mResources->AppendStyleSheetsTo(aResult); diff --git a/dom/xbl/nsXBLPrototypeBinding.h b/dom/xbl/nsXBLPrototypeBinding.h index 5124ef74fd5fc..4c51a2083f466 100644 --- a/dom/xbl/nsXBLPrototypeBinding.h +++ b/dom/xbl/nsXBLPrototypeBinding.h @@ -20,7 +20,7 @@ #include "nsXBLPrototypeHandler.h" #include "nsXBLPrototypeResources.h" #include "mozilla/WeakPtr.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" class nsIAtom; class nsIContent; @@ -120,13 +120,13 @@ class nsXBLPrototypeBinding final : void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent); - void AppendStyleSheet(mozilla::StyleSheetHandle aSheet); - void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet); - void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet); - mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const; + void AppendStyleSheet(mozilla::StyleSheet* aSheet); + void RemoveStyleSheet(mozilla::StyleSheet* aSheet); + void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet); + mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const; size_t SheetCount() const; bool HasStyleSheets() const; - void AppendStyleSheetsTo(nsTArray& aResult) const; + void AppendStyleSheetsTo(nsTArray& aResult) const; nsIStyleRuleProcessor* GetRuleProcessor(); diff --git a/dom/xbl/nsXBLPrototypeResources.cpp b/dom/xbl/nsXBLPrototypeResources.cpp index e97504be847b5..a1ec426635aed 100644 --- a/dom/xbl/nsXBLPrototypeResources.cpp +++ b/dom/xbl/nsXBLPrototypeResources.cpp @@ -19,8 +19,8 @@ #include "nsStyleSet.h" #include "mozilla/dom/URL.h" #include "mozilla/DebugOnly.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla; using mozilla::dom::IsChromeURI; @@ -84,18 +84,18 @@ nsXBLPrototypeResources::FlushSkinSheets() // skin sheets can't be, and which in any case don't have a usable // URL to reload.) - nsTArray oldSheets; + nsTArray> oldSheets; oldSheets.SwapElements(mStyleSheetList); mozilla::css::Loader* cssLoader = doc->CSSLoader(); for (size_t i = 0, count = oldSheets.Length(); i < count; ++i) { - StyleSheetHandle oldSheet = oldSheets[i]; + StyleSheet* oldSheet = oldSheets[i]; nsIURI* uri = oldSheet->GetSheetURI(); - StyleSheetHandle::RefPtr newSheet; + RefPtr newSheet; if (!oldSheet->IsInline() && IsChromeURI(uri)) { if (NS_FAILED(cssLoader->LoadSheetSync(uri, &newSheet))) continue; @@ -147,7 +147,7 @@ void nsXBLPrototypeResources::GatherRuleProcessor() { nsTArray> sheets(mStyleSheetList.Length()); - for (StyleSheetHandle sheet : mStyleSheetList) { + for (StyleSheet* sheet : mStyleSheetList) { MOZ_ASSERT(sheet->IsGecko(), "GatherRuleProcessor must only be called for " "nsXBLPrototypeResources objects with Gecko-flavored style " @@ -161,24 +161,24 @@ nsXBLPrototypeResources::GatherRuleProcessor() } void -nsXBLPrototypeResources::AppendStyleSheet(StyleSheetHandle aSheet) +nsXBLPrototypeResources::AppendStyleSheet(StyleSheet* aSheet) { mStyleSheetList.AppendElement(aSheet); } void -nsXBLPrototypeResources::RemoveStyleSheet(StyleSheetHandle aSheet) +nsXBLPrototypeResources::RemoveStyleSheet(StyleSheet* aSheet) { mStyleSheetList.RemoveElement(aSheet); } void -nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet) +nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet) { mStyleSheetList.InsertElementAt(aIndex, aSheet); } -StyleSheetHandle +StyleSheet* nsXBLPrototypeResources::StyleSheetAt(size_t aIndex) const { return mStyleSheetList[aIndex]; @@ -198,7 +198,7 @@ nsXBLPrototypeResources::HasStyleSheets() const void nsXBLPrototypeResources::AppendStyleSheetsTo( - nsTArray& aResult) const + nsTArray& aResult) const { aResult.AppendElements(mStyleSheetList); } diff --git a/dom/xbl/nsXBLPrototypeResources.h b/dom/xbl/nsXBLPrototypeResources.h index ebf8becc66095..5ac1923ac9826 100644 --- a/dom/xbl/nsXBLPrototypeResources.h +++ b/dom/xbl/nsXBLPrototypeResources.h @@ -7,7 +7,7 @@ #ifndef nsXBLPrototypeResources_h__ #define nsXBLPrototypeResources_h__ -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "nsICSSLoaderObserver.h" class nsCSSRuleProcessor; @@ -41,13 +41,13 @@ class nsXBLPrototypeResources void ClearLoader(); - void AppendStyleSheet(mozilla::StyleSheetHandle aSheet); - void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet); - void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet); - mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const; + void AppendStyleSheet(mozilla::StyleSheet* aSheet); + void RemoveStyleSheet(mozilla::StyleSheet* aSheet); + void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet); + mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const; size_t SheetCount() const; bool HasStyleSheets() const; - void AppendStyleSheetsTo(nsTArray& aResult) const; + void AppendStyleSheetsTo(nsTArray& aResult) const; /** * Recreates mRuleProcessor to represent the current list of style sheets @@ -63,7 +63,7 @@ class nsXBLPrototypeResources RefPtr mLoader; // A list of loaded stylesheets for this binding. - nsTArray mStyleSheetList; + nsTArray> mStyleSheetList; // The list of stylesheets converted to a rule processor. RefPtr mRuleProcessor; diff --git a/dom/xbl/nsXBLResourceLoader.cpp b/dom/xbl/nsXBLResourceLoader.cpp index e79fd38954a54..e930e6f98939c 100644 --- a/dom/xbl/nsXBLResourceLoader.cpp +++ b/dom/xbl/nsXBLResourceLoader.cpp @@ -17,8 +17,8 @@ #include "nsIDocumentObserver.h" #include "imgILoader.h" #include "imgRequestProxy.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/css/Loader.h" #include "nsIURI.h" #include "nsNetUtil.h" @@ -135,7 +135,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult) CheckLoadURIWithPrincipal(docPrincipal, url, nsIScriptSecurityManager::ALLOW_CHROME); if (NS_SUCCEEDED(rv)) { - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; rv = cssLoader->LoadSheetSync(url, &sheet); NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!"); if (NS_SUCCEEDED(rv)) @@ -164,7 +164,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult) // nsICSSLoaderObserver NS_IMETHODIMP -nsXBLResourceLoader::StyleSheetLoaded(StyleSheetHandle aSheet, +nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/dom/xbl/nsXBLResourceLoader.h b/dom/xbl/nsXBLResourceLoader.h index 17b2f5c2e5d1d..1311f11f7f1bb 100644 --- a/dom/xbl/nsXBLResourceLoader.h +++ b/dom/xbl/nsXBLResourceLoader.h @@ -30,7 +30,7 @@ class nsXBLResourceLoader : public nsICSSLoaderObserver NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader) // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp index 1d23fabb3ceca..6cd5a3c3891c5 100644 --- a/dom/xml/nsXMLContentSink.cpp +++ b/dom/xml/nsXMLContentSink.cpp @@ -411,7 +411,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult, } NS_IMETHODIMP -nsXMLContentSink::StyleSheetLoaded(StyleSheetHandle aSheet, +nsXMLContentSink::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/dom/xml/nsXMLContentSink.h b/dom/xml/nsXMLContentSink.h index fbdac6633eff9..5521f47914b77 100644 --- a/dom/xml/nsXMLContentSink.h +++ b/dom/xml/nsXMLContentSink.h @@ -82,7 +82,7 @@ class nsXMLContentSink : public nsContentSink, NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) override; // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; static bool ParsePIData(const nsString &aData, nsString &aHref, diff --git a/dom/xslt/xslt/txMozillaXMLOutput.cpp b/dom/xslt/xslt/txMozillaXMLOutput.cpp index 3f2f38b5e8b9b..02947f8962897 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.cpp +++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp @@ -976,7 +976,7 @@ txTransformNotifier::ScriptEvaluated(nsresult aResult, } NS_IMETHODIMP -txTransformNotifier::StyleSheetLoaded(StyleSheetHandle aSheet, +txTransformNotifier::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/dom/xslt/xslt/txMozillaXMLOutput.h b/dom/xslt/xslt/txMozillaXMLOutput.h index a4897302bdef5..acdf9bd02efa1 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.h +++ b/dom/xslt/xslt/txMozillaXMLOutput.h @@ -35,7 +35,7 @@ class txTransformNotifier final : public nsIScriptLoaderObserver, NS_DECL_NSISCRIPTLOADEROBSERVER // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index e5df973587849..aed00eff91d13 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -94,8 +94,8 @@ #include "nsIContentPolicy.h" #include "mozAutoDocUpdate.h" #include "xpcpublic.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla; using namespace mozilla::dom; @@ -3106,7 +3106,7 @@ XULDocument::DoneWalking() } NS_IMETHODIMP -XULDocument::StyleSheetLoaded(StyleSheetHandle aSheet, +XULDocument::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { @@ -3730,7 +3730,7 @@ XULDocument::AddPrototypeSheets() for (int32_t i = 0; i < sheets.Count(); i++) { nsCOMPtr uri = sheets[i]; - StyleSheetHandle::RefPtr incompleteSheet; + RefPtr incompleteSheet; rv = CSSLoader()->LoadSheet(uri, mCurrentPrototype->DocumentPrincipal(), EmptyCString(), this, diff --git a/dom/xul/XULDocument.h b/dom/xul/XULDocument.h index 7ed47630378dd..a2f82bb896c69 100644 --- a/dom/xul/XULDocument.h +++ b/dom/xul/XULDocument.h @@ -13,7 +13,7 @@ #include "nsTArray.h" #include "mozilla/dom/XMLDocument.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "nsForwardReference.h" #include "nsIContent.h" #include "nsIDOMXULCommandDispatcher.h" @@ -163,7 +163,7 @@ class XULDocument final : public XMLDocument, NS_DECL_NSIDOMXULDOCUMENT // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; @@ -344,7 +344,7 @@ class XULDocument final : public XMLDocument, * An array of style sheets, that will be added (preserving order) to the * document after all of them are loaded (in DoneWalking). */ - nsTArray mOverlaySheets; + nsTArray> mOverlaySheets; nsCOMPtr mCommandDispatcher; // [OWNER] of the focus tracker diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 35fc170711589..e8540a457d835 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -4237,7 +4237,7 @@ EditorBase::CreateTxnForComposition(const nsAString& aStringToInsert) } NS_IMETHODIMP -EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet, +EditorBase::CreateTxnForAddStyleSheet(StyleSheet* aSheet, AddStyleSheetTransaction** aTransaction) { RefPtr transaction = new AddStyleSheetTransaction(); @@ -4252,7 +4252,7 @@ EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet, NS_IMETHODIMP EditorBase::CreateTxnForRemoveStyleSheet( - StyleSheetHandle aSheet, + StyleSheet* aSheet, RemoveStyleSheetTransaction** aTransaction) { RefPtr transaction = diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index 2ada3d14e209b..63b8fd97b44c2 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -9,7 +9,7 @@ #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc. #include "mozilla/OwningNonNull.h" // for OwningNonNull #include "mozilla/SelectionState.h" // for RangeUpdater, etc. -#include "mozilla/StyleSheetHandle.h" // for StyleSheetHandle +#include "mozilla/StyleSheet.h" // for StyleSheet #include "mozilla/dom/Text.h" #include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr #include "nsCycleCollectionParticipant.h" @@ -328,14 +328,14 @@ class EditorBase : public nsIEditor * Create a transaction for adding a style sheet. */ NS_IMETHOD CreateTxnForAddStyleSheet( - StyleSheetHandle aSheet, + StyleSheet* aSheet, AddStyleSheetTransaction** aTransaction); /** * Create a transaction for removing a style sheet. */ NS_IMETHOD CreateTxnForRemoveStyleSheet( - StyleSheetHandle aSheet, + StyleSheet* aSheet, RemoveStyleSheetTransaction** aTransaction); nsresult DeleteText(nsGenericDOMDataNode& aElement, diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 91a1872d53caa..b953b75e74138 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -72,8 +72,8 @@ #include "mozilla/dom/HTMLBodyElement.h" #include "nsTextFragment.h" #include "nsContentList.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" namespace mozilla { @@ -2854,7 +2854,7 @@ HTMLEditor::ReplaceStyleSheet(const nsAString& aURL) NS_IMETHODIMP HTMLEditor::RemoveStyleSheet(const nsAString& aURL) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL); + RefPtr sheet = GetStyleSheetForURL(aURL); NS_ENSURE_TRUE(sheet, NS_ERROR_UNEXPECTED); RefPtr transaction; @@ -2894,7 +2894,7 @@ HTMLEditor::AddOverrideStyleSheet(const nsAString& aURL) // We MUST ONLY load synchronous local files (no @import) // XXXbz Except this will actually try to load remote files // synchronously, of course.. - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; // Editor override style sheets may want to style Gecko anonymous boxes rv = ps->GetDocument()->CSSLoader()-> LoadSheetSync(uaURI, mozilla::css::eAgentSheetFeatures, true, @@ -2939,7 +2939,7 @@ HTMLEditor::ReplaceOverrideStyleSheet(const nsAString& aURL) NS_IMETHODIMP HTMLEditor::RemoveOverrideStyleSheet(const nsAString& aURL) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL); + RefPtr sheet = GetStyleSheetForURL(aURL); // Make sure we remove the stylesheet from our internal list in all // cases. @@ -2962,7 +2962,7 @@ NS_IMETHODIMP HTMLEditor::EnableStyleSheet(const nsAString& aURL, bool aEnable) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL); + RefPtr sheet = GetStyleSheetForURL(aURL); NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found // Ensure the style sheet is owned by our document. @@ -2980,7 +2980,7 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL, bool HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL) { - StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL); + RefPtr sheet = GetStyleSheetForURL(aURL); // Enable sheet if already loaded. if (sheet) @@ -3002,7 +3002,7 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL) nsresult HTMLEditor::AddNewStyleSheetToList(const nsAString& aURL, - StyleSheetHandle aStyleSheet) + StyleSheet* aStyleSheet) { uint32_t countSS = mStyleSheets.Length(); uint32_t countU = mStyleSheetURLs.Length(); @@ -3032,7 +3032,7 @@ HTMLEditor::RemoveStyleSheetFromList(const nsAString& aURL) return NS_OK; } -StyleSheetHandle +StyleSheet* HTMLEditor::GetStyleSheetForURL(const nsAString& aURL) { // is it already in the list? @@ -3047,7 +3047,7 @@ HTMLEditor::GetStyleSheetForURL(const nsAString& aURL) } void -HTMLEditor::GetURLForStyleSheet(StyleSheetHandle aStyleSheet, +HTMLEditor::GetURLForStyleSheet(StyleSheet* aStyleSheet, nsAString& aURL) { // is it already in the list? @@ -3426,7 +3426,7 @@ HTMLEditor::DebugUnitTests(int32_t* outNumTests, } NS_IMETHODIMP -HTMLEditor::StyleSheetLoaded(StyleSheetHandle aSheet, +HTMLEditor::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/editor/libeditor/HTMLEditor.h b/editor/libeditor/HTMLEditor.h index acdb688143842..4a3635ff0a187 100644 --- a/editor/libeditor/HTMLEditor.h +++ b/editor/libeditor/HTMLEditor.h @@ -8,7 +8,7 @@ #include "mozilla/Attributes.h" #include "mozilla/CSSEditUtils.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "mozilla/TextEditor.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/File.h" @@ -365,7 +365,7 @@ class HTMLEditor final : public TextEditor NS_IMETHOD GetRootElement(nsIDOMElement** aRootElement) override; // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; // Utility Routines, not part of public API @@ -417,15 +417,15 @@ class HTMLEditor final : public TextEditor /** * Dealing with the internal style sheet lists. */ - StyleSheetHandle GetStyleSheetForURL(const nsAString& aURL); - void GetURLForStyleSheet(StyleSheetHandle aStyleSheet, + StyleSheet* GetStyleSheetForURL(const nsAString& aURL); + void GetURLForStyleSheet(StyleSheet* aStyleSheet, nsAString& aURL); /** * Add a url + known style sheet to the internal lists. */ nsresult AddNewStyleSheetToList(const nsAString &aURL, - StyleSheetHandle aStyleSheet); + StyleSheet* aStyleSheet); nsresult RemoveStyleSheetFromList(const nsAString &aURL); bool IsCSSEnabled() @@ -907,7 +907,7 @@ class HTMLEditor final : public TextEditor // Maintain a list of associated style sheets and their urls. nsTArray mStyleSheetURLs; - nsTArray mStyleSheets; + nsTArray> mStyleSheets; // an array for holding default style settings nsTArray mDefaultStyles; diff --git a/editor/libeditor/StyleSheetTransactions.cpp b/editor/libeditor/StyleSheetTransactions.cpp index d870d40fb0010..6a31a16e211df 100644 --- a/editor/libeditor/StyleSheetTransactions.cpp +++ b/editor/libeditor/StyleSheetTransactions.cpp @@ -9,8 +9,8 @@ #include "nsAString.h" #include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc. -#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet +#include "mozilla/StyleSheetInlines.h" #include "nsDebug.h" // for NS_ENSURE_TRUE #include "nsError.h" // for NS_OK, etc. #include "nsIDOMDocument.h" // for nsIDOMDocument @@ -21,7 +21,7 @@ namespace mozilla { static void -AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet) +AddStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet) { nsCOMPtr domDoc; aEditor->GetDocument(getter_AddRefs(domDoc)); @@ -34,7 +34,7 @@ AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet) } static void -RemoveStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet) +RemoveStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet) { nsCOMPtr domDoc; aEditor->GetDocument(getter_AddRefs(domDoc)); @@ -64,7 +64,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase) NS_IMETHODIMP AddStyleSheetTransaction::Init(nsIEditor* aEditor, - StyleSheetHandle aSheet) + StyleSheet* aSheet) { NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG); @@ -118,7 +118,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase) NS_IMETHODIMP RemoveStyleSheetTransaction::Init(nsIEditor* aEditor, - StyleSheetHandle aSheet) + StyleSheet* aSheet) { NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG); diff --git a/editor/libeditor/StyleSheetTransactions.h b/editor/libeditor/StyleSheetTransactions.h index f9e90ec6bada8..bf615b263dcb2 100644 --- a/editor/libeditor/StyleSheetTransactions.h +++ b/editor/libeditor/StyleSheetTransactions.h @@ -7,7 +7,7 @@ #define StylesheetTransactions_h #include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc. -#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle +#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet #include "nsCycleCollectionParticipant.h" #include "nsID.h" // for REFNSIID #include "nscore.h" // for NS_IMETHOD @@ -24,7 +24,7 @@ class AddStyleSheetTransaction final : public EditTransactionBase * @param aEditor The object providing core editing operations * @param aSheet The stylesheet to add */ - NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet); + NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet); AddStyleSheetTransaction(); @@ -38,7 +38,7 @@ class AddStyleSheetTransaction final : public EditTransactionBase // The editor that created this transaction. nsIEditor* mEditor; // The style sheet to add. - mozilla::StyleSheetHandle::RefPtr mSheet; + RefPtr mSheet; }; @@ -50,7 +50,7 @@ class RemoveStyleSheetTransaction final : public EditTransactionBase * @param aEditor The object providing core editing operations. * @param aSheet The stylesheet to remove. */ - NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet); + NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet); RemoveStyleSheetTransaction(); @@ -64,7 +64,7 @@ class RemoveStyleSheetTransaction final : public EditTransactionBase // The editor that created this transaction. nsIEditor* mEditor; // The style sheet to remove. - StyleSheetHandle::RefPtr mSheet; + RefPtr mSheet; }; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 03f87fad8efdb..145ebd69b3664 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -42,8 +42,8 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/EncodingUtils.h" #include "mozilla/WeakPtr.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "nsViewManager.h" #include "nsView.h" @@ -2205,7 +2205,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) auto cache = nsLayoutStylesheetCache::For(backendType); // Handle the user sheets. - StyleSheetHandle sheet = nullptr; + StyleSheet* sheet = nullptr; if (nsContentUtils::IsInChromeDocshell(aDocument)) { sheet = cache->UserChromeSheet(); } else { @@ -2222,7 +2222,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) nsCOMPtr ds(mContainer); nsCOMPtr chromeHandler; nsCOMPtr uri; - StyleSheetHandle::RefPtr chromeSheet; + RefPtr chromeSheet; if (ds) { ds->GetChromeEventHandler(getter_AddRefs(chromeHandler)); @@ -2341,10 +2341,10 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) if (styleSet->IsGecko()) { nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { - for (StyleSheetHandle sheet : *sheetService->AgentStyleSheets()) { + for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) { styleSet->AppendStyleSheet(SheetType::Agent, sheet); } - for (StyleSheetHandle sheet : Reversed(*sheetService->UserStyleSheets())) { + for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) { styleSet->PrependStyleSheet(SheetType::User, sheet); } } diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 20ecac18634ed..3c757e2b86c25 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -25,7 +25,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/StaticPtr.h" #include "mozilla/StyleSetHandle.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "mozilla/WeakPtr.h" #include "gfxPoint.h" #include "nsTHashtable.h" @@ -960,23 +960,23 @@ class nsIPresShell : public nsISupports * Get the set of agent style sheets for this presentation */ virtual nsresult GetAgentStyleSheets( - nsTArray& aSheets) = 0; + nsTArray>& aSheets) = 0; /** * Replace the set of agent style sheets */ virtual nsresult SetAgentStyleSheets( - const nsTArray& aSheets) = 0; + const nsTArray>& aSheets) = 0; /** * Add an override style sheet for this presentation */ - virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) = 0; + virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0; /** * Remove an override style sheet */ - virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) = 0; + virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0; /** * Reconstruct frames for all elements in the document diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index d046f1b0d87fa..8ac8b6e303ce2 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -74,8 +74,8 @@ #include "gfxTextRun.h" #include "nsFontFaceUtils.h" #include "nsLayoutStylesheetCache.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #if defined(MOZ_WIDGET_GTK) #include "gfxPlatformGtk.h" // xxx - for UseFcFontList @@ -1156,7 +1156,7 @@ nsPresContext::CompatibilityModeChanged() StyleSetHandle styleSet = mShell->StyleSet(); auto cache = nsLayoutStylesheetCache::For(styleSet->BackendType()); - StyleSheetHandle sheet = cache->QuirkSheet(); + StyleSheet* sheet = cache->QuirkSheet(); if (needsQuirkSheet) { // quirk.css needs to come after html.css; we just keep it at the end. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 2aa385cf426d9..ea2cece781930 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -193,8 +193,8 @@ #include "nsStyleSet.h" #include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSetHandleInlines.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #ifdef ANDROID #include "nsIDocShellTreeOwner.h" @@ -1404,7 +1404,7 @@ PresShell::UpdatePreferenceStyles() // (See nsPresContext::GetDocumentColorPreferences for how whether we // are a chrome origin image affects some pref styling information.) auto cache = nsLayoutStylesheetCache::For(mStyleSet->BackendType()); - StyleSheetHandle::RefPtr newPrefSheet = + RefPtr newPrefSheet = mPresContext->IsChromeOriginImage() ? cache->ChromePreferenceSheet(mPresContext) : cache->ContentPreferenceSheet(mPresContext); @@ -1451,16 +1451,16 @@ PresShell::AddUserSheet(nsISupports* aSheet) mStyleSet->BeginUpdate(); nsStyleSheetService* sheetService = nsStyleSheetService::gInstance; - nsTArray& userSheets = *sheetService->UserStyleSheets(); + nsTArray>& userSheets = *sheetService->UserStyleSheets(); // Iterate forwards when removing so the searches for RemoveStyleSheet are as // short as possible. - for (StyleSheetHandle sheet : userSheets) { + for (StyleSheet* sheet : userSheets) { mStyleSet->RemoveStyleSheet(SheetType::User, sheet); } // 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 (StyleSheetHandle sheet : Reversed(userSheets)) { + for (StyleSheet* sheet : Reversed(userSheets)) { mStyleSet->PrependStyleSheet(SheetType::User, sheet); } @@ -1497,7 +1497,7 @@ PresShell::AddAuthorSheet(nsISupports* aSheet) // Document specific "additional" Author sheets should be stronger than the // ones added with the StyleSheetService. - StyleSheetHandle firstAuthorSheet = + StyleSheet* firstAuthorSheet = mDocument->GetFirstAdditionalAuthorSheet(); if (firstAuthorSheet) { mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet, firstAuthorSheet); @@ -4530,7 +4530,7 @@ nsIPresShell::RestyleForCSSRuleChanges() } void -PresShell::RecordStyleSheetChange(StyleSheetHandle aStyleSheet) +PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet) { // too bad we can't check that the update is UPDATE_STYLE NS_ASSERTION(mUpdateCount != 0, "must be in an update"); @@ -4554,7 +4554,7 @@ PresShell::RecordStyleSheetChange(StyleSheetHandle aStyleSheet) } void -PresShell::StyleSheetAdded(StyleSheetHandle aStyleSheet, +PresShell::StyleSheetAdded(StyleSheet* aStyleSheet, bool aDocumentSheet) { // We only care when enabled sheets are added @@ -4566,7 +4566,7 @@ PresShell::StyleSheetAdded(StyleSheetHandle aStyleSheet, } void -PresShell::StyleSheetRemoved(StyleSheetHandle aStyleSheet, +PresShell::StyleSheetRemoved(StyleSheet* aStyleSheet, bool aDocumentSheet) { // We only care when enabled sheets are removed @@ -4578,7 +4578,7 @@ PresShell::StyleSheetRemoved(StyleSheetHandle aStyleSheet, } void -PresShell::StyleSheetApplicableStateChanged(StyleSheetHandle aStyleSheet) +PresShell::StyleSheetApplicableStateChanged(StyleSheet* aStyleSheet) { if (aStyleSheet->HasRules()) { RecordStyleSheetChange(aStyleSheet); @@ -4586,19 +4586,19 @@ PresShell::StyleSheetApplicableStateChanged(StyleSheetHandle aStyleSheet) } void -PresShell::StyleRuleChanged(StyleSheetHandle aStyleSheet) +PresShell::StyleRuleChanged(StyleSheet* aStyleSheet) { RecordStyleSheetChange(aStyleSheet); } void -PresShell::StyleRuleAdded(StyleSheetHandle aStyleSheet) +PresShell::StyleRuleAdded(StyleSheet* aStyleSheet) { RecordStyleSheetChange(aStyleSheet); } void -PresShell::StyleRuleRemoved(StyleSheetHandle aStyleSheet) +PresShell::StyleRuleRemoved(StyleSheet* aStyleSheet) { RecordStyleSheetChange(aStyleSheet); } @@ -8942,7 +8942,7 @@ PresShell::IsVisible() } nsresult -PresShell::GetAgentStyleSheets(nsTArray& aSheets) +PresShell::GetAgentStyleSheets(nsTArray>& aSheets) { aSheets.Clear(); int32_t sheetCount = mStyleSet->SheetCount(SheetType::Agent); @@ -8952,7 +8952,7 @@ PresShell::GetAgentStyleSheets(nsTArray& aSheets) } for (int32_t i = 0; i < sheetCount; ++i) { - StyleSheetHandle sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i); + StyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i); aSheets.AppendElement(sheet); } @@ -8960,19 +8960,19 @@ PresShell::GetAgentStyleSheets(nsTArray& aSheets) } nsresult -PresShell::SetAgentStyleSheets(const nsTArray& aSheets) +PresShell::SetAgentStyleSheets(const nsTArray>& aSheets) { return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets); } nsresult -PresShell::AddOverrideStyleSheet(StyleSheetHandle aSheet) +PresShell::AddOverrideStyleSheet(StyleSheet* aSheet) { return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet); } nsresult -PresShell::RemoveOverrideStyleSheet(StyleSheetHandle aSheet) +PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet) { return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet); } diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 65a52748157f0..cfcedbc7404cc 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -182,12 +182,12 @@ class PresShell final : public nsIPresShell, virtual void UnsuppressPainting() override; virtual nsresult GetAgentStyleSheets( - nsTArray& aSheets) override; + nsTArray>& aSheets) override; virtual nsresult SetAgentStyleSheets( - const nsTArray& aSheets) override; + const nsTArray>& aSheets) override; - virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) override; - virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) override; + virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) override; + virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheet* aSheet) override; virtual nsresult HandleEventWithTarget( mozilla::WidgetEvent* aEvent, @@ -541,7 +541,7 @@ class PresShell final : public nsIPresShell, void ShowEventTargetDebug(); #endif - void RecordStyleSheetChange(mozilla::StyleSheetHandle aStyleSheet); + void RecordStyleSheetChange(mozilla::StyleSheet* aStyleSheet); void RemovePreferenceStyles(); @@ -862,7 +862,7 @@ class PresShell final : public nsIPresShell, mozilla::layers::ScrollableLayerGuid mMouseEventTargetGuid; // mStyleSet owns it but we maintain a ref, may be null - mozilla::StyleSheetHandle::RefPtr mPrefStyleSheet; + RefPtr mPrefStyleSheet; // Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after // we finish reflowing mCurrentReflowRoot. diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index f36f35178e8bc..b3a5161cd48b5 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -9,8 +9,8 @@ #include "nsStyleSheetService.h" #include "mozilla/CSSStyleSheet.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/Unused.h" #include "mozilla/css/Loader.h" #include "mozilla/dom/ContentParent.h" @@ -81,7 +81,7 @@ nsStyleSheetService::RegisterFromEnumerator(nsICategoryManager *aManager, } int32_t -nsStyleSheetService::FindSheetByURI(const nsTArray& aSheets, +nsStyleSheetService::FindSheetByURI(const nsTArray>& aSheets, nsIURI* aSheetURI) { for (int32_t i = aSheets.Length() - 1; i >= 0; i-- ) { @@ -158,7 +158,7 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI, // XXXheycam Once the nsStyleSheetService can hold ServoStyleSheets too, // we'll need to include them in the notification. - StyleSheetHandle sheet = mSheets[aSheetType].LastElement(); + StyleSheet* sheet = mSheets[aSheetType].LastElement(); if (sheet->IsGecko()) { CSSStyleSheet* cssSheet = sheet->AsGecko(); serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet), @@ -216,7 +216,7 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI, // style sheet. RefPtr loader = new css::Loader(StyleBackendType::Gecko); - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet); NS_ENSURE_SUCCESS(rv, rv); @@ -270,7 +270,7 @@ nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType, RefPtr loader = new css::Loader(StyleBackendType::Gecko); - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet); NS_ENSURE_SUCCESS(rv, rv); @@ -293,7 +293,7 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType) int32_t foundIndex = FindSheetByURI(mSheets[aSheetType], aSheetURI); NS_ENSURE_TRUE(foundIndex >= 0, NS_ERROR_INVALID_ARG); - StyleSheetHandle::RefPtr sheet = mSheets[aSheetType][foundIndex]; + RefPtr sheet = mSheets[aSheetType][foundIndex]; mSheets[aSheetType].RemoveElementAt(foundIndex); const char* message; @@ -376,7 +376,7 @@ nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) co size_t n = aMallocSizeOf(this); for (auto& sheetArray : mSheets) { n += sheetArray.ShallowSizeOfExcludingThis(aMallocSizeOf); - for (StyleSheetHandle sheet : sheetArray) { + for (StyleSheet* sheet : sheetArray) { n += sheet->SizeOfIncludingThis(aMallocSizeOf); } } diff --git a/layout/base/nsStyleSheetService.h b/layout/base/nsStyleSheetService.h index 81402fcecb7bb..982e1a05aef08 100644 --- a/layout/base/nsStyleSheetService.h +++ b/layout/base/nsStyleSheetService.h @@ -15,7 +15,7 @@ #include "nsIStyleSheetService.h" #include "mozilla/Attributes.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" class nsICategoryManager; class nsIMemoryReporter; @@ -41,15 +41,15 @@ class nsStyleSheetService final nsresult Init(); - nsTArray* AgentStyleSheets() + nsTArray>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; } - nsTArray* UserStyleSheets() + nsTArray>* UserStyleSheets() { return &mSheets[USER_SHEET]; } - nsTArray* AuthorStyleSheets() + nsTArray>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; } @@ -67,7 +67,7 @@ class nsStyleSheetService final nsISimpleEnumerator *aEnumerator, uint32_t aSheetType); - int32_t FindSheetByURI(const nsTArray& aSheets, + int32_t FindSheetByURI(const nsTArray>& aSheets, nsIURI* aSheetURI); // Like LoadAndRegisterSheet, but doesn't notify. If successful, the @@ -75,7 +75,7 @@ class nsStyleSheetService final nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI, uint32_t aSheetType); - nsTArray mSheets[3]; + nsTArray> mSheets[3]; }; #endif diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 391d13105397f..9f3aef5aab319 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -2086,7 +2086,7 @@ CSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule, // nsICSSLoaderObserver implementation NS_IMETHODIMP -CSSStyleSheet::StyleSheetLoaded(StyleSheetHandle aSheet, +CSSStyleSheet::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/layout/style/CSSStyleSheet.h b/layout/style/CSSStyleSheet.h index 24e68f4ed35af..62242e6909f35 100644 --- a/layout/style/CSSStyleSheet.h +++ b/layout/style/CSSStyleSheet.h @@ -195,7 +195,7 @@ class CSSStyleSheet final : public nsIDOMCSSStyleSheet, uint32_t aIndex, uint32_t* aReturn); // nsICSSLoaderObserver interface - NS_IMETHOD StyleSheetLoaded(StyleSheetHandle aSheet, bool aWasAlternate, + NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; void EnsureUniqueInner(); diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 0f08863361f3e..5eeebe72dbc44 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -1692,7 +1692,7 @@ FontFaceSet::PrefEnabled() // nsICSSLoaderObserver NS_IMETHODIMP -FontFaceSet::StyleSheetLoaded(StyleSheetHandle aSheet, +FontFaceSet::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { diff --git a/layout/style/FontFaceSet.h b/layout/style/FontFaceSet.h index 20ca07a132437..58e4982fe513a 100644 --- a/layout/style/FontFaceSet.h +++ b/layout/style/FontFaceSet.h @@ -148,7 +148,7 @@ class FontFaceSet final : public DOMEventTargetHelper static bool PrefEnabled(); // nsICSSLoaderObserver - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) override; diff --git a/layout/style/HandleRefPtr.h b/layout/style/HandleRefPtr.h index 1b2f7549dd880..d8efe9af749c0 100644 --- a/layout/style/HandleRefPtr.h +++ b/layout/style/HandleRefPtr.h @@ -19,7 +19,7 @@ namespace mozilla { /** * A class for holding strong references to handle-managed objects. * - * This is intended for use with objects like StyleSheetHandle, where + * This is intended for use with objects like StyleSheet*, where * the handle type is not a pointer but which can still have ->AddRef() * and ->Release() called on it. */ diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 8ba37db3069cd..54669687e0ef1 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -53,8 +53,8 @@ #include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/URL.h" #include "mozilla/AsyncEventDispatcher.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/ConsoleReportCollector.h" #ifdef MOZ_XUL @@ -124,7 +124,7 @@ class SheetLoadData final : public nsIRunnable, SheetLoadData(Loader* aLoader, const nsSubstring& aTitle, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, nsIStyleSheetLinkingElement* aOwningElement, bool aIsAlternate, nsICSSLoaderObserver* aObserver, @@ -134,7 +134,7 @@ class SheetLoadData final : public nsIRunnable, // Data for loading a sheet linked from an @import rule SheetLoadData(Loader* aLoader, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, SheetLoadData* aParentData, nsICSSLoaderObserver* aObserver, nsIPrincipal* aLoaderPrincipal, @@ -143,7 +143,7 @@ class SheetLoadData final : public nsIRunnable, // Data for loading a non-document sheet SheetLoadData(Loader* aLoader, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, bool aSyncLoad, bool aUseSystemPrincipal, const nsCString& aCharset, @@ -178,7 +178,7 @@ class SheetLoadData final : public nsIRunnable, uint32_t mLineNumber; // The sheet we're loading data for - StyleSheetHandle::RefPtr mSheet; + RefPtr mSheet; // Linked list of datas for the same URI as us SheetLoadData* mNext; // strong ref @@ -300,7 +300,7 @@ NS_IMPL_ISUPPORTS(SheetLoadData, nsIUnicharStreamLoaderObserver, nsIRunnable, SheetLoadData::SheetLoadData(Loader* aLoader, const nsSubstring& aTitle, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, nsIStyleSheetLinkingElement* aOwningElement, bool aIsAlternate, nsICSSLoaderObserver* aObserver, @@ -331,7 +331,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader, SheetLoadData::SheetLoadData(Loader* aLoader, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, SheetLoadData* aParentData, nsICSSLoaderObserver* aObserver, nsIPrincipal* aLoaderPrincipal, @@ -370,7 +370,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader, SheetLoadData::SheetLoadData(Loader* aLoader, nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, bool aSyncLoad, bool aUseSystemPrincipal, const nsCString& aCharset, @@ -1081,7 +1081,7 @@ Loader::CreateSheet(nsIURI* aURI, const nsAString& aTitle, StyleSheetState& aSheetState, bool *aIsAlternate, - StyleSheetHandle::RefPtr* aSheet) + RefPtr* aSheet) { LOG(("css::Loader::CreateSheet")); NS_PRECONDITION(aSheet, "Null out param!"); @@ -1100,7 +1100,7 @@ Loader::CreateSheet(nsIURI* aURI, // XXXheycam Cached sheets currently must be CSSStyleSheets. if (aURI && GetStyleBackendType() == StyleBackendType::Gecko) { aSheetState = eSheetComplete; - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; // First, the XUL cache #ifdef MOZ_XUL @@ -1109,7 +1109,7 @@ Loader::CreateSheet(nsIURI* aURI, if (cache) { if (cache->IsEnabled()) { sheet = cache->GetStyleSheet(aURI); - LOG((" From XUL cache: %p", sheet->AsVoidPtr())); + LOG((" From XUL cache: %p", sheet.get())); } } } @@ -1120,10 +1120,10 @@ Loader::CreateSheet(nsIURI* aURI, // Then our per-document complete sheets. URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode, aReferrerPolicy); - StyleSheetHandle completeSheet = nullptr; + StyleSheet* completeSheet = nullptr; mSheets->mCompleteSheets.Get(&key, &completeSheet); sheet = completeSheet; - LOG((" From completed: %p", sheet->AsVoidPtr())); + LOG((" From completed: %p", sheet.get())); fromCompleteSheets = !!sheet; } @@ -1141,7 +1141,7 @@ Loader::CreateSheet(nsIURI* aURI, // Make sure it hasn't been modified; if it has, we can't use it if (sheet->AsGecko()->IsModified()) { LOG((" Not cloning completed sheet %p because it's been modified", - sheet->AsVoidPtr())); + sheet.get())); sheet = nullptr; fromCompleteSheets = false; } @@ -1155,7 +1155,7 @@ Loader::CreateSheet(nsIURI* aURI, mSheets->mLoadingDatas.Get(&key, &loadData); if (loadData) { sheet = loadData->mSheet; - LOG((" From loading: %p", sheet->AsVoidPtr())); + LOG((" From loading: %p", sheet.get())); #ifdef DEBUG bool debugEqual; @@ -1175,7 +1175,7 @@ Loader::CreateSheet(nsIURI* aURI, mSheets->mPendingDatas.Get(&key, &loadData); if (loadData) { sheet = loadData->mSheet; - LOG((" From pending: %p", sheet->AsVoidPtr())); + LOG((" From pending: %p", sheet.get())); #ifdef DEBUG bool debugEqual; @@ -1272,7 +1272,7 @@ Loader::CreateSheet(nsIURI* aURI, * the sheet had "alternate" in its rel. */ void -Loader::PrepareSheet(StyleSheetHandle aSheet, +Loader::PrepareSheet(StyleSheet* aSheet, const nsSubstring& aTitle, const nsSubstring& aMediaString, nsMediaList* aMediaList, @@ -1324,7 +1324,7 @@ Loader::PrepareSheet(StyleSheetHandle aSheet, * as determined by CompareDocumentPosition. */ nsresult -Loader::InsertSheetInDoc(StyleSheetHandle aSheet, +Loader::InsertSheetInDoc(StyleSheet* aSheet, nsIContent* aLinkingContent, nsIDocument* aDocument) { @@ -1346,7 +1346,7 @@ Loader::InsertSheetInDoc(StyleSheetHandle aSheet, */ int32_t insertionPoint; for (insertionPoint = sheetCount - 1; insertionPoint >= 0; --insertionPoint) { - StyleSheetHandle curSheet = aDocument->GetStyleSheetAt(insertionPoint); + StyleSheet* curSheet = aDocument->GetStyleSheetAt(insertionPoint); NS_ASSERTION(curSheet, "There must be a sheet here!"); nsCOMPtr sheetOwner = curSheet->GetOwnerNode(); if (sheetOwner && !aLinkingContent) { @@ -1403,8 +1403,8 @@ Loader::InsertSheetInDoc(StyleSheetHandle aSheet, * bug 1220506.) */ nsresult -Loader::InsertChildSheet(StyleSheetHandle aSheet, - StyleSheetHandle aParentSheet, +Loader::InsertChildSheet(StyleSheet* aSheet, + StyleSheet* aParentSheet, ImportRule* aParentRule) { LOG(("css::Loader::InsertChildSheet")); @@ -1894,7 +1894,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus, MOZ_ASSERT(!(data->mSheet->IsGecko() && data->mSheet->AsGecko()->IsModified()), "should not get marked modified during parsing"); - data->mSheet->AsStyleSheet()->SetComplete(); + data->mSheet->SetComplete(); data->ScheduleLoadEventIfNeeded(aStatus); } if (data->mMustNotify && (data->mObserver || !mObservers.IsEmpty())) { @@ -2005,7 +2005,7 @@ Loader::LoadInlineStyle(nsIContent* aElement, // load data or to CreateSheet(). Also, OK to use CORS_NONE for the CORS // mode and mDocument's ReferrerPolicy. StyleSheetState state; - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; nsresult rv = CreateSheet(nullptr, aElement, nullptr, eAuthorSheetFeatures, CORS_NONE, mDocument->GetReferrerPolicy(), EmptyString(), // no inline integrity checks @@ -2103,7 +2103,7 @@ Loader::LoadStyleLink(nsIContent* aElement, } StyleSheetState state; - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; rv = CreateSheet(aURL, aElement, principal, eAuthorSheetFeatures, aCORSMode, aReferrerPolicy, aIntegrity, false, aHasAlternateRel, aTitle, state, aIsAlternate, @@ -2120,7 +2120,7 @@ Loader::LoadStyleLink(nsIContent* aElement, nsCOMPtr owningElement(do_QueryInterface(aElement)); if (state == eSheetComplete) { - LOG((" Sheet already complete: 0x%p", sheet->AsVoidPtr())); + LOG((" Sheet already complete: 0x%p", sheet.get())); if (aObserver || !mObservers.IsEmpty() || owningElement) { rv = PostLoadEvent(aURL, sheet, aObserver, *aIsAlternate, owningElement); @@ -2190,7 +2190,7 @@ HaveAncestorDataWithURI(SheetLoadData *aData, nsIURI *aURI) } nsresult -Loader::LoadChildSheet(StyleSheetHandle aParentSheet, +Loader::LoadChildSheet(StyleSheet* aParentSheet, nsIURI* aURL, nsMediaList* aMedia, ImportRule* aParentRule, @@ -2212,8 +2212,8 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet, // check for an owning document: if none, don't bother walking up the parent // sheets if (aParentSheet->GetOwningDocument()) { - StyleSheetHandle topSheet = aParentSheet; - while (StyleSheetHandle parent = topSheet->GetParentSheet()) { + StyleSheet* topSheet = aParentSheet; + while (StyleSheet* parent = topSheet->GetParentSheet()) { topSheet = parent; } owningNode = topSheet->GetOwnerNode(); @@ -2257,7 +2257,7 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet, // Now that we know it's safe to load this (passes security check and not a // loop) do so. - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; RefPtr reusableSheet; StyleSheetState state; if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, reusableSheet)) { @@ -2269,7 +2269,7 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet, const nsSubstring& empty = EmptyString(); // For now, use CORS_NONE for child sheets rv = CreateSheet(aURL, nullptr, principal, - aParentSheet->AsStyleSheet()->ParsingMode(), + aParentSheet->ParsingMode(), CORS_NONE, aParentSheet->GetReferrerPolicy(), EmptyString(), // integrity is only checked on main sheet parentData ? parentData->mSyncLoad : false, @@ -2312,7 +2312,7 @@ nsresult Loader::LoadSheetSync(nsIURI* aURL, SheetParsingMode aParsingMode, bool aUseSystemPrincipal, - StyleSheetHandle::RefPtr* aSheet) + RefPtr* aSheet) { LOG(("css::Loader::LoadSheetSync")); return InternalLoadNonDocumentSheet(aURL, @@ -2326,7 +2326,7 @@ Loader::LoadSheet(nsIURI* aURL, nsIPrincipal* aOriginPrincipal, const nsCString& aCharset, nsICSSLoaderObserver* aObserver, - StyleSheetHandle::RefPtr* aSheet) + RefPtr* aSheet) { LOG(("css::Loader::LoadSheet(aURL, aObserver, aSheet) api call")); NS_PRECONDITION(aSheet, "aSheet is null"); @@ -2361,7 +2361,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL, bool aUseSystemPrincipal, nsIPrincipal* aOriginPrincipal, const nsCString& aCharset, - StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, nsICSSLoaderObserver* aObserver, CORSMode aCORSMode, ReferrerPolicy aReferrerPolicy, @@ -2389,7 +2389,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL, StyleSheetState state; bool isAlternate; - StyleSheetHandle::RefPtr sheet; + RefPtr sheet; bool syncLoad = (aObserver == nullptr); const nsSubstring& empty = EmptyString(); @@ -2432,7 +2432,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL, nsresult Loader::PostLoadEvent(nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, nsICSSLoaderObserver* aObserver, bool aWasAlternate, nsIStyleSheetLinkingElement* aElement) @@ -2652,7 +2652,7 @@ Loader::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const // If aSheet has a parent, then its parent will report it so we don't // have to worry about it here. Likewise, if aSheet has an owning node, // then the document that node is in will report it. - const StyleSheetHandle sheet = iter.UserData(); + const StyleSheet* sheet = iter.UserData(); n += (sheet->GetOwnerNode() || sheet->GetParentSheet()) ? 0 : sheet->SizeOfIncludingThis(aMallocSizeOf); diff --git a/layout/style/Loader.h b/layout/style/Loader.h index 8bb4290972459..209783a80422d 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -24,7 +24,7 @@ #include "mozilla/Maybe.h" #include "mozilla/MemoryReporting.h" #include "mozilla/StyleBackendType.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "mozilla/net/ReferrerPolicy.h" class nsICSSLoaderObserver; @@ -290,7 +290,7 @@ class Loader final { * @param aSavedSheets any saved style sheets which could be reused * for this load */ - nsresult LoadChildSheet(StyleSheetHandle aParentSheet, + nsresult LoadChildSheet(StyleSheet* aParentSheet, nsIURI* aURL, nsMediaList* aMedia, ImportRule* aRule, @@ -321,13 +321,13 @@ class Loader final { nsresult LoadSheetSync(nsIURI* aURL, SheetParsingMode aParsingMode, bool aUseSystemPrincipal, - StyleSheetHandle::RefPtr* aSheet); + RefPtr* aSheet); /** * As above, but defaults aParsingMode to eAuthorSheetFeatures and * aUseSystemPrincipal to false. */ - nsresult LoadSheetSync(nsIURI* aURL, StyleSheetHandle::RefPtr* aSheet) { + nsresult LoadSheetSync(nsIURI* aURL, RefPtr* aSheet) { return LoadSheetSync(aURL, eAuthorSheetFeatures, false, aSheet); } @@ -356,7 +356,7 @@ class Loader final { nsIPrincipal* aOriginPrincipal, const nsCString& aCharset, nsICSSLoaderObserver* aObserver, - StyleSheetHandle::RefPtr* aSheet); + RefPtr* aSheet); /** * Same as above, to be used when the caller doesn't care about the @@ -466,24 +466,24 @@ class Loader final { const nsAString& aTitle, StyleSheetState& aSheetState, bool *aIsAlternate, - StyleSheetHandle::RefPtr* aSheet); + RefPtr* aSheet); // Pass in either a media string or the nsMediaList from the // CSSParser. Don't pass both. // This method will set the sheet's enabled state based on isAlternate - void PrepareSheet(StyleSheetHandle aSheet, + void PrepareSheet(StyleSheet* aSheet, const nsAString& aTitle, const nsAString& aMediaString, nsMediaList* aMediaList, dom::Element* aScopeElement, bool isAlternate); - nsresult InsertSheetInDoc(StyleSheetHandle aSheet, + nsresult InsertSheetInDoc(StyleSheet* aSheet, nsIContent* aLinkingContent, nsIDocument* aDocument); - nsresult InsertChildSheet(StyleSheetHandle aSheet, - StyleSheetHandle aParentSheet, + nsresult InsertChildSheet(StyleSheet* aSheet, + StyleSheet* aParentSheet, ImportRule* aParentRule); nsresult InternalLoadNonDocumentSheet(nsIURI* aURL, @@ -492,7 +492,7 @@ class Loader final { bool aUseSystemPrincipal, nsIPrincipal* aOriginPrincipal, const nsCString& aCharset, - StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, nsICSSLoaderObserver* aObserver, CORSMode aCORSMode = CORS_NONE, ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Default, @@ -506,7 +506,7 @@ class Loader final { // sheet was loaded from (may be null for inline sheets). aElement is the // owning element for this sheet. nsresult PostLoadEvent(nsIURI* aURI, - StyleSheetHandle aSheet, + StyleSheet* aSheet, nsICSSLoaderObserver* aObserver, bool aWasAlternate, nsIStyleSheetLinkingElement* aElement); @@ -545,8 +545,8 @@ class Loader final { struct Sheets { nsBaseHashtable mCompleteSheets; + RefPtr, + StyleSheet*> mCompleteSheets; nsDataHashtable mLoadingDatas; // weak refs nsDataHashtable diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index f3cbff21be9a1..e8f3865feeb8c 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -352,7 +352,7 @@ nsresult ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet, nsIDocument* aDocument) { - StyleSheetHandle::RefPtr strong(aSheet); + RefPtr strong(aSheet); mSheets[SheetType::Doc].RemoveElement(aSheet); diff --git a/layout/style/StyleSetHandle.h b/layout/style/StyleSetHandle.h index 648dbb848e0f3..ad75f75ae48d4 100644 --- a/layout/style/StyleSetHandle.h +++ b/layout/style/StyleSetHandle.h @@ -11,7 +11,7 @@ #include "mozilla/RefPtr.h" #include "mozilla/SheetType.h" #include "mozilla/StyleBackendType.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #include "nsChangeHint.h" #include "nsCSSPseudoElements.h" #include "nsTArray.h" @@ -132,18 +132,18 @@ class StyleSetHandle inline already_AddRefed ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext, uint32_t aFlags = 0); - inline nsresult AppendStyleSheet(SheetType aType, StyleSheetHandle aSheet); - inline nsresult PrependStyleSheet(SheetType aType, StyleSheetHandle aSheet); - inline nsresult RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet); + 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); + const nsTArray>& aNewSheets); inline nsresult InsertStyleSheetBefore(SheetType aType, - StyleSheetHandle aNewSheet, - StyleSheetHandle aReferenceSheet); + StyleSheet* aNewSheet, + StyleSheet* aReferenceSheet); inline int32_t SheetCount(SheetType aType) const; - inline StyleSheetHandle StyleSheetAt(SheetType aType, int32_t aIndex) const; - inline nsresult RemoveDocStyleSheet(StyleSheetHandle aSheet); - inline nsresult AddDocStyleSheet(StyleSheetHandle aSheet, nsIDocument* aDocument); + 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, diff --git a/layout/style/StyleSetHandleInlines.h b/layout/style/StyleSetHandleInlines.h index 4a92278e7889b..2bb32101faa74 100644 --- a/layout/style/StyleSetHandleInlines.h +++ b/layout/style/StyleSetHandleInlines.h @@ -126,21 +126,21 @@ StyleSetHandle::Ptr::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, // manage the set of style sheets in the style set nsresult -StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheetHandle aSheet) +StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet) { FORWARD_CONCRETE(AppendStyleSheet, (aType, aSheet->AsGecko()), (aType, aSheet->AsServo())); } nsresult -StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheetHandle aSheet) +StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet) { FORWARD_CONCRETE(PrependStyleSheet, (aType, aSheet->AsGecko()), (aType, aSheet->AsServo())); } nsresult -StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet) +StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet) { FORWARD_CONCRETE(RemoveStyleSheet, (aType, aSheet->AsGecko()), (aType, aSheet->AsServo())); @@ -148,7 +148,7 @@ StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet) nsresult StyleSetHandle::Ptr::ReplaceSheets(SheetType aType, - const nsTArray& aNewSheets) + const nsTArray>& aNewSheets) { if (IsGecko()) { nsTArray> newSheets(aNewSheets.Length()); @@ -167,8 +167,8 @@ StyleSetHandle::Ptr::ReplaceSheets(SheetType aType, nsresult StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType, - StyleSheetHandle aNewSheet, - StyleSheetHandle aReferenceSheet) + StyleSheet* aNewSheet, + StyleSheet* aReferenceSheet) { FORWARD_CONCRETE( InsertStyleSheetBefore, @@ -182,21 +182,21 @@ StyleSetHandle::Ptr::SheetCount(SheetType aType) const FORWARD(SheetCount, (aType)); } -StyleSheetHandle +StyleSheet* StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const { FORWARD(StyleSheetAt, (aType, aIndex)); } nsresult -StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheetHandle aSheet) +StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet) { FORWARD_CONCRETE(RemoveDocStyleSheet, (aSheet->AsGecko()), (aSheet->AsServo())); } nsresult -StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheetHandle aSheet, +StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument) { FORWARD_CONCRETE(AddDocStyleSheet, (aSheet->AsGecko(), aDocument), diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index 5fb8c57f14981..8ab0d94c1b9d2 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -64,7 +64,7 @@ StyleSheet::SetComplete() if (mDocument && !mDisabled) { // Let the document know mDocument->BeginUpdate(UPDATE_STYLE); - mDocument->SetStyleSheetApplicableState(AsHandle(), true); + mDocument->SetStyleSheetApplicableState(this, true); mDocument->EndUpdate(UPDATE_STYLE); } diff --git a/layout/style/nsICSSLoaderObserver.h b/layout/style/nsICSSLoaderObserver.h index 79c6b5841f91f..acacf50f90acb 100644 --- a/layout/style/nsICSSLoaderObserver.h +++ b/layout/style/nsICSSLoaderObserver.h @@ -9,7 +9,7 @@ #define nsICSSLoaderObserver_h___ #include "nsISupports.h" -#include "mozilla/StyleSheetHandle.h" +#include "mozilla/StyleSheet.h" #define NS_ICSSLOADEROBSERVER_IID \ { 0xf51fbf2c, 0xfe4b, 0x4a15, \ @@ -34,7 +34,7 @@ class nsICSSLoaderObserver : public nsISupports { * as CSS, and doesn't indicate anything about the status of any child * sheets of aSheet. */ - NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet, + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) = 0; }; diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 9c6eca3af18c2..7bea4a0d5d294 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -10,8 +10,8 @@ #include "mozilla/StyleSheetInlines.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" #include "mozilla/css/Loader.h" #include "mozilla/dom/SRIMetadata.h" #include "nsIFile.h" @@ -68,7 +68,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject, return NS_OK; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::ScrollbarsSheet() { if (!mScrollbarsSheet) { @@ -80,7 +80,7 @@ nsLayoutStylesheetCache::ScrollbarsSheet() return mScrollbarsSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::FormsSheet() { if (!mFormsSheet) { @@ -92,7 +92,7 @@ nsLayoutStylesheetCache::FormsSheet() return mFormsSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::NumberControlSheet() { if (!sNumberControlEnabled) { @@ -107,19 +107,19 @@ nsLayoutStylesheetCache::NumberControlSheet() return mNumberControlSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::UserContentSheet() { return mUserContentSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::UserChromeSheet() { return mUserChromeSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::UASheet() { if (!mUASheet) { @@ -130,7 +130,7 @@ nsLayoutStylesheetCache::UASheet() return mUASheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::HTMLSheet() { if (!mHTMLSheet) { @@ -141,31 +141,31 @@ nsLayoutStylesheetCache::HTMLSheet() return mHTMLSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::MinimalXULSheet() { return mMinimalXULSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::XULSheet() { return mXULSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::QuirkSheet() { return mQuirkSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::SVGSheet() { return mSVGSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::MathMLSheet() { if (!mMathMLSheet) { @@ -176,13 +176,13 @@ nsLayoutStylesheetCache::MathMLSheet() return mMathMLSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::CounterStylesSheet() { return mCounterStylesSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::NoScriptSheet() { if (!mNoScriptSheet) { @@ -193,7 +193,7 @@ nsLayoutStylesheetCache::NoScriptSheet() return mNoScriptSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::NoFramesSheet() { if (!mNoFramesSheet) { @@ -204,7 +204,7 @@ nsLayoutStylesheetCache::NoFramesSheet() return mNoFramesSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::ChromePreferenceSheet(nsPresContext* aPresContext) { if (!mChromePreferenceSheet) { @@ -214,7 +214,7 @@ nsLayoutStylesheetCache::ChromePreferenceSheet(nsPresContext* aPresContext) return mChromePreferenceSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::ContentPreferenceSheet(nsPresContext* aPresContext) { if (!mContentPreferenceSheet) { @@ -224,7 +224,7 @@ nsLayoutStylesheetCache::ContentPreferenceSheet(nsPresContext* aPresContext) return mContentPreferenceSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::ContentEditableSheet() { if (!mContentEditableSheet) { @@ -235,7 +235,7 @@ nsLayoutStylesheetCache::ContentEditableSheet() return mContentEditableSheet; } -StyleSheetHandle +StyleSheet* nsLayoutStylesheetCache::DesignModeSheet() { if (!mDesignModeSheet) { @@ -418,7 +418,7 @@ nsLayoutStylesheetCache::InitFromProfile() void nsLayoutStylesheetCache::LoadSheetURL(const char* aURL, - StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, SheetParsingMode aParsingMode) { nsCOMPtr uri; @@ -431,7 +431,7 @@ nsLayoutStylesheetCache::LoadSheetURL(const char* aURL, void nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, - StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, SheetParsingMode aParsingMode) { bool exists = false; @@ -733,7 +733,7 @@ ErrorLoadingBuiltinSheet(nsIURI* aURI, const char* aMsg) void nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, - StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, SheetParsingMode aParsingMode) { if (!aURI) { @@ -764,8 +764,8 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, } /* static */ void -nsLayoutStylesheetCache::InvalidateSheet(StyleSheetHandle::RefPtr* aGeckoSheet, - StyleSheetHandle::RefPtr* aServoSheet) +nsLayoutStylesheetCache::InvalidateSheet(RefPtr* aGeckoSheet, + RefPtr* aServoSheet) { MOZ_ASSERT(gCSSLoader_Gecko || gCSSLoader_Servo, "pref changed before we loaded a sheet?"); @@ -839,7 +839,7 @@ nsLayoutStylesheetCache::InvalidatePreferenceSheets() } void -nsLayoutStylesheetCache::BuildPreferenceSheet(StyleSheetHandle::RefPtr* aSheet, +nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr* aSheet, nsPresContext* aPresContext) { if (mBackendType == StyleBackendType::Gecko) { @@ -850,14 +850,14 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(StyleSheetHandle::RefPtr* aSheet, mozilla::net::RP_Default, dom::SRIMetadata()); } - StyleSheetHandle sheet = *aSheet; + StyleSheet* sheet = *aSheet; nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr); MOZ_ASSERT(uri, "URI creation shouldn't fail"); sheet->SetURIs(uri, uri, uri); - sheet->AsStyleSheet()->SetComplete(); + sheet->SetComplete(); static const uint32_t kPreallocSize = 1024; diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 996497937c0bc..9b1387ea788e5 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -40,27 +40,27 @@ class nsLayoutStylesheetCache final */ static nsLayoutStylesheetCache* For(mozilla::StyleBackendType aType); - mozilla::StyleSheetHandle ScrollbarsSheet(); - mozilla::StyleSheetHandle FormsSheet(); + mozilla::StyleSheet* ScrollbarsSheet(); + mozilla::StyleSheet* FormsSheet(); // This function is expected to return nullptr when the dom.forms.number // pref is disabled. - mozilla::StyleSheetHandle NumberControlSheet(); - mozilla::StyleSheetHandle UserContentSheet(); - mozilla::StyleSheetHandle UserChromeSheet(); - mozilla::StyleSheetHandle UASheet(); - mozilla::StyleSheetHandle HTMLSheet(); - mozilla::StyleSheetHandle MinimalXULSheet(); - mozilla::StyleSheetHandle XULSheet(); - mozilla::StyleSheetHandle QuirkSheet(); - mozilla::StyleSheetHandle SVGSheet(); - mozilla::StyleSheetHandle MathMLSheet(); - mozilla::StyleSheetHandle CounterStylesSheet(); - mozilla::StyleSheetHandle NoScriptSheet(); - mozilla::StyleSheetHandle NoFramesSheet(); - mozilla::StyleSheetHandle ChromePreferenceSheet(nsPresContext* aPresContext); - mozilla::StyleSheetHandle ContentPreferenceSheet(nsPresContext* aPresContext); - mozilla::StyleSheetHandle ContentEditableSheet(); - mozilla::StyleSheetHandle DesignModeSheet(); + mozilla::StyleSheet* NumberControlSheet(); + mozilla::StyleSheet* UserContentSheet(); + mozilla::StyleSheet* UserChromeSheet(); + mozilla::StyleSheet* UASheet(); + mozilla::StyleSheet* HTMLSheet(); + mozilla::StyleSheet* MinimalXULSheet(); + mozilla::StyleSheet* XULSheet(); + mozilla::StyleSheet* QuirkSheet(); + mozilla::StyleSheet* SVGSheet(); + mozilla::StyleSheet* MathMLSheet(); + mozilla::StyleSheet* CounterStylesSheet(); + mozilla::StyleSheet* NoScriptSheet(); + mozilla::StyleSheet* NoFramesSheet(); + mozilla::StyleSheet* ChromePreferenceSheet(nsPresContext* aPresContext); + mozilla::StyleSheet* ContentPreferenceSheet(nsPresContext* aPresContext); + mozilla::StyleSheet* ContentEditableSheet(); + mozilla::StyleSheet* DesignModeSheet(); static void InvalidatePreferenceSheets(); @@ -75,17 +75,17 @@ class nsLayoutStylesheetCache final void InitFromProfile(); void InitMemoryReporter(); void LoadSheetURL(const char* aURL, - mozilla::StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, mozilla::css::SheetParsingMode aParsingMode); void LoadSheetFile(nsIFile* aFile, - mozilla::StyleSheetHandle::RefPtr* aSheet, + RefPtr* aSheet, mozilla::css::SheetParsingMode aParsingMode); - void LoadSheet(nsIURI* aURI, mozilla::StyleSheetHandle::RefPtr* aSheet, + void LoadSheet(nsIURI* aURI, RefPtr* aSheet, mozilla::css::SheetParsingMode aParsingMode); - static void InvalidateSheet(mozilla::StyleSheetHandle::RefPtr* aGeckoSheet, - mozilla::StyleSheetHandle::RefPtr* aServoSheet); + static void InvalidateSheet(RefPtr* aGeckoSheet, + RefPtr* aServoSheet); static void DependentPrefChanged(const char* aPref, void* aData); - void BuildPreferenceSheet(mozilla::StyleSheetHandle::RefPtr* aSheet, + void BuildPreferenceSheet(RefPtr* aSheet, nsPresContext* aPresContext); static mozilla::StaticRefPtr gStyleCache_Gecko; @@ -93,25 +93,25 @@ class nsLayoutStylesheetCache final static mozilla::StaticRefPtr gCSSLoader_Gecko; static mozilla::StaticRefPtr gCSSLoader_Servo; mozilla::StyleBackendType mBackendType; - mozilla::StyleSheetHandle::RefPtr mChromePreferenceSheet; - mozilla::StyleSheetHandle::RefPtr mContentEditableSheet; - mozilla::StyleSheetHandle::RefPtr mContentPreferenceSheet; - mozilla::StyleSheetHandle::RefPtr mCounterStylesSheet; - mozilla::StyleSheetHandle::RefPtr mDesignModeSheet; - mozilla::StyleSheetHandle::RefPtr mFormsSheet; - mozilla::StyleSheetHandle::RefPtr mHTMLSheet; - mozilla::StyleSheetHandle::RefPtr mMathMLSheet; - mozilla::StyleSheetHandle::RefPtr mMinimalXULSheet; - mozilla::StyleSheetHandle::RefPtr mNoFramesSheet; - mozilla::StyleSheetHandle::RefPtr mNoScriptSheet; - mozilla::StyleSheetHandle::RefPtr mNumberControlSheet; - mozilla::StyleSheetHandle::RefPtr mQuirkSheet; - mozilla::StyleSheetHandle::RefPtr mSVGSheet; - mozilla::StyleSheetHandle::RefPtr mScrollbarsSheet; - mozilla::StyleSheetHandle::RefPtr mUASheet; - mozilla::StyleSheetHandle::RefPtr mUserChromeSheet; - mozilla::StyleSheetHandle::RefPtr mUserContentSheet; - mozilla::StyleSheetHandle::RefPtr mXULSheet; + RefPtr mChromePreferenceSheet; + RefPtr mContentEditableSheet; + RefPtr mContentPreferenceSheet; + RefPtr mCounterStylesSheet; + RefPtr mDesignModeSheet; + RefPtr mFormsSheet; + RefPtr mHTMLSheet; + RefPtr mMathMLSheet; + RefPtr mMinimalXULSheet; + RefPtr mNoFramesSheet; + RefPtr mNoScriptSheet; + RefPtr mNumberControlSheet; + RefPtr mQuirkSheet; + RefPtr mSVGSheet; + RefPtr mScrollbarsSheet; + RefPtr mUASheet; + RefPtr mUserChromeSheet; + RefPtr mUserContentSheet; + RefPtr mXULSheet; }; #endif diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 2e832cb410426..97903ac1eb05c 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -20,8 +20,8 @@ #include "nsIBaseWindow.h" #include "nsIDocument.h" #include "nsContentUtils.h" -#include "mozilla/StyleSheetHandle.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheet.h" +#include "mozilla/StyleSheetInlines.h" using namespace mozilla; diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 52ca8d96ea1d8..8189427c7381b 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -18,7 +18,7 @@ #include "mozilla/EventStates.h" #include "mozilla/MemoryReporting.h" #include "mozilla/RuleProcessorCache.h" -#include "mozilla/StyleSheetHandleInlines.h" +#include "mozilla/StyleSheetInlines.h" #include "nsIDocumentInlines.h" #include "nsRuleWalker.h" #include "nsStyleContext.h" @@ -751,9 +751,9 @@ nsStyleSet::AppendAllXBLStyleSheets(nsTArray& aArray) c // XXXheycam stylo: AppendAllSheets will need to be able to return either // CSSStyleSheets or ServoStyleSheets, on request (and then here requesting // CSSStyleSheets). - AutoTArray sheets; + AutoTArray sheets; mBindingManager->AppendAllSheets(sheets); - for (StyleSheetHandle handle : sheets) { + for (StyleSheet* handle : sheets) { MOZ_ASSERT(handle->IsGecko(), "stylo: AppendAllSheets shouldn't give us " "ServoStyleSheets yet"); aArray.AppendElement(handle->AsGecko()); @@ -2474,12 +2474,12 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets() } if (mBindingManager) { - AutoTArray sheets; + AutoTArray sheets; // XXXheycam stylo: AppendAllSheets will need to be able to return either // CSSStyleSheets or ServoStyleSheets, on request (and then here requesting // CSSStyleSheets). mBindingManager->AppendAllSheets(sheets); - for (StyleSheetHandle sheet : sheets) { + for (StyleSheet* sheet : sheets) { MOZ_ASSERT(sheet->IsGecko(), "stylo: AppendAllSheets shouldn't give us " "ServoStyleSheets yet"); queue.AppendElement(sheet->AsGecko());