Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes

This commit is contained in:
FranklinDM 2024-03-25 02:02:08 +08:00 committed by roytam1
commit a93a7bed47
52 changed files with 274 additions and 1116 deletions

View file

@ -505,9 +505,6 @@ nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aGeckoSheet,
const bool gotGeckoSheet = aGeckoSheet && *aGeckoSheet;
const bool gotServoSheet = aServoSheet && *aServoSheet;
// Make sure sheets have the expected types
MOZ_ASSERT(!gotGeckoSheet || (*aGeckoSheet)->IsGecko());
MOZ_ASSERT(!gotServoSheet || (*aServoSheet)->IsServo());
// Make sure the URIs match
MOZ_ASSERT(!gotServoSheet || !gotGeckoSheet ||
(*aGeckoSheet)->GetSheetURI() == (*aServoSheet)->GetSheetURI(),
@ -574,13 +571,8 @@ void
nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
nsPresContext* aPresContext)
{
if (mBackendType == StyleBackendType::Gecko) {
*aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
mozilla::net::RP_Default);
} else {
*aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE,
mozilla::net::RP_Default, dom::SRIMetadata());
}
*aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
mozilla::net::RP_Default);
StyleSheet* sheet = *aSheet;
@ -675,14 +667,7 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
"kPreallocSize should be big enough to build preference style "
"sheet without reallocation");
if (sheet->IsGecko()) {
sheet->AsGecko()->ReparseSheet(sheetText);
} else {
nsresult rv = sheet->AsServo()->ParseSheet(sheetText, uri, uri, nullptr, 0);
// Parsing the about:PreferenceStyleSheet URI can only fail on OOM. If we
// are OOM before we parsed any documents we might as well abort.
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
}
sheet->AsGecko()->ReparseSheet(sheetText);
#undef NS_GET_R_G_B
}