mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1457920: Remove StyleSheet::AsServo. r=xidorn
MozReview-Commit-ID: IkkJvUFHykk
This commit is contained in:
parent
5cb9f4328b
commit
bf64474d79
@ -418,9 +418,8 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
|
||||
rv = document->LoadChromeSheetSync(uri, true, &newSheet);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (newSheet) {
|
||||
rv = newAgentSheets.AppendElement(newSheet->AsServo())
|
||||
? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
newAgentSheets.AppendElement(newSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else { // Just use the same sheet.
|
||||
|
@ -267,7 +267,7 @@ void
|
||||
ShadowRoot::RuleAdded(StyleSheet& aSheet, css::Rule& aRule)
|
||||
{
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->RuleAdded(*aSheet.AsServo(), aRule);
|
||||
mStyleRuleMap->RuleAdded(aSheet, aRule);
|
||||
}
|
||||
|
||||
Servo_AuthorStyles_ForceDirty(mServoStyles.get());
|
||||
@ -278,7 +278,7 @@ void
|
||||
ShadowRoot::RuleRemoved(StyleSheet& aSheet, css::Rule& aRule)
|
||||
{
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->RuleRemoved(*aSheet.AsServo(), aRule);
|
||||
mStyleRuleMap->RuleRemoved(aSheet, aRule);
|
||||
}
|
||||
|
||||
Servo_AuthorStyles_ForceDirty(mServoStyles.get());
|
||||
@ -320,9 +320,9 @@ ShadowRoot::AppendStyleSheet(StyleSheet& aSheet)
|
||||
{
|
||||
DocumentOrShadowRoot::AppendStyleSheet(aSheet);
|
||||
if (aSheet.IsApplicable()) {
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), &aSheet);
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->SheetAdded(*aSheet.AsServo());
|
||||
mStyleRuleMap->SheetAdded(aSheet);
|
||||
}
|
||||
ApplicableRulesChanged();
|
||||
}
|
||||
@ -364,7 +364,7 @@ ShadowRoot::InsertSheetIntoAuthorData(size_t aIndex, StyleSheet& aSheet)
|
||||
MOZ_ASSERT(aSheet.IsApplicable());
|
||||
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->SheetAdded(*aSheet.AsServo());
|
||||
mStyleRuleMap->SheetAdded(aSheet);
|
||||
}
|
||||
|
||||
for (size_t i = aIndex + 1; i < SheetCount(); ++i) {
|
||||
@ -374,12 +374,12 @@ ShadowRoot::InsertSheetIntoAuthorData(size_t aIndex, StyleSheet& aSheet)
|
||||
}
|
||||
|
||||
Servo_AuthorStyles_InsertStyleSheetBefore(
|
||||
mServoStyles.get(), aSheet.AsServo(), beforeSheet->AsServo());
|
||||
mServoStyles.get(), &aSheet, beforeSheet);
|
||||
ApplicableRulesChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), &aSheet);
|
||||
ApplicableRulesChanged();
|
||||
}
|
||||
|
||||
@ -393,9 +393,9 @@ ShadowRoot::StyleSheetApplicableStateChanged(StyleSheet& aSheet, bool aApplicabl
|
||||
InsertSheetIntoAuthorData(size_t(index), aSheet);
|
||||
} else {
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->SheetRemoved(*aSheet.AsServo());
|
||||
mStyleRuleMap->SheetRemoved(aSheet);
|
||||
}
|
||||
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), aSheet.AsServo());
|
||||
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), &aSheet);
|
||||
ApplicableRulesChanged();
|
||||
}
|
||||
}
|
||||
@ -406,9 +406,9 @@ ShadowRoot::RemoveSheet(StyleSheet* aSheet)
|
||||
DocumentOrShadowRoot::RemoveSheet(*aSheet);
|
||||
if (aSheet->IsApplicable()) {
|
||||
if (mStyleRuleMap) {
|
||||
mStyleRuleMap->SheetRemoved(*aSheet->AsServo());
|
||||
mStyleRuleMap->SheetRemoved(*aSheet);
|
||||
}
|
||||
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), aSheet->AsServo());
|
||||
Servo_AuthorStyles_RemoveStyleSheet(mServoStyles.get(), aSheet);
|
||||
ApplicableRulesChanged();
|
||||
}
|
||||
}
|
||||
|
@ -2436,7 +2436,7 @@ nsIDocument::RemoveDocStyleSheetsFromStyleSets()
|
||||
if (sheet->IsApplicable()) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveDocStyleSheet(sheet->AsServo());
|
||||
shell->StyleSet()->RemoveDocStyleSheet(sheet);
|
||||
}
|
||||
}
|
||||
// XXX Tell observers?
|
||||
@ -2455,7 +2455,7 @@ nsIDocument::RemoveStyleSheetsFromStyleSets(
|
||||
if (sheet->IsApplicable()) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(aType, sheet->AsServo());
|
||||
shell->StyleSet()->RemoveStyleSheet(aType, sheet);
|
||||
}
|
||||
}
|
||||
// XXX Tell observers?
|
||||
@ -2522,7 +2522,7 @@ AppendSheetsToStyleSet(ServoStyleSet* aStyleSet,
|
||||
SheetType aType)
|
||||
{
|
||||
for (StyleSheet* sheet : Reversed(aSheets)) {
|
||||
aStyleSet->AppendStyleSheet(aType, sheet->AsServo());
|
||||
aStyleSet->AppendStyleSheet(aType, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2538,7 +2538,7 @@ nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
|
||||
|
||||
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
|
||||
if (sheet->IsApplicable()) {
|
||||
aStyleSet->AddDocStyleSheet(sheet->AsServo(), this);
|
||||
aStyleSet->AddDocStyleSheet(sheet, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2546,14 +2546,14 @@ nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
|
||||
nsTArray<RefPtr<StyleSheet>>& sheets =
|
||||
*sheetService->AuthorStyleSheets();
|
||||
for (StyleSheet* sheet : sheets) {
|
||||
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsServo());
|
||||
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate backwards to maintain order
|
||||
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
|
||||
if (sheet->IsApplicable()) {
|
||||
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4302,7 +4302,7 @@ nsIDocument::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->AsServo());
|
||||
shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4314,7 +4314,7 @@ nsIDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->AddDocStyleSheet(aSheet->AsServo(), this);
|
||||
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4381,7 +4381,7 @@ nsIDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveDocStyleSheet(aSheet->AsServo());
|
||||
shell->StyleSet()->RemoveDocStyleSheet(aSheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4602,7 +4602,7 @@ nsIDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aShe
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
SheetType type = ConvertAdditionalSheetType(aType);
|
||||
shell->StyleSet()->AppendStyleSheet(type, aSheet->AsServo());
|
||||
shell->StyleSet()->AppendStyleSheet(type, aSheet);
|
||||
}
|
||||
|
||||
// Passing false, so documet.styleSheets.length will not be affected by
|
||||
@ -4630,7 +4630,7 @@ nsIDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aShee
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
SheetType type = ConvertAdditionalSheetType(aType);
|
||||
shell->StyleSet()->RemoveStyleSheet(type, sheetRef->AsServo());
|
||||
shell->StyleSet()->RemoveStyleSheet(type, sheetRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1096,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
||||
SRIMetadata());
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
sheet->AsServo()->ParseSheetSync(
|
||||
sheet->ParseSheetSync(
|
||||
aDocument->CSSLoader(),
|
||||
NS_ConvertUTF16toUTF8(aOriginal),
|
||||
/* aLoadData = */ nullptr,
|
||||
|
@ -2407,8 +2407,7 @@ nsHTMLDocument::EditingStateChanged()
|
||||
|
||||
auto cache = nsLayoutStylesheetCache::Singleton();
|
||||
|
||||
ServoStyleSheet* contentEditableSheet =
|
||||
cache->ContentEditableSheet()->AsServo();
|
||||
StyleSheet* contentEditableSheet = cache->ContentEditableSheet();
|
||||
|
||||
if (!agentSheets.Contains(contentEditableSheet)) {
|
||||
agentSheets.AppendElement(contentEditableSheet);
|
||||
@ -2419,7 +2418,7 @@ nsHTMLDocument::EditingStateChanged()
|
||||
// specific states on the elements.
|
||||
if (designMode) {
|
||||
// designMode is being turned on (overrides contentEditable).
|
||||
ServoStyleSheet* designModeSheet = cache->DesignModeSheet()->AsServo();
|
||||
StyleSheet* designModeSheet = cache->DesignModeSheet();
|
||||
if (!agentSheets.Contains(designModeSheet)) {
|
||||
agentSheets.AppendElement(designModeSheet);
|
||||
}
|
||||
@ -2429,7 +2428,7 @@ nsHTMLDocument::EditingStateChanged()
|
||||
}
|
||||
else if (oldState == eDesignMode) {
|
||||
// designMode is being turned off (contentEditable is still on).
|
||||
agentSheets.RemoveElement(cache->DesignModeSheet()->AsServo());
|
||||
agentSheets.RemoveElement(cache->DesignModeSheet());
|
||||
updateState = true;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ nsXBLPrototypeResources::SyncServoStyles()
|
||||
mStyleRuleMap.reset(nullptr);
|
||||
mServoStyles.reset(Servo_AuthorStyles_Create());
|
||||
for (auto& sheet : mStyleSheetList) {
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), sheet->AsServo());
|
||||
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), sheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ PresShell::UpdatePreferenceStyles()
|
||||
// it to be modifiable from devtools and similar, see bugs 1239336 and
|
||||
// 1436782. I think it conceptually should be a user sheet, and could be
|
||||
// without too much trouble I'd think.
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, newPrefSheet->AsServo());
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, newPrefSheet);
|
||||
mPrefStyleSheet = newPrefSheet;
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
@ -1518,7 +1518,7 @@ void
|
||||
PresShell::RemovePreferenceStyles()
|
||||
{
|
||||
if (mPrefStyleSheet) {
|
||||
mStyleSet->RemoveStyleSheet(SheetType::Agent, mPrefStyleSheet->AsServo());
|
||||
mStyleSet->RemoveStyleSheet(SheetType::Agent, mPrefStyleSheet);
|
||||
mPrefStyleSheet = nullptr;
|
||||
}
|
||||
}
|
||||
@ -1541,13 +1541,13 @@ PresShell::AddUserSheet(StyleSheet* aSheet)
|
||||
// Iterate forwards when removing so the searches for RemoveStyleSheet are as
|
||||
// short as possible.
|
||||
for (StyleSheet* sheet : userSheets) {
|
||||
mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsServo());
|
||||
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 (StyleSheet* sheet : Reversed(userSheets)) {
|
||||
mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsServo());
|
||||
mStyleSet->PrependStyleSheet(SheetType::User, sheet);
|
||||
}
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
@ -1559,7 +1559,7 @@ PresShell::AddAgentSheet(StyleSheet* aSheet)
|
||||
{
|
||||
// Make sure this does what nsDocumentViewer::CreateStyleSet does
|
||||
// wrt ordering.
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, aSheet->AsServo());
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, aSheet);
|
||||
RestyleForCSSRuleChanges();
|
||||
}
|
||||
|
||||
@ -1571,10 +1571,10 @@ PresShell::AddAuthorSheet(StyleSheet* aSheet)
|
||||
StyleSheet* firstAuthorSheet =
|
||||
mDocument->GetFirstAdditionalAuthorSheet();
|
||||
if (firstAuthorSheet) {
|
||||
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, aSheet->AsServo(),
|
||||
firstAuthorSheet->AsServo());
|
||||
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, aSheet,
|
||||
firstAuthorSheet);
|
||||
} else {
|
||||
mStyleSet->AppendStyleSheet(SheetType::Doc, aSheet->AsServo());
|
||||
mStyleSet->AppendStyleSheet(SheetType::Doc, aSheet);
|
||||
}
|
||||
|
||||
RestyleForCSSRuleChanges();
|
||||
@ -1583,7 +1583,7 @@ PresShell::AddAuthorSheet(StyleSheet* aSheet)
|
||||
void
|
||||
PresShell::RemoveSheet(SheetType aType, StyleSheet* aSheet)
|
||||
{
|
||||
mStyleSet->RemoveStyleSheet(aType, aSheet->AsServo());
|
||||
mStyleSet->RemoveStyleSheet(aType, aSheet);
|
||||
RestyleForCSSRuleChanges();
|
||||
}
|
||||
|
||||
@ -8602,13 +8602,13 @@ PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<ServoStyleSheet>>& aSheets)
|
||||
nsresult
|
||||
PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
|
||||
{
|
||||
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsServo());
|
||||
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
|
||||
{
|
||||
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsServo());
|
||||
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2345,13 +2345,13 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
if (sheet) {
|
||||
styleSet->AppendStyleSheet(SheetType::User, sheet->AsServo());
|
||||
styleSet->AppendStyleSheet(SheetType::User, sheet);
|
||||
}
|
||||
|
||||
// Append chrome sheets (scrollbars + forms).
|
||||
sheet = cache->ScrollbarsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
if (!aDocument->IsSVGDocument()) {
|
||||
@ -2366,21 +2366,21 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||
|
||||
sheet = cache->FormsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
if (aDocument->LoadsFullXULStyleSheetUpFront()) {
|
||||
// This is the only place components.css gets loaded, unlike xul.css
|
||||
sheet = cache->XULComponentsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
// nsXULElement::BindToTree loads xul.css on-demand if we don't load it
|
||||
// up-front here.
|
||||
sheet = cache->XULSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2388,25 +2388,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->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
sheet = cache->CounterStylesSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) {
|
||||
sheet = cache->NoScriptSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) {
|
||||
sheet = cache->NoFramesSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2415,26 +2415,25 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||
|
||||
sheet = cache->HTMLSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
styleSet->PrependStyleSheet(SheetType::Agent,
|
||||
cache->UASheet()->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet());
|
||||
} else {
|
||||
// SVG documents may have scrollbars and need the scrollbar styling.
|
||||
sheet = cache->MinimalXULSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
|
||||
styleSet->PrependStyleSheet(SheetType::User, sheet->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::User, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1197,11 +1197,11 @@ nsPresContext::CompatibilityModeChanged()
|
||||
if (needsQuirkSheet) {
|
||||
// quirk.css needs to come after html.css; we just keep it at the end.
|
||||
DebugOnly<nsresult> rv =
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
|
||||
} else {
|
||||
DebugOnly<nsresult> rv =
|
||||
styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsServo());
|
||||
styleSet->RemoveStyleSheet(SheetType::Agent, sheet);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
|
||||
}
|
||||
|
||||
|
@ -707,8 +707,7 @@ InspectorUtils::ParseStyleSheet(GlobalObject& aGlobalObject,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
||||
RefPtr<ServoStyleSheet> servoSheet = aSheet.AsServo();
|
||||
aRv = servoSheet->ReparseSheet(aInput);
|
||||
aRv = aSheet.ReparseSheet(aInput);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -39,7 +39,7 @@ ServoStyleRuleMap::EnsureTable(nsXBLPrototypeResources& aXBLResources)
|
||||
return;
|
||||
}
|
||||
for (auto index : IntegerRange(aXBLResources.SheetCount())) {
|
||||
FillTableFromStyleSheet(*aXBLResources.StyleSheetAt(index)->AsServo());
|
||||
FillTableFromStyleSheet(*aXBLResources.StyleSheetAt(index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ ServoStyleRuleMap::EnsureTable(ShadowRoot& aShadowRoot)
|
||||
return;
|
||||
}
|
||||
for (auto index : IntegerRange(aShadowRoot.SheetCount())) {
|
||||
FillTableFromStyleSheet(*aShadowRoot.SheetAt(index)->AsServo());
|
||||
FillTableFromStyleSheet(*aShadowRoot.SheetAt(index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ ServoStyleRuleMap::FillTableFromRule(css::Rule& aRule)
|
||||
case CSSRuleBinding::IMPORT_RULE: {
|
||||
auto& rule = static_cast<ServoImportRule&>(aRule);
|
||||
MOZ_ASSERT(aRule.GetStyleSheet());
|
||||
FillTableFromStyleSheet(*rule.GetStyleSheet()->AsServo());
|
||||
FillTableFromStyleSheet(*rule.GetStyleSheet());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2351,7 +2351,7 @@ nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO)
|
||||
// The SVG document only loads minimal-xul.css, so it doesn't apply other
|
||||
// styles. We should add ua.css for applying style which related to print.
|
||||
auto cache = nsLayoutStylesheetCache::Singleton();
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet()->AsServo());
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet());
|
||||
}
|
||||
|
||||
aPO->mPresShell = aPO->mDocument->CreateShell(aPO->mPresContext,
|
||||
|
@ -1644,7 +1644,7 @@ Loader::ParseSheet(const nsAString& aUTF16,
|
||||
NS_PRECONDITION(aLoadData, "Must have load data");
|
||||
NS_PRECONDITION(aLoadData->mSheet, "Must have sheet to parse into");
|
||||
aCompleted = false;
|
||||
ServoStyleSheet* sheet = aLoadData->mSheet->AsServo();
|
||||
StyleSheet* sheet = aLoadData->mSheet;
|
||||
MOZ_ASSERT(aUTF16.IsEmpty() || aUTF8.IsEmpty());
|
||||
if (!aUTF16.IsEmpty()) {
|
||||
return DoParseSheetServo(sheet, NS_ConvertUTF16toUTF8(aUTF16),
|
||||
|
@ -2590,7 +2590,7 @@ Gecko_StyleSheet_FinishAsyncParse(SheetLoadDataHolder* aData,
|
||||
[d = Move(loadData),
|
||||
s = Move(sheetContents)]() mutable {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
d->get()->mSheet->AsServo()->FinishAsyncParse(s.forget());
|
||||
d->get()->mSheet->FinishAsyncParse(s.forget());
|
||||
}));
|
||||
}
|
||||
|
||||
@ -2676,7 +2676,7 @@ Gecko_LoadStyleSheetAsync(css::SheetLoadDataHolder* aParentData,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SheetLoadData* d = data->get();
|
||||
RefPtr<ServoStyleSheet> sheet =
|
||||
LoadImportSheet(d->mLoader, d->mSheet->AsServo(), d, nullptr, url, media.forget());
|
||||
LoadImportSheet(d->mLoader, d->mSheet, d, nullptr, url, media.forget());
|
||||
Servo_ImportRule_SetSheet(import, sheet);
|
||||
}));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ ServoCSSRuleList::SetParentRule(css::GroupRule* aParentRule)
|
||||
void
|
||||
ServoCSSRuleList::SetStyleSheet(StyleSheet* aStyleSheet)
|
||||
{
|
||||
mStyleSheet = aStyleSheet ? aStyleSheet->AsServo() : nullptr;
|
||||
mStyleSheet = aStyleSheet;
|
||||
EnumerateInstantiatedRules([this](css::Rule* rule) {
|
||||
rule->SetStyleSheet(mStyleSheet);
|
||||
});
|
||||
|
@ -214,7 +214,7 @@ ServoKeyframesRule::List(FILE* out, int32_t aIndent) const
|
||||
ServoKeyframesRule::SetStyleSheet(StyleSheet* aSheet)
|
||||
{
|
||||
if (mKeyframeList) {
|
||||
mKeyframeList->SetStyleSheet(aSheet ? aSheet->AsServo() : nullptr);
|
||||
mKeyframeList->SetStyleSheet(aSheet);
|
||||
}
|
||||
dom::CSSKeyframesRule::SetStyleSheet(aSheet);
|
||||
}
|
||||
@ -275,7 +275,7 @@ ServoKeyframesRule::AppendRule(const nsAString& aRule)
|
||||
NS_ConvertUTF16toUTF8 rule(aRule);
|
||||
UpdateRule([this, sheet, &rule]() {
|
||||
bool parsedOk = Servo_KeyframesRule_AppendRule(
|
||||
mRawRule, sheet->AsServo()->RawContents(), &rule);
|
||||
mRawRule, sheet->RawContents(), &rule);
|
||||
if (parsedOk && mKeyframeList) {
|
||||
mKeyframeList->AppendRule();
|
||||
}
|
||||
@ -311,7 +311,7 @@ ServoKeyframesRule::CssRules()
|
||||
mKeyframeList = new ServoKeyframeList(do_AddRef(mRawRule));
|
||||
mKeyframeList->SetParentRule(this);
|
||||
if (StyleSheet* sheet = GetStyleSheet()) {
|
||||
mKeyframeList->SetStyleSheet(sheet->AsServo());
|
||||
mKeyframeList->SetStyleSheet(sheet);
|
||||
}
|
||||
}
|
||||
return mKeyframeList;
|
||||
|
@ -207,7 +207,6 @@ void
|
||||
ServoStyleRule::SetSelectorText(const nsAString& aSelectorText)
|
||||
{
|
||||
if (RefPtr<StyleSheet> sheet = GetStyleSheet()) {
|
||||
ServoStyleSheet* servoSheet = sheet->AsServo();
|
||||
nsIDocument* doc = sheet->GetAssociatedDocument();
|
||||
|
||||
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true);
|
||||
@ -217,7 +216,7 @@ ServoStyleRule::SetSelectorText(const nsAString& aSelectorText)
|
||||
sheet->AssertHasUniqueInner();
|
||||
sheet->WillDirty();
|
||||
|
||||
const RawServoStyleSheetContents* contents = servoSheet->RawContents();
|
||||
const RawServoStyleSheetContents* contents = sheet->RawContents();
|
||||
if (Servo_StyleRule_SetSelectorText(contents, mRawRule, &aSelectorText)) {
|
||||
sheet->RuleChanged(this);
|
||||
}
|
||||
|
@ -303,16 +303,15 @@ ServoStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
|
||||
bool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
ServoStyleSheet* sheet = aSheet->AsServo();
|
||||
if (!sheet->GetParentSheet()) {
|
||||
if (!aSheet->GetParentSheet()) {
|
||||
return NS_OK; // ignore if sheet has been detached already
|
||||
}
|
||||
NS_ASSERTION(this == sheet->GetParentSheet(),
|
||||
NS_ASSERTION(this == aSheet->GetParentSheet(),
|
||||
"We are being notified of a sheet load for a sheet that is not our child!");
|
||||
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, true);
|
||||
RuleAdded(*sheet->GetOwnerRule());
|
||||
RuleAdded(*aSheet->GetOwnerRule());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -581,7 +581,7 @@ void
|
||||
StyleSheet::RuleAdded(css::Rule& aRule)
|
||||
{
|
||||
mDirtyFlags |= MODIFIED_RULES;
|
||||
NOTIFY(RuleAdded, (*AsServo(), aRule));
|
||||
NOTIFY(RuleAdded, (*this, aRule));
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->StyleRuleAdded(this, &aRule);
|
||||
@ -592,7 +592,7 @@ void
|
||||
StyleSheet::RuleRemoved(css::Rule& aRule)
|
||||
{
|
||||
mDirtyFlags |= MODIFIED_RULES;
|
||||
NOTIFY(RuleRemoved, (*AsServo(), aRule));
|
||||
NOTIFY(RuleRemoved, (*this, aRule));
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->StyleRuleRemoved(this, &aRule);
|
||||
@ -603,7 +603,7 @@ void
|
||||
StyleSheet::RuleChanged(css::Rule* aRule)
|
||||
{
|
||||
mDirtyFlags |= MODIFIED_RULES;
|
||||
NOTIFY(RuleChanged, (*AsServo(), aRule));
|
||||
NOTIFY(RuleChanged, (*this, aRule));
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->StyleRuleChanged(this, aRule);
|
||||
@ -628,8 +628,7 @@ StyleSheet::InsertRuleIntoGroup(const nsAString& aRule,
|
||||
|
||||
WillDirty();
|
||||
|
||||
nsresult result =
|
||||
AsServo()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
nsresult result = InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
RuleAdded(*aGroup->GetStyleRuleAt(aIndex));
|
||||
|
||||
|
@ -110,10 +110,6 @@ public:
|
||||
|
||||
URLExtraData* URLData() const { return Inner()->mURLData; }
|
||||
|
||||
// FIXME(emilio): Remove.
|
||||
StyleSheet* AsServo() { return this; }
|
||||
const StyleSheet* AsServo() const { return this; }
|
||||
|
||||
// nsICSSLoaderObserver interface
|
||||
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
|
||||
nsresult aStatus) final;
|
||||
|
@ -257,14 +257,14 @@ nsDOMCSSDeclaration::GetServoCSSParsingEnvironmentForRule(const css::Rule* aRule
|
||||
|
||||
if (nsIDocument* document = aRule->GetDocument()) {
|
||||
return {
|
||||
sheet->AsServo()->URLData(),
|
||||
sheet->URLData(),
|
||||
document->GetCompatibilityMode(),
|
||||
document->CSSLoader(),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
sheet->AsServo()->URLData(),
|
||||
sheet->URLData(),
|
||||
eCompatibility_FullStandards,
|
||||
nullptr,
|
||||
};
|
||||
|
@ -887,12 +887,11 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||
"kPreallocSize should be big enough to build preference style "
|
||||
"sheet without reallocation");
|
||||
|
||||
ServoStyleSheet* servoSheet = sheet->AsServo();
|
||||
// NB: The pref sheet never has @import rules, thus no loader.
|
||||
servoSheet->ParseSheetSync(nullptr,
|
||||
sheetText,
|
||||
/* aLoadData = */ nullptr,
|
||||
/* aLineNumber = */ 0);
|
||||
sheet->ParseSheetSync(nullptr,
|
||||
sheetText,
|
||||
/* aLoadData = */ nullptr,
|
||||
/* aLineNumber = */ 0);
|
||||
|
||||
#undef NS_GET_R_G_B
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user