diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index b809110b2b..2f24c2856f 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -110,7 +110,7 @@ ShadowRoot::CloneInternalDataFrom(ShadowRoot* aOther) StyleSheet* sheet = aOther->SheetAt(i); if (sheet && sheet->IsApplicable()) { RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, nullptr, nullptr); + sheet->AsConcrete()->Clone(nullptr, nullptr, nullptr, nullptr); if (clonedSheet) { AppendStyleSheet(*clonedSheet); } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index a5b67b6b13..5f1d3a30c0 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1150,7 +1150,7 @@ nsDOMStyleSheetSetList::EnsureFresh() for (size_t index = 0; index < count; index++) { StyleSheet* sheet = mDocument->SheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); - sheet->AsGecko()->GetTitle(title); + sheet->AsConcrete()->GetTitle(title); if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) { return; } @@ -2071,7 +2071,7 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets() if (sheet->IsApplicable()) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveDocStyleSheet(sheet->AsGecko()); + shell->StyleSet()->RemoveDocStyleSheet(sheet->AsConcrete()); } } // XXX Tell observers? @@ -2090,7 +2090,7 @@ nsDocument::RemoveStyleSheetsFromStyleSets( if (sheet->IsApplicable()) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsGecko()); + shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsConcrete()); } } // XXX Tell observers? @@ -2161,7 +2161,7 @@ AppendSheetsToStyleSet(nsStyleSet* aStyleSet, SheetType aType) { for (StyleSheet* sheet : Reversed(aSheets)) { - aStyleSet->AppendStyleSheet(aType, sheet->AsGecko()); + aStyleSet->AppendStyleSheet(aType, sheet->AsConcrete()); } } @@ -2177,21 +2177,21 @@ nsDocument::FillStyleSet(nsStyleSet* aStyleSet) for (StyleSheet* sheet : Reversed(mStyleSheets)) { if (sheet->IsApplicable()) { - aStyleSet->AddDocStyleSheet(sheet->AsGecko(), this); + aStyleSet->AddDocStyleSheet(sheet->AsConcrete(), this); } } nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { - aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko()); + aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsConcrete()); } } // Iterate backwards to maintain order for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) { if (sheet->IsApplicable()) { - aStyleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + aStyleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } @@ -3807,7 +3807,7 @@ nsDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet) // do not override Firefox OS/Mobile's content.css sheet. Maybe we should // have an insertion point to match the order of // nsDocumentViewer::CreateStyleSet though? - shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet->AsGecko()); + shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet->AsConcrete()); } } @@ -3819,7 +3819,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->AddDocStyleSheet(aSheet->AsGecko(), this); + shell->StyleSet()->AddDocStyleSheet(aSheet->AsConcrete(), this); } } @@ -3828,7 +3828,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet) className##Init init; \ init.mBubbles = true; \ init.mCancelable = true; \ - init.mStylesheet = aSheet->AsGecko(); \ + init.mStylesheet = aSheet->AsConcrete(); \ init.memberName = argName; \ \ RefPtr event = \ @@ -3886,7 +3886,7 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet) { nsCOMPtr shell = GetShell(); if (shell) { - shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsGecko()); + shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsConcrete()); } } @@ -4102,7 +4102,7 @@ nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aShee nsCOMPtr shell = GetShell(); if (shell) { SheetType type = ConvertAdditionalSheetType(aType); - shell->StyleSet()->AppendStyleSheet(type, aSheet->AsGecko()); + shell->StyleSet()->AppendStyleSheet(type, aSheet->AsConcrete()); } // Passing false, so documet.styleSheets.length will not be affected by @@ -4130,7 +4130,7 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet nsCOMPtr shell = GetShell(); if (shell) { SheetType type = ConvertAdditionalSheetType(aType); - shell->StyleSet()->RemoveStyleSheet(type, sheetRef->AsGecko()); + shell->StyleSet()->RemoveStyleSheet(type, sheetRef->AsConcrete()); } } @@ -5598,13 +5598,13 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet) NS_ASSERTION(sheet, "Null sheet in sheet list!"); bool disabled; - sheet->AsGecko()->GetDisabled(&disabled); + sheet->AsConcrete()->GetDisabled(&disabled); if (disabled) { // Disabled sheets don't affect the currently selected set continue; } - sheet->AsGecko()->GetTitle(title); + sheet->AsConcrete()->GetTitle(title); if (aSheetSet.IsEmpty()) { aSheetSet = title; @@ -5711,9 +5711,9 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet, StyleSheet* sheet = SheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); - sheet->AsGecko()->GetTitle(title); + sheet->AsConcrete()->GetTitle(title); if (!title.IsEmpty()) { - sheet->AsGecko()->SetEnabled(title.Equals(aSheetSet)); + sheet->AsConcrete()->SetEnabled(title.Equals(aSheetSet)); } } if (aUpdateCSSLoader) { @@ -9434,7 +9434,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) if (sheet) { if (sheet->IsApplicable()) { RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); + sheet->AsConcrete()->Clone(nullptr, nullptr, clonedDoc, nullptr); NS_WARNING_ASSERTION(clonedSheet, "Cloning a stylesheet didn't work!"); if (clonedSheet) { @@ -9449,7 +9449,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) if (sheet) { if (sheet->IsApplicable()) { RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); + sheet->AsConcrete()->Clone(nullptr, nullptr, clonedDoc, nullptr); NS_WARNING_ASSERTION(clonedSheet, "Cloning a stylesheet didn't work!"); if (clonedSheet) { diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index 707d36a510..7a0a563350 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -321,7 +321,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument, Element* oldScopeElement = nullptr; if (mStyleSheet) { - oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement(); + oldScopeElement = mStyleSheet->AsConcrete()->GetScopeElement(); } if (mStyleSheet && (aOldDocument || aOldShadowRoot)) { @@ -483,7 +483,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped) return; } - CSSStyleSheet* sheet = mStyleSheet->AsGecko(); + CSSStyleSheet* sheet = mStyleSheet->AsConcrete(); nsCOMPtr thisContent; CallQueryInterface(this, getter_AddRefs(thisContent)); diff --git a/dom/xbl/nsXBLPrototypeResources.cpp b/dom/xbl/nsXBLPrototypeResources.cpp index bbeb44362b..c69b6e2988 100644 --- a/dom/xbl/nsXBLPrototypeResources.cpp +++ b/dom/xbl/nsXBLPrototypeResources.cpp @@ -147,7 +147,7 @@ nsXBLPrototypeResources::GatherRuleProcessor() { nsTArray> sheets(mStyleSheetList.Length()); for (StyleSheet* sheet : mStyleSheetList) { - sheets.AppendElement(sheet->AsGecko()); + sheets.AppendElement(sheet->AsConcrete()); } mRuleProcessor = new nsCSSRuleProcessor(Move(sheets), SheetType::Doc, diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index f73c2cbba0..cddf9b749d 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -2907,7 +2907,7 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL, nsCOMPtr document = GetDocument(); sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument); - return sheet->AsGecko()->SetDisabled(!aEnable); + return sheet->AsConcrete()->SetDisabled(!aEnable); } bool @@ -2924,7 +2924,7 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL) nsCOMPtr document = GetDocument(); sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument); - sheet->AsGecko()->SetDisabled(false); + sheet->AsConcrete()->SetDisabled(false); return true; } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 75d42ebe04..ac48fa6656 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2306,7 +2306,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) } if (sheet) - styleSet->AppendStyleSheet(SheetType::User, sheet->AsGecko()); + styleSet->AppendStyleSheet(SheetType::User, sheet->AsConcrete()); // Append chrome sheets (scrollbars + forms). bool shouldOverride = false; @@ -2342,7 +2342,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) cssLoader->LoadSheetSync(uri, &chromeSheet); if (!chromeSheet) continue; - styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsConcrete()); shouldOverride = true; } free(str); @@ -2353,7 +2353,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) if (!shouldOverride) { sheet = cache->ScrollbarsSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } @@ -2369,12 +2369,12 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) sheet = cache->NumberControlSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } sheet = cache->FormsSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } if (aDocument->LoadsFullXULStyleSheetUpFront()) { @@ -2382,7 +2382,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) // up-front here. sheet = cache->XULSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } @@ -2390,25 +2390,25 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) if (sheet) { // Load the minimal XUL rules for scrollbars and a few other XUL things // that non-XUL (typically HTML) documents commonly use. - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } sheet = cache->CounterStylesSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) { sheet = cache->NoScriptSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) { sheet = cache->NoFramesSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } @@ -2417,26 +2417,26 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument) sheet = cache->HTMLSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } styleSet->PrependStyleSheet(SheetType::Agent, - cache->UASheet()->AsGecko()); + cache->UASheet()->AsConcrete()); } else { // SVG documents may have scrollbars and need the scrollbar styling. sheet = cache->MinimalXULSheet(); if (sheet) { - styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete()); } } nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) { - styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete()); } for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) { - styleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko()); + styleSet->PrependStyleSheet(SheetType::User, sheet->AsConcrete()); } } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 65f221a8ae..ff7cefb111 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1146,11 +1146,11 @@ nsPresContext::CompatibilityModeChanged() if (needsQuirkSheet) { // quirk.css needs to come after html.css; we just keep it at the end. DebugOnly rv = - styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete()); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css"); } else { DebugOnly rv = - styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsGecko()); + styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsConcrete()); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css"); } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 0a9627bc9b..713b06cb96 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1397,7 +1397,7 @@ PresShell::UpdatePreferenceStyles() RemovePreferenceStyles(); - mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsGecko()); + mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsConcrete()); mPrefStyleSheet = newPrefSheet; mStyleSet->EndUpdate(); @@ -1407,7 +1407,7 @@ void PresShell::RemovePreferenceStyles() { if (mPrefStyleSheet) { - mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsGecko()); + mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsConcrete()); mPrefStyleSheet = nullptr; } } @@ -1430,13 +1430,13 @@ PresShell::AddUserSheet(nsISupports* aSheet) // Iterate forwards when removing so the searches for RemoveStyleSheet are as // short as possible. for (StyleSheet* sheet : userSheets) { - mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsGecko()); + mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsConcrete()); } // Now iterate backwards, so that the order of userSheets will be the same as // the order of sheets from it in the style set. for (StyleSheet* sheet : Reversed(userSheets)) { - mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko()); + mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsConcrete()); } mStyleSet->EndUpdate(); @@ -1454,7 +1454,7 @@ PresShell::AddAgentSheet(nsISupports* aSheet) return; } - mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko()); + mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete()); RestyleForCSSRuleChanges(); } @@ -1471,9 +1471,9 @@ PresShell::AddAuthorSheet(nsISupports* aSheet) StyleSheet* firstAuthorSheet = mDocument->GetFirstAdditionalAuthorSheet(); if (firstAuthorSheet) { - mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsGecko(), firstAuthorSheet->AsGecko()); + mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsConcrete(), firstAuthorSheet->AsConcrete()); } else { - mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko()); + mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsConcrete()); } RestyleForCSSRuleChanges(); @@ -1487,7 +1487,7 @@ PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet) return; } - mStyleSet->RemoveStyleSheet(aType, sheet->AsGecko()); + mStyleSet->RemoveStyleSheet(aType, sheet->AsConcrete()); RestyleForCSSRuleChanges(); } @@ -4471,7 +4471,7 @@ PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet) if (mStylesHaveChanged) return; - Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement(); + Element* scopeElement = aStyleSheet->AsConcrete()->GetScopeElement(); if (scopeElement) { mChangedScopeStyleRoots.AppendElement(scopeElement); return; @@ -8771,7 +8771,7 @@ PresShell::SetAgentStyleSheets(const nsTArray>& aSheets) { nsTArray> newSheets(aSheets.Length()); for (auto& sheet : aSheets) { - newSheets.AppendElement(sheet->AsGecko()); + newSheets.AppendElement(sheet->AsConcrete()); } return mStyleSet->ReplaceSheets(SheetType::Agent, newSheets); } @@ -8779,13 +8779,13 @@ PresShell::SetAgentStyleSheets(const nsTArray>& aSheets) nsresult PresShell::AddOverrideStyleSheet(StyleSheet* aSheet) { - return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsGecko()); + return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsConcrete()); } nsresult PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet) { - return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsGecko()); + return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsConcrete()); } static void diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index 6ff54462ee..ac2d430552 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -177,7 +177,7 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI, // mSheets[aSheetType] StyleSheet* sheet = mSheets[aSheetType].LastElement(); - CSSStyleSheet* cssSheet = sheet->AsGecko(); + CSSStyleSheet* cssSheet = sheet->AsConcrete(); serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet), message, nullptr); } @@ -283,7 +283,7 @@ nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType, nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet); NS_ENSURE_SUCCESS(rv, rv); - RefPtr cssSheet = sheet->AsGecko(); + RefPtr cssSheet = sheet->AsConcrete(); cssSheet.forget(aSheet); return NS_OK; @@ -317,7 +317,7 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType) nsCOMPtr serv = services::GetObserverService(); if (serv) { - CSSStyleSheet* cssSheet = sheet->AsGecko(); + CSSStyleSheet* cssSheet = sheet->AsConcrete(); serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet), message, nullptr); } diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 1cb99ec001..5b8a9912fc 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -1929,7 +1929,7 @@ CSSStyleSheet::StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate, nsresult aStatus) { - CSSStyleSheet* sheet = aSheet->AsGecko(); + CSSStyleSheet* sheet = aSheet->AsConcrete(); if (sheet->GetParentSheet() == nullptr) { return NS_OK; // ignore if sheet has been detached already (see parseSheet) diff --git a/layout/style/DeprecatedUtils.h b/layout/style/DeprecatedUtils.h deleted file mode 100644 index 0484b6dbb3..0000000000 --- a/layout/style/DeprecatedUtils.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* some deprecated utilities */ - -#ifndef mozilla_DeprecatedUtils_h -#define mozilla_DeprecatedUtils_h - -#include "mozilla/TypeTraits.h" - -/** - * Macro used in a base class of |geckotype_|. - */ -#define MOZ_DECL_DEPRECATED_METHODS(geckotype_) \ - inline geckotype_* AsGecko(); \ - inline const geckotype_* AsGecko() const; - -/** - * Macro used in inline header of class |type_| with its Gecko - * subclass named |geckotype_| for implementing the inline methods - * defined by MOZ_DECL_DEPRECATED_METHODS. - */ -#define MOZ_DEFINE_DEPRECATED_METHODS(type_, geckotype_) \ - geckotype_* type_::AsGecko() { \ - return static_cast(this); \ - } \ - const geckotype_* type_::AsGecko() const { \ - return static_cast(this); \ - } - -#endif // mozilla_DeprecatedUtils_h diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index f7777a1fa8..4e1a1d6fe1 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1130,11 +1130,11 @@ Loader::CreateSheet(nsIURI* aURI, if (sheet) { // This sheet came from the XUL cache or our per-document hashtable; it // better be a complete sheet. - NS_ASSERTION(sheet->AsGecko()->IsComplete(), + NS_ASSERTION(sheet->AsConcrete()->IsComplete(), "Sheet thinks it's not complete while we think it is"); // Make sure it hasn't been modified; if it has, we can't use it - if (sheet->AsGecko()->IsModified()) { + if (sheet->AsConcrete()->IsModified()) { LOG((" Not cloning completed sheet %p because it's been modified", sheet.get())); sheet = nullptr; @@ -1187,25 +1187,25 @@ Loader::CreateSheet(nsIURI* aURI, if (sheet) { // The sheet we have now should be either incomplete or unmodified - NS_ASSERTION(!sheet->AsGecko()->IsModified() || - !sheet->AsGecko()->IsComplete(), + NS_ASSERTION(!sheet->AsConcrete()->IsModified() || + !sheet->AsConcrete()->IsComplete(), "Unexpected modified complete sheet"); - NS_ASSERTION(sheet->AsGecko()->IsComplete() || + NS_ASSERTION(sheet->AsConcrete()->IsComplete() || aSheetState != eSheetComplete, "Sheet thinks it's not complete while we think it is"); RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, nullptr, nullptr); + sheet->AsConcrete()->Clone(nullptr, nullptr, nullptr, nullptr); *aSheet = Move(clonedSheet); if (*aSheet && fromCompleteSheets && - !sheet->AsGecko()->GetOwnerNode() && - !sheet->AsGecko()->GetParentSheet()) { + !sheet->AsConcrete()->GetOwnerNode() && + !sheet->AsConcrete()->GetParentSheet()) { // The sheet we're cloning isn't actually referenced by // anyone. Replace it in the cache, so that if our CSSOM is // later modified we don't end up with two copies of our inner // hanging around. URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode, aReferrerPolicy); - NS_ASSERTION((*aSheet)->AsGecko()->IsComplete(), + NS_ASSERTION((*aSheet)->AsConcrete()->IsComplete(), "Should only be caching complete sheets"); mSheets->mCompleteSheets.Put(&key, *aSheet); } @@ -1270,7 +1270,7 @@ Loader::PrepareSheet(StyleSheet* aSheet, { NS_PRECONDITION(aSheet, "Must have a sheet!"); - CSSStyleSheet* sheet = aSheet->AsGecko(); + CSSStyleSheet* sheet = aSheet->AsConcrete(); RefPtr mediaList(aMediaList); @@ -1397,10 +1397,10 @@ Loader::InsertChildSheet(StyleSheet* aSheet, // child sheets should always start out enabled, even if they got // cloned off of top-level sheets which were disabled - aSheet->AsGecko()->SetEnabled(true); + aSheet->AsConcrete()->SetEnabled(true); aParentSheet->AppendStyleSheet(aSheet); - aParentRule->SetSheet(aSheet->AsGecko()); // This sets the ownerRule on the sheet + aParentRule->SetSheet(aSheet->AsConcrete()); // This sets the ownerRule on the sheet LOG((" Inserting into parent sheet")); // LOG((" Inserting into parent sheet at position %d", insertionPoint)); @@ -1741,7 +1741,7 @@ Loader::ParseSheet(const nsAString& aInput, nsresult rv; - nsCSSParser parser(this, aLoadData->mSheet->AsGecko()); + nsCSSParser parser(this, aLoadData->mSheet->AsConcrete()); rv = parser.ParseSheet(aInput, sheetURI, baseURI, aLoadData->mSheet->Principal(), aLoadData->mLineNumber); @@ -1857,7 +1857,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus, // If mSheetAlreadyComplete, then the sheet could well be modified between // when we posted the async call to SheetComplete and now, since the sheet // was page-accessible during that whole time. - MOZ_ASSERT(!data->mSheet->AsGecko()->IsModified(), + MOZ_ASSERT(!data->mSheet->AsConcrete()->IsModified(), "should not get marked modified during parsing"); data->mSheet->SetComplete(); data->ScheduleLoadEventIfNeeded(aStatus); @@ -1899,10 +1899,10 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus, // parent sheet anyway, so that if someone then accesses it via // CSSOM we won't have extra clones of the inner lying around. data = aLoadData; - CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko(); + CSSStyleSheet* sheet = aLoadData->mSheet->AsConcrete(); while (data) { if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) { - sheet = data->mSheet->AsGecko(); + sheet = data->mSheet->AsConcrete(); break; } data = data->mNext; @@ -2216,7 +2216,7 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet, LOG((" No parent load; must be CSSOM")); // No parent load data, so the sheet will need to be notified when // we finish, if it can be, if we do the load asynchronously. - observer = aParentSheet->AsGecko(); + observer = aParentSheet->AsConcrete(); } // Now that we know it's safe to load this (passes security check and not a @@ -2583,7 +2583,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Loader) !iter.Done(); iter.Next()) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader"); - CSSStyleSheet* sheet = iter.UserData()->AsGecko(); + CSSStyleSheet* sheet = iter.UserData()->AsConcrete(); cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet)); } } diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index fcf23b8559..adcd0fc01b 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -79,7 +79,7 @@ StyleSheet::IsComplete() const void StyleSheet::SetComplete() { - NS_ASSERTION(!AsGecko()->mDirty, + NS_ASSERTION(!AsConcrete()->mDirty, "Can't set a dirty sheet complete!"); SheetInfo().mComplete = true; if (mDocument && !mDisabled) { @@ -135,7 +135,7 @@ StyleSheet::SetDisabled(bool aDisabled) { // DOM method, so handle BeginUpdate/EndUpdate MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true); - AsGecko()->SetEnabled(!aDisabled); + AsConcrete()->SetEnabled(!aDisabled); return NS_OK; } @@ -229,7 +229,7 @@ StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal, if (!AreRulesAvailable(aSubjectPrincipal, aRv)) { return nullptr; } - return AsGecko()->GetCssRulesInternal(aRv); + return AsConcrete()->GetCssRulesInternal(aRv); } uint32_t @@ -240,7 +240,7 @@ StyleSheet::InsertRule(const nsAString& aRule, uint32_t aIndex, if (!AreRulesAvailable(aSubjectPrincipal, aRv)) { return 0; } - return AsGecko()->InsertRuleInternal(aRule, aIndex, aRv); + return AsConcrete()->InsertRuleInternal(aRule, aIndex, aRv); } void @@ -251,7 +251,7 @@ StyleSheet::DeleteRule(uint32_t aIndex, if (!AreRulesAvailable(aSubjectPrincipal, aRv)) { return; } - AsGecko()->DeleteRuleInternal(aIndex, aRv); + AsConcrete()->DeleteRuleInternal(aIndex, aRv); } int32_t @@ -275,7 +275,7 @@ StyleSheet::AddRule(const nsAString& aSelector, const nsAString& aBlock, auto index = aIndex.WasPassed() ? aIndex.Value() : GetCssRules(aSubjectPrincipal, aRv)->Length(); - return AsGecko()->InsertRuleInternal(rule, index, aRv); + return AsConcrete()->InsertRuleInternal(rule, index, aRv); // As per Microsoft documentation, always return -1. return -1; } diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index cf03b510e6..bbd455a02b 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -10,7 +10,6 @@ #include "mozilla/dom/CSSStyleSheetBinding.h" #include "mozilla/net/ReferrerPolicy.h" #include "mozilla/CORSMode.h" -#include "mozilla/DeprecatedUtils.h" #include "nsIDOMCSSStyleSheet.h" #include "nsWrapperCache.h" @@ -64,7 +63,8 @@ public: bool IsComplete() const; void SetComplete(); - MOZ_DECL_DEPRECATED_METHODS(CSSStyleSheet) + inline CSSStyleSheet* AsConcrete(); + inline const CSSStyleSheet* AsConcrete() const; // Whether the sheet is for an inline