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:
FranklinDM 2024-03-29 16:30:12 +08:00 committed by roytam1
commit f0116f51db
18 changed files with 109 additions and 134 deletions

View file

@ -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());
}
}