mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 04:17:31 +09:00
Issue #2488 - Part 6: Define and declare CSSStyleSheet cast functions directly in StyleSheet
This renames AsGecko calls to AsConcrete and removes the header containing leftover Stylo macros.
This commit is contained in:
parent
81f77f18a0
commit
f0116f51db
18 changed files with 109 additions and 134 deletions
|
|
@ -110,7 +110,7 @@ ShadowRoot::CloneInternalDataFrom(ShadowRoot* aOther)
|
||||||
StyleSheet* sheet = aOther->SheetAt(i);
|
StyleSheet* sheet = aOther->SheetAt(i);
|
||||||
if (sheet && sheet->IsApplicable()) {
|
if (sheet && sheet->IsApplicable()) {
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, nullptr, nullptr);
|
sheet->AsConcrete()->Clone(nullptr, nullptr, nullptr, nullptr);
|
||||||
if (clonedSheet) {
|
if (clonedSheet) {
|
||||||
AppendStyleSheet(*clonedSheet);
|
AppendStyleSheet(*clonedSheet);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1150,7 +1150,7 @@ nsDOMStyleSheetSetList::EnsureFresh()
|
||||||
for (size_t index = 0; index < count; index++) {
|
for (size_t index = 0; index < count; index++) {
|
||||||
StyleSheet* sheet = mDocument->SheetAt(index);
|
StyleSheet* sheet = mDocument->SheetAt(index);
|
||||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
sheet->AsGecko()->GetTitle(title);
|
sheet->AsConcrete()->GetTitle(title);
|
||||||
if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
|
if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2071,7 +2071,7 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets()
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->StyleSet()->RemoveDocStyleSheet(sheet->AsGecko());
|
shell->StyleSet()->RemoveDocStyleSheet(sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XXX Tell observers?
|
// XXX Tell observers?
|
||||||
|
|
@ -2090,7 +2090,7 @@ nsDocument::RemoveStyleSheetsFromStyleSets(
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsGecko());
|
shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XXX Tell observers?
|
// XXX Tell observers?
|
||||||
|
|
@ -2161,7 +2161,7 @@ AppendSheetsToStyleSet(nsStyleSet* aStyleSet,
|
||||||
SheetType aType)
|
SheetType aType)
|
||||||
{
|
{
|
||||||
for (StyleSheet* sheet : Reversed(aSheets)) {
|
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)) {
|
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
aStyleSet->AddDocStyleSheet(sheet->AsGecko(), this);
|
aStyleSet->AddDocStyleSheet(sheet->AsConcrete(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
|
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
|
||||||
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko());
|
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate backwards to maintain order
|
// Iterate backwards to maintain order
|
||||||
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
|
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
|
||||||
if (sheet->IsApplicable()) {
|
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
|
// do not override Firefox OS/Mobile's content.css sheet. Maybe we should
|
||||||
// have an insertion point to match the order of
|
// have an insertion point to match the order of
|
||||||
// nsDocumentViewer::CreateStyleSet though?
|
// 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<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
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; \
|
className##Init init; \
|
||||||
init.mBubbles = true; \
|
init.mBubbles = true; \
|
||||||
init.mCancelable = true; \
|
init.mCancelable = true; \
|
||||||
init.mStylesheet = aSheet->AsGecko(); \
|
init.mStylesheet = aSheet->AsConcrete(); \
|
||||||
init.memberName = argName; \
|
init.memberName = argName; \
|
||||||
\
|
\
|
||||||
RefPtr<className> event = \
|
RefPtr<className> event = \
|
||||||
|
|
@ -3886,7 +3886,7 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsGecko());
|
shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4102,7 +4102,7 @@ nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aShee
|
||||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
SheetType type = ConvertAdditionalSheetType(aType);
|
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
|
// Passing false, so documet.styleSheets.length will not be affected by
|
||||||
|
|
@ -4130,7 +4130,7 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
|
||||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
SheetType type = ConvertAdditionalSheetType(aType);
|
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!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
|
|
||||||
bool disabled;
|
bool disabled;
|
||||||
sheet->AsGecko()->GetDisabled(&disabled);
|
sheet->AsConcrete()->GetDisabled(&disabled);
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
// Disabled sheets don't affect the currently selected set
|
// Disabled sheets don't affect the currently selected set
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sheet->AsGecko()->GetTitle(title);
|
sheet->AsConcrete()->GetTitle(title);
|
||||||
|
|
||||||
if (aSheetSet.IsEmpty()) {
|
if (aSheetSet.IsEmpty()) {
|
||||||
aSheetSet = title;
|
aSheetSet = title;
|
||||||
|
|
@ -5711,9 +5711,9 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
|
||||||
StyleSheet* sheet = SheetAt(index);
|
StyleSheet* sheet = SheetAt(index);
|
||||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
|
|
||||||
sheet->AsGecko()->GetTitle(title);
|
sheet->AsConcrete()->GetTitle(title);
|
||||||
if (!title.IsEmpty()) {
|
if (!title.IsEmpty()) {
|
||||||
sheet->AsGecko()->SetEnabled(title.Equals(aSheetSet));
|
sheet->AsConcrete()->SetEnabled(title.Equals(aSheetSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aUpdateCSSLoader) {
|
if (aUpdateCSSLoader) {
|
||||||
|
|
@ -9434,7 +9434,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
sheet->AsConcrete()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
||||||
NS_WARNING_ASSERTION(clonedSheet,
|
NS_WARNING_ASSERTION(clonedSheet,
|
||||||
"Cloning a stylesheet didn't work!");
|
"Cloning a stylesheet didn't work!");
|
||||||
if (clonedSheet) {
|
if (clonedSheet) {
|
||||||
|
|
@ -9449,7 +9449,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
sheet->AsConcrete()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
||||||
NS_WARNING_ASSERTION(clonedSheet,
|
NS_WARNING_ASSERTION(clonedSheet,
|
||||||
"Cloning a stylesheet didn't work!");
|
"Cloning a stylesheet didn't work!");
|
||||||
if (clonedSheet) {
|
if (clonedSheet) {
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||||
|
|
||||||
Element* oldScopeElement = nullptr;
|
Element* oldScopeElement = nullptr;
|
||||||
if (mStyleSheet) {
|
if (mStyleSheet) {
|
||||||
oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
|
oldScopeElement = mStyleSheet->AsConcrete()->GetScopeElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
|
if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
|
||||||
|
|
@ -483,7 +483,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSSStyleSheet* sheet = mStyleSheet->AsGecko();
|
CSSStyleSheet* sheet = mStyleSheet->AsConcrete();
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> thisContent;
|
nsCOMPtr<nsIContent> thisContent;
|
||||||
CallQueryInterface(this, getter_AddRefs(thisContent));
|
CallQueryInterface(this, getter_AddRefs(thisContent));
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ nsXBLPrototypeResources::GatherRuleProcessor()
|
||||||
{
|
{
|
||||||
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
|
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
|
||||||
for (StyleSheet* sheet : mStyleSheetList) {
|
for (StyleSheet* sheet : mStyleSheetList) {
|
||||||
sheets.AppendElement(sheet->AsGecko());
|
sheets.AppendElement(sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
|
mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
|
||||||
SheetType::Doc,
|
SheetType::Doc,
|
||||||
|
|
|
||||||
|
|
@ -2907,7 +2907,7 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL,
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
||||||
|
|
||||||
return sheet->AsGecko()->SetDisabled(!aEnable);
|
return sheet->AsConcrete()->SetDisabled(!aEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -2924,7 +2924,7 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
||||||
|
|
||||||
sheet->AsGecko()->SetDisabled(false);
|
sheet->AsConcrete()->SetDisabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2306,7 +2306,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sheet)
|
if (sheet)
|
||||||
styleSet->AppendStyleSheet(SheetType::User, sheet->AsGecko());
|
styleSet->AppendStyleSheet(SheetType::User, sheet->AsConcrete());
|
||||||
|
|
||||||
// Append chrome sheets (scrollbars + forms).
|
// Append chrome sheets (scrollbars + forms).
|
||||||
bool shouldOverride = false;
|
bool shouldOverride = false;
|
||||||
|
|
@ -2342,7 +2342,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
cssLoader->LoadSheetSync(uri, &chromeSheet);
|
cssLoader->LoadSheetSync(uri, &chromeSheet);
|
||||||
if (!chromeSheet) continue;
|
if (!chromeSheet) continue;
|
||||||
|
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsConcrete());
|
||||||
shouldOverride = true;
|
shouldOverride = true;
|
||||||
}
|
}
|
||||||
free(str);
|
free(str);
|
||||||
|
|
@ -2353,7 +2353,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
if (!shouldOverride) {
|
if (!shouldOverride) {
|
||||||
sheet = cache->ScrollbarsSheet();
|
sheet = cache->ScrollbarsSheet();
|
||||||
if (sheet) {
|
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();
|
sheet = cache->NumberControlSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
sheet = cache->FormsSheet();
|
sheet = cache->FormsSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aDocument->LoadsFullXULStyleSheetUpFront()) {
|
if (aDocument->LoadsFullXULStyleSheetUpFront()) {
|
||||||
|
|
@ -2382,7 +2382,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
// up-front here.
|
// up-front here.
|
||||||
sheet = cache->XULSheet();
|
sheet = cache->XULSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2390,25 +2390,25 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
// Load the minimal XUL rules for scrollbars and a few other XUL things
|
// Load the minimal XUL rules for scrollbars and a few other XUL things
|
||||||
// that non-XUL (typically HTML) documents commonly use.
|
// that non-XUL (typically HTML) documents commonly use.
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
sheet = cache->CounterStylesSheet();
|
sheet = cache->CounterStylesSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) {
|
if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) {
|
||||||
sheet = cache->NoScriptSheet();
|
sheet = cache->NoScriptSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) {
|
if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) {
|
||||||
sheet = cache->NoFramesSheet();
|
sheet = cache->NoFramesSheet();
|
||||||
if (sheet) {
|
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();
|
sheet = cache->HTMLSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent,
|
styleSet->PrependStyleSheet(SheetType::Agent,
|
||||||
cache->UASheet()->AsGecko());
|
cache->UASheet()->AsConcrete());
|
||||||
} else {
|
} else {
|
||||||
// SVG documents may have scrollbars and need the scrollbar styling.
|
// SVG documents may have scrollbars and need the scrollbar styling.
|
||||||
sheet = cache->MinimalXULSheet();
|
sheet = cache->MinimalXULSheet();
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
||||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
|
for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
|
||||||
styleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko());
|
styleSet->PrependStyleSheet(SheetType::User, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1146,11 +1146,11 @@ nsPresContext::CompatibilityModeChanged()
|
||||||
if (needsQuirkSheet) {
|
if (needsQuirkSheet) {
|
||||||
// quirk.css needs to come after html.css; we just keep it at the end.
|
// quirk.css needs to come after html.css; we just keep it at the end.
|
||||||
DebugOnly<nsresult> rv =
|
DebugOnly<nsresult> rv =
|
||||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
|
||||||
} else {
|
} else {
|
||||||
DebugOnly<nsresult> rv =
|
DebugOnly<nsresult> rv =
|
||||||
styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsGecko());
|
styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1397,7 +1397,7 @@ PresShell::UpdatePreferenceStyles()
|
||||||
|
|
||||||
RemovePreferenceStyles();
|
RemovePreferenceStyles();
|
||||||
|
|
||||||
mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsGecko());
|
mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsConcrete());
|
||||||
mPrefStyleSheet = newPrefSheet;
|
mPrefStyleSheet = newPrefSheet;
|
||||||
|
|
||||||
mStyleSet->EndUpdate();
|
mStyleSet->EndUpdate();
|
||||||
|
|
@ -1407,7 +1407,7 @@ void
|
||||||
PresShell::RemovePreferenceStyles()
|
PresShell::RemovePreferenceStyles()
|
||||||
{
|
{
|
||||||
if (mPrefStyleSheet) {
|
if (mPrefStyleSheet) {
|
||||||
mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsGecko());
|
mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsConcrete());
|
||||||
mPrefStyleSheet = nullptr;
|
mPrefStyleSheet = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1430,13 +1430,13 @@ PresShell::AddUserSheet(nsISupports* aSheet)
|
||||||
// Iterate forwards when removing so the searches for RemoveStyleSheet are as
|
// Iterate forwards when removing so the searches for RemoveStyleSheet are as
|
||||||
// short as possible.
|
// short as possible.
|
||||||
for (StyleSheet* sheet : userSheets) {
|
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
|
// Now iterate backwards, so that the order of userSheets will be the same as
|
||||||
// the order of sheets from it in the style set.
|
// the order of sheets from it in the style set.
|
||||||
for (StyleSheet* sheet : Reversed(userSheets)) {
|
for (StyleSheet* sheet : Reversed(userSheets)) {
|
||||||
mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko());
|
mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
mStyleSet->EndUpdate();
|
mStyleSet->EndUpdate();
|
||||||
|
|
@ -1454,7 +1454,7 @@ PresShell::AddAgentSheet(nsISupports* aSheet)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsConcrete());
|
||||||
RestyleForCSSRuleChanges();
|
RestyleForCSSRuleChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1471,9 +1471,9 @@ PresShell::AddAuthorSheet(nsISupports* aSheet)
|
||||||
StyleSheet* firstAuthorSheet =
|
StyleSheet* firstAuthorSheet =
|
||||||
mDocument->GetFirstAdditionalAuthorSheet();
|
mDocument->GetFirstAdditionalAuthorSheet();
|
||||||
if (firstAuthorSheet) {
|
if (firstAuthorSheet) {
|
||||||
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsGecko(), firstAuthorSheet->AsGecko());
|
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsConcrete(), firstAuthorSheet->AsConcrete());
|
||||||
} else {
|
} else {
|
||||||
mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko());
|
mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
RestyleForCSSRuleChanges();
|
RestyleForCSSRuleChanges();
|
||||||
|
|
@ -1487,7 +1487,7 @@ PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStyleSet->RemoveStyleSheet(aType, sheet->AsGecko());
|
mStyleSet->RemoveStyleSheet(aType, sheet->AsConcrete());
|
||||||
RestyleForCSSRuleChanges();
|
RestyleForCSSRuleChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4471,7 +4471,7 @@ PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet)
|
||||||
if (mStylesHaveChanged)
|
if (mStylesHaveChanged)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement();
|
Element* scopeElement = aStyleSheet->AsConcrete()->GetScopeElement();
|
||||||
if (scopeElement) {
|
if (scopeElement) {
|
||||||
mChangedScopeStyleRoots.AppendElement(scopeElement);
|
mChangedScopeStyleRoots.AppendElement(scopeElement);
|
||||||
return;
|
return;
|
||||||
|
|
@ -8771,7 +8771,7 @@ PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
|
||||||
{
|
{
|
||||||
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aSheets.Length());
|
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aSheets.Length());
|
||||||
for (auto& sheet : aSheets) {
|
for (auto& sheet : aSheets) {
|
||||||
newSheets.AppendElement(sheet->AsGecko());
|
newSheets.AppendElement(sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
return mStyleSet->ReplaceSheets(SheetType::Agent, newSheets);
|
return mStyleSet->ReplaceSheets(SheetType::Agent, newSheets);
|
||||||
}
|
}
|
||||||
|
|
@ -8779,13 +8779,13 @@ PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
|
||||||
nsresult
|
nsresult
|
||||||
PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
|
PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsGecko());
|
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
|
PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsGecko());
|
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
|
||||||
// mSheets[aSheetType]
|
// mSheets[aSheetType]
|
||||||
|
|
||||||
StyleSheet* sheet = mSheets[aSheetType].LastElement();
|
StyleSheet* sheet = mSheets[aSheetType].LastElement();
|
||||||
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
CSSStyleSheet* cssSheet = sheet->AsConcrete();
|
||||||
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
||||||
message, nullptr);
|
message, nullptr);
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +283,7 @@ nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType,
|
||||||
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
|
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
RefPtr<CSSStyleSheet> cssSheet = sheet->AsGecko();
|
RefPtr<CSSStyleSheet> cssSheet = sheet->AsConcrete();
|
||||||
cssSheet.forget(aSheet);
|
cssSheet.forget(aSheet);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -317,7 +317,7 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
||||||
if (serv) {
|
if (serv) {
|
||||||
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
CSSStyleSheet* cssSheet = sheet->AsConcrete();
|
||||||
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
||||||
message, nullptr);
|
message, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1929,7 +1929,7 @@ CSSStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
|
||||||
bool aWasAlternate,
|
bool aWasAlternate,
|
||||||
nsresult aStatus)
|
nsresult aStatus)
|
||||||
{
|
{
|
||||||
CSSStyleSheet* sheet = aSheet->AsGecko();
|
CSSStyleSheet* sheet = aSheet->AsConcrete();
|
||||||
|
|
||||||
if (sheet->GetParentSheet() == nullptr) {
|
if (sheet->GetParentSheet() == nullptr) {
|
||||||
return NS_OK; // ignore if sheet has been detached already (see parseSheet)
|
return NS_OK; // ignore if sheet has been detached already (see parseSheet)
|
||||||
|
|
|
||||||
|
|
@ -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<geckotype_*>(this); \
|
|
||||||
} \
|
|
||||||
const geckotype_* type_::AsGecko() const { \
|
|
||||||
return static_cast<const geckotype_*>(this); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // mozilla_DeprecatedUtils_h
|
|
||||||
|
|
@ -1130,11 +1130,11 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
// This sheet came from the XUL cache or our per-document hashtable; it
|
// This sheet came from the XUL cache or our per-document hashtable; it
|
||||||
// better be a complete sheet.
|
// 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");
|
"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
|
// 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",
|
LOG((" Not cloning completed sheet %p because it's been modified",
|
||||||
sheet.get()));
|
sheet.get()));
|
||||||
sheet = nullptr;
|
sheet = nullptr;
|
||||||
|
|
@ -1187,25 +1187,25 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||||
|
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
// The sheet we have now should be either incomplete or unmodified
|
// The sheet we have now should be either incomplete or unmodified
|
||||||
NS_ASSERTION(!sheet->AsGecko()->IsModified() ||
|
NS_ASSERTION(!sheet->AsConcrete()->IsModified() ||
|
||||||
!sheet->AsGecko()->IsComplete(),
|
!sheet->AsConcrete()->IsComplete(),
|
||||||
"Unexpected modified complete sheet");
|
"Unexpected modified complete sheet");
|
||||||
NS_ASSERTION(sheet->AsGecko()->IsComplete() ||
|
NS_ASSERTION(sheet->AsConcrete()->IsComplete() ||
|
||||||
aSheetState != eSheetComplete,
|
aSheetState != eSheetComplete,
|
||||||
"Sheet thinks it's not complete while we think it is");
|
"Sheet thinks it's not complete while we think it is");
|
||||||
|
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, nullptr, nullptr);
|
sheet->AsConcrete()->Clone(nullptr, nullptr, nullptr, nullptr);
|
||||||
*aSheet = Move(clonedSheet);
|
*aSheet = Move(clonedSheet);
|
||||||
if (*aSheet && fromCompleteSheets &&
|
if (*aSheet && fromCompleteSheets &&
|
||||||
!sheet->AsGecko()->GetOwnerNode() &&
|
!sheet->AsConcrete()->GetOwnerNode() &&
|
||||||
!sheet->AsGecko()->GetParentSheet()) {
|
!sheet->AsConcrete()->GetParentSheet()) {
|
||||||
// The sheet we're cloning isn't actually referenced by
|
// The sheet we're cloning isn't actually referenced by
|
||||||
// anyone. Replace it in the cache, so that if our CSSOM is
|
// 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
|
// later modified we don't end up with two copies of our inner
|
||||||
// hanging around.
|
// hanging around.
|
||||||
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode, aReferrerPolicy);
|
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode, aReferrerPolicy);
|
||||||
NS_ASSERTION((*aSheet)->AsGecko()->IsComplete(),
|
NS_ASSERTION((*aSheet)->AsConcrete()->IsComplete(),
|
||||||
"Should only be caching complete sheets");
|
"Should only be caching complete sheets");
|
||||||
mSheets->mCompleteSheets.Put(&key, *aSheet);
|
mSheets->mCompleteSheets.Put(&key, *aSheet);
|
||||||
}
|
}
|
||||||
|
|
@ -1270,7 +1270,7 @@ Loader::PrepareSheet(StyleSheet* aSheet,
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aSheet, "Must have a sheet!");
|
NS_PRECONDITION(aSheet, "Must have a sheet!");
|
||||||
|
|
||||||
CSSStyleSheet* sheet = aSheet->AsGecko();
|
CSSStyleSheet* sheet = aSheet->AsConcrete();
|
||||||
|
|
||||||
RefPtr<nsMediaList> mediaList(aMediaList);
|
RefPtr<nsMediaList> mediaList(aMediaList);
|
||||||
|
|
||||||
|
|
@ -1397,10 +1397,10 @@ Loader::InsertChildSheet(StyleSheet* aSheet,
|
||||||
|
|
||||||
// child sheets should always start out enabled, even if they got
|
// child sheets should always start out enabled, even if they got
|
||||||
// cloned off of top-level sheets which were disabled
|
// cloned off of top-level sheets which were disabled
|
||||||
aSheet->AsGecko()->SetEnabled(true);
|
aSheet->AsConcrete()->SetEnabled(true);
|
||||||
|
|
||||||
aParentSheet->AppendStyleSheet(aSheet);
|
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"));
|
||||||
// LOG((" Inserting into parent sheet at position %d", insertionPoint));
|
// LOG((" Inserting into parent sheet at position %d", insertionPoint));
|
||||||
|
|
@ -1741,7 +1741,7 @@ Loader::ParseSheet(const nsAString& aInput,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
nsCSSParser parser(this, aLoadData->mSheet->AsConcrete());
|
||||||
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
||||||
aLoadData->mSheet->Principal(),
|
aLoadData->mSheet->Principal(),
|
||||||
aLoadData->mLineNumber);
|
aLoadData->mLineNumber);
|
||||||
|
|
@ -1857,7 +1857,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
// If mSheetAlreadyComplete, then the sheet could well be modified between
|
// If mSheetAlreadyComplete, then the sheet could well be modified between
|
||||||
// when we posted the async call to SheetComplete and now, since the sheet
|
// when we posted the async call to SheetComplete and now, since the sheet
|
||||||
// was page-accessible during that whole time.
|
// 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");
|
"should not get marked modified during parsing");
|
||||||
data->mSheet->SetComplete();
|
data->mSheet->SetComplete();
|
||||||
data->ScheduleLoadEventIfNeeded(aStatus);
|
data->ScheduleLoadEventIfNeeded(aStatus);
|
||||||
|
|
@ -1899,10 +1899,10 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
// parent sheet anyway, so that if someone then accesses it via
|
// parent sheet anyway, so that if someone then accesses it via
|
||||||
// CSSOM we won't have extra clones of the inner lying around.
|
// CSSOM we won't have extra clones of the inner lying around.
|
||||||
data = aLoadData;
|
data = aLoadData;
|
||||||
CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko();
|
CSSStyleSheet* sheet = aLoadData->mSheet->AsConcrete();
|
||||||
while (data) {
|
while (data) {
|
||||||
if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) {
|
if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) {
|
||||||
sheet = data->mSheet->AsGecko();
|
sheet = data->mSheet->AsConcrete();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data = data->mNext;
|
data = data->mNext;
|
||||||
|
|
@ -2216,7 +2216,7 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
||||||
LOG((" No parent load; must be CSSOM"));
|
LOG((" No parent load; must be CSSOM"));
|
||||||
// No parent load data, so the sheet will need to be notified when
|
// 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.
|
// 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
|
// 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.Done();
|
||||||
iter.Next()) {
|
iter.Next()) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
|
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));
|
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ StyleSheet::IsComplete() const
|
||||||
void
|
void
|
||||||
StyleSheet::SetComplete()
|
StyleSheet::SetComplete()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!AsGecko()->mDirty,
|
NS_ASSERTION(!AsConcrete()->mDirty,
|
||||||
"Can't set a dirty sheet complete!");
|
"Can't set a dirty sheet complete!");
|
||||||
SheetInfo().mComplete = true;
|
SheetInfo().mComplete = true;
|
||||||
if (mDocument && !mDisabled) {
|
if (mDocument && !mDisabled) {
|
||||||
|
|
@ -135,7 +135,7 @@ StyleSheet::SetDisabled(bool aDisabled)
|
||||||
{
|
{
|
||||||
// DOM method, so handle BeginUpdate/EndUpdate
|
// DOM method, so handle BeginUpdate/EndUpdate
|
||||||
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
|
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
|
||||||
AsGecko()->SetEnabled(!aDisabled);
|
AsConcrete()->SetEnabled(!aDisabled);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return AsGecko()->GetCssRulesInternal(aRv);
|
return AsConcrete()->GetCssRulesInternal(aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -240,7 +240,7 @@ StyleSheet::InsertRule(const nsAString& aRule, uint32_t aIndex,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return AsGecko()->InsertRuleInternal(aRule, aIndex, aRv);
|
return AsConcrete()->InsertRuleInternal(aRule, aIndex, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -251,7 +251,7 @@ StyleSheet::DeleteRule(uint32_t aIndex,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AsGecko()->DeleteRuleInternal(aIndex, aRv);
|
AsConcrete()->DeleteRuleInternal(aIndex, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
|
|
@ -275,7 +275,7 @@ StyleSheet::AddRule(const nsAString& aSelector, const nsAString& aBlock,
|
||||||
auto index =
|
auto index =
|
||||||
aIndex.WasPassed() ? aIndex.Value() : GetCssRules(aSubjectPrincipal, aRv)->Length();
|
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.
|
// As per Microsoft documentation, always return -1.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include "mozilla/dom/CSSStyleSheetBinding.h"
|
#include "mozilla/dom/CSSStyleSheetBinding.h"
|
||||||
#include "mozilla/net/ReferrerPolicy.h"
|
#include "mozilla/net/ReferrerPolicy.h"
|
||||||
#include "mozilla/CORSMode.h"
|
#include "mozilla/CORSMode.h"
|
||||||
#include "mozilla/DeprecatedUtils.h"
|
|
||||||
|
|
||||||
#include "nsIDOMCSSStyleSheet.h"
|
#include "nsIDOMCSSStyleSheet.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
@ -64,7 +63,8 @@ public:
|
||||||
bool IsComplete() const;
|
bool IsComplete() const;
|
||||||
void SetComplete();
|
void SetComplete();
|
||||||
|
|
||||||
MOZ_DECL_DEPRECATED_METHODS(CSSStyleSheet)
|
inline CSSStyleSheet* AsConcrete();
|
||||||
|
inline const CSSStyleSheet* AsConcrete() const;
|
||||||
|
|
||||||
// Whether the sheet is for an inline <style> element.
|
// Whether the sheet is for an inline <style> element.
|
||||||
inline bool IsInline() const;
|
inline bool IsInline() const;
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,28 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
MOZ_DEFINE_DEPRECATED_METHODS(StyleSheet, CSSStyleSheet)
|
CSSStyleSheet*
|
||||||
|
StyleSheet::AsConcrete()
|
||||||
|
{
|
||||||
|
return static_cast<CSSStyleSheet*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CSSStyleSheet*
|
||||||
|
StyleSheet::AsConcrete() const
|
||||||
|
{
|
||||||
|
return static_cast<const CSSStyleSheet*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
StyleSheetInfo&
|
StyleSheetInfo&
|
||||||
StyleSheet::SheetInfo()
|
StyleSheet::SheetInfo()
|
||||||
{
|
{
|
||||||
return *AsGecko()->mInner;
|
return *AsConcrete()->mInner;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyleSheetInfo&
|
const StyleSheetInfo&
|
||||||
StyleSheet::SheetInfo() const
|
StyleSheet::SheetInfo() const
|
||||||
{
|
{
|
||||||
return *AsGecko()->mInner;
|
return *AsConcrete()->mInner;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -71,7 +81,7 @@ StyleSheet::IsApplicable() const
|
||||||
bool
|
bool
|
||||||
StyleSheet::HasRules() const
|
StyleSheet::HasRules() const
|
||||||
{
|
{
|
||||||
return AsGecko()->HasRules();
|
return AsConcrete()->HasRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -79,19 +89,19 @@ StyleSheet::SetAssociatedDocument(nsIDocument* aDocument,
|
||||||
DocumentAssociationMode aAssociationMode)
|
DocumentAssociationMode aAssociationMode)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aDocument);
|
MOZ_ASSERT(aDocument);
|
||||||
AsGecko()->SetAssociatedDocument(aDocument, aAssociationMode);
|
AsConcrete()->SetAssociatedDocument(aDocument, aAssociationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSheet::ClearAssociatedDocument()
|
StyleSheet::ClearAssociatedDocument()
|
||||||
{
|
{
|
||||||
AsGecko()->SetAssociatedDocument(nullptr, NotOwnedByDocument);
|
AsConcrete()->SetAssociatedDocument(nullptr, NotOwnedByDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
StyleSheet::GetParentSheet() const
|
StyleSheet::GetParentSheet() const
|
||||||
{
|
{
|
||||||
return AsGecko()->GetParentSheet();
|
return AsConcrete()->GetParentSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
|
|
@ -112,7 +122,7 @@ StyleSheet::GetParentObject() const
|
||||||
void
|
void
|
||||||
StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
|
StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
AsGecko()->AppendStyleSheet(aSheet->AsGecko());
|
AsConcrete()->AppendStyleSheet(aSheet->AsConcrete());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPrincipal*
|
nsIPrincipal*
|
||||||
|
|
@ -155,19 +165,19 @@ StyleSheet::GetIntegrity(dom::SRIMetadata& aResult) const
|
||||||
size_t
|
size_t
|
||||||
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
return AsGecko()->SizeOfIncludingThis(aMallocSizeOf);
|
return AsConcrete()->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void
|
void
|
||||||
StyleSheet::List(FILE* aOut, int32_t aIndex) const
|
StyleSheet::List(FILE* aOut, int32_t aIndex) const
|
||||||
{
|
{
|
||||||
AsGecko()->List(aOut, aIndex);
|
AsConcrete()->List(aOut, aIndex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void StyleSheet::WillDirty() { AsGecko()->WillDirty(); }
|
void StyleSheet::WillDirty() { AsConcrete()->WillDirty(); }
|
||||||
void StyleSheet::DidDirty() { AsGecko()->DidDirty(); }
|
void StyleSheet::DidDirty() { AsConcrete()->DidDirty(); }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ EXPORTS.mozilla += [
|
||||||
'CSSVariableDeclarations.h',
|
'CSSVariableDeclarations.h',
|
||||||
'CSSVariableResolver.h',
|
'CSSVariableResolver.h',
|
||||||
'CSSVariableValues.h',
|
'CSSVariableValues.h',
|
||||||
'DeprecatedUtils.h',
|
|
||||||
'IncrementalClearCOMRuleArray.h',
|
'IncrementalClearCOMRuleArray.h',
|
||||||
'LayerAnimationInfo.h',
|
'LayerAnimationInfo.h',
|
||||||
'RuleNodeCacheConditions.h',
|
'RuleNodeCacheConditions.h',
|
||||||
|
|
|
||||||
|
|
@ -491,7 +491,6 @@ nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aSheet)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(gCSSLoader, "pref changed before we loaded a sheet?");
|
MOZ_ASSERT(gCSSLoader, "pref changed before we loaded a sheet?");
|
||||||
|
|
||||||
// TODO: this redundant check goes away once we get rid of AsGecko.
|
|
||||||
const bool hasSheet = aSheet && *aSheet;
|
const bool hasSheet = aSheet && *aSheet;
|
||||||
if (hasSheet && gCSSLoader) {
|
if (hasSheet && gCSSLoader) {
|
||||||
nsIURI* uri = (*aSheet)->GetSheetURI();
|
nsIURI* uri = (*aSheet)->GetSheetURI();
|
||||||
|
|
@ -628,7 +627,7 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||||
"kPreallocSize should be big enough to build preference style "
|
"kPreallocSize should be big enough to build preference style "
|
||||||
"sheet without reallocation");
|
"sheet without reallocation");
|
||||||
|
|
||||||
sheet->AsGecko()->ReparseSheet(sheetText);
|
sheet->AsConcrete()->ReparseSheet(sheetText);
|
||||||
|
|
||||||
#undef NS_GET_R_G_B
|
#undef NS_GET_R_G_B
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -750,7 +750,7 @@ nsStyleSet::AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) c
|
||||||
AutoTArray<StyleSheet*, 32> sheets;
|
AutoTArray<StyleSheet*, 32> sheets;
|
||||||
mBindingManager->AppendAllSheets(sheets);
|
mBindingManager->AppendAllSheets(sheets);
|
||||||
for (StyleSheet* handle : sheets) {
|
for (StyleSheet* handle : sheets) {
|
||||||
aArray.AppendElement(handle->AsGecko());
|
aArray.AppendElement(handle->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2466,7 +2466,7 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets()
|
||||||
AutoTArray<StyleSheet*, 32> sheets;
|
AutoTArray<StyleSheet*, 32> sheets;
|
||||||
mBindingManager->AppendAllSheets(sheets);
|
mBindingManager->AppendAllSheets(sheets);
|
||||||
for (StyleSheet* sheet : sheets) {
|
for (StyleSheet* sheet : sheets) {
|
||||||
queue.AppendElement(sheet->AsGecko());
|
queue.AppendElement(sheet->AsConcrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue