diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp index 30df27a012..802cbbb1e3 100644 --- a/dom/animation/EffectCompositor.cpp +++ b/dom/animation/EffectCompositor.cpp @@ -202,9 +202,6 @@ EffectCompositor::RequestRestyle(dom::Element* aElement, if (aRestyleType == RestyleType::Layer) { // Prompt layers to re-sync their animations. - MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(), - "stylo: Servo-backed style system should not be using " - "EffectCompositor"); mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration(); EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType); @@ -317,9 +314,6 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement, return nullptr; } - MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(), - "stylo: Servo-backed style system should not be using " - "EffectCompositor"); if (mPresContext->RestyleManager()->AsGecko()->SkipAnimationRules()) { // We don't need to worry about updating mElementsToRestyle in this case // since this is not the animation restyle we requested when we called diff --git a/dom/animation/EffectSet.cpp b/dom/animation/EffectSet.cpp index 55dbe353b2..3731e47bae 100644 --- a/dom/animation/EffectSet.cpp +++ b/dom/animation/EffectSet.cpp @@ -110,9 +110,6 @@ EffectSet::DestroyEffectSet(dom::Element* aElement, void EffectSet::UpdateAnimationGeneration(nsPresContext* aPresContext) { - MOZ_ASSERT(aPresContext->RestyleManager()->IsGecko(), - "stylo: Servo-backed style system should not be using " - "EffectSet"); mAnimationGeneration = aPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration(); } diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index 2efc747f09..62dddd2d4b 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -296,10 +296,7 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext) runningOnCompositorProperties.HasProperty(property.mProperty); } - // FIXME (bug 1303235): Do this for Servo too - if (aStyleContext->PresContext()->StyleSet()->IsGecko()) { - CalculateCumulativeChangeHint(aStyleContext); - } + CalculateCumulativeChangeHint(aStyleContext); MarkCascadeNeedsUpdate(); @@ -1286,8 +1283,6 @@ CreateStyleContextForAnimationValue(nsCSSPropertyID aProperty, nsCOMArray rules; rules.AppendObject(styleRule); - MOZ_ASSERT(aBaseStyleContext->PresContext()->StyleSet()->IsGecko(), - "ServoStyleSet should not use StyleAnimationValue for animations"); nsStyleSet* styleSet = aBaseStyleContext->PresContext()->StyleSet()->AsGecko(); @@ -1362,10 +1357,8 @@ KeyframeEffectReadOnly::CanIgnoreIfNotVisible() const return false; } - // FIXME (bug 1303235): We don't calculate mCumulativeChangeHint for - // the Servo backend yet nsPresContext* presContext = GetPresContext(); - if (!presContext || presContext->StyleSet()->IsServo()) { + if (!presContext) { return false; } diff --git a/dom/animation/KeyframeUtils.cpp b/dom/animation/KeyframeUtils.cpp index 540f892d57..a89e954235 100644 --- a/dom/animation/KeyframeUtils.cpp +++ b/dom/animation/KeyframeUtils.cpp @@ -9,7 +9,6 @@ #include "mozilla/Move.h" #include "mozilla/Preferences.h" #include "mozilla/RangedArray.h" -#include "mozilla/ServoBindings.h" #include "mozilla/StyleAnimationValue.h" #include "mozilla/TimingParams.h" #include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc. @@ -321,10 +320,6 @@ public: inline bool IsInvalidValuePair(const PropertyValuePair& aPair, StyleBackendType aBackend) { - if (aBackend == StyleBackendType::Servo) { - return !aPair.mServoDeclarationBlock; - } - // There are three types of values we store as token streams: // // * Shorthand values (where we manually extract the token stream's string @@ -610,11 +605,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray& aKeyframes, ComputedKeyframeValues* computedValues = result.AppendElement(); for (const PropertyValuePair& pair : PropertyPriorityIterator(frame.mPropertyValues)) { - MOZ_ASSERT(!pair.mServoDeclarationBlock || - styleBackend == StyleBackendType::Servo, - "Animation values were parsed using Servo backend but target" - " element is not using Servo backend?"); - if (IsInvalidValuePair(pair, styleBackend)) { continue; } @@ -623,33 +613,25 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray& aKeyframes, // a KeyframeValueEntry for each value. nsTArray values; - if (styleBackend == StyleBackendType::Servo) { + // For shorthands, we store the string as a token stream so we need to + // extract that first. + if (nsCSSProps::IsShorthand(pair.mProperty)) { + nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue(); if (!StyleAnimationValue::ComputeValues(pair.mProperty, - CSSEnabledState::eForAllContent, aStyleContext, - *pair.mServoDeclarationBlock, values)) { + CSSEnabledState::eForAllContent, aElement, aStyleContext, + tokenStream->mTokenStream, /* aUseSVGMode */ false, values) || + IsComputeValuesFailureKey(pair)) { continue; } } else { - // For shorthands, we store the string as a token stream so we need to - // extract that first. - if (nsCSSProps::IsShorthand(pair.mProperty)) { - nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue(); - if (!StyleAnimationValue::ComputeValues(pair.mProperty, - CSSEnabledState::eForAllContent, aElement, aStyleContext, - tokenStream->mTokenStream, /* aUseSVGMode */ false, values) || - IsComputeValuesFailureKey(pair)) { - continue; - } - } else { - if (!StyleAnimationValue::ComputeValues(pair.mProperty, - CSSEnabledState::eForAllContent, aElement, aStyleContext, - pair.mValue, /* aUseSVGMode */ false, values)) { - continue; - } - MOZ_ASSERT(values.Length() == 1, - "Longhand properties should produce a single" - " StyleAnimationValue"); + if (!StyleAnimationValue::ComputeValues(pair.mProperty, + CSSEnabledState::eForAllContent, aElement, aStyleContext, + pair.mValue, /* aUseSVGMode */ false, values)) { + continue; } + MOZ_ASSERT(values.Length() == 1, + "Longhand properties should produce a single" + " StyleAnimationValue"); } for (auto& value : values) { @@ -999,30 +981,6 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue, result.mProperty = aProperty; - if (aDocument->GetStyleBackendType() == StyleBackendType::Servo) { - nsCString name = nsCSSProps::GetStringValue(aProperty); - - NS_ConvertUTF16toUTF8 value(aStringValue); - RefPtr base = - new ThreadSafeURIHolder(aDocument->GetDocumentURI()); - RefPtr referrer = - new ThreadSafeURIHolder(aDocument->GetDocumentURI()); - RefPtr principal = - new ThreadSafePrincipalHolder(aDocument->NodePrincipal()); - - nsCString baseString; - aDocument->GetDocumentURI()->GetSpec(baseString); - - RefPtr servoDeclarationBlock = - Servo_ParseProperty(&name, &value, &baseString, - base, referrer, principal).Consume(); - - if (servoDeclarationBlock) { - result.mServoDeclarationBlock = servoDeclarationBlock.forget(); - return result; - } - } - nsCSSValue value; if (!nsCSSProps::IsShorthand(aProperty)) { aParser.ParseLonghandProperty(aProperty, @@ -1054,13 +1012,6 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue, "The shorthand property of a token stream should be initialized" " to unknown"); value.SetTokenStreamValue(tokenStream); - } else { - // If we succeeded in parsing with Gecko, but not Servo the animation is - // not going to work since, for the purposes of animation, we're going to - // ignore |mValue| when the backend is Servo. - NS_WARNING_ASSERTION(aDocument->GetStyleBackendType() != - StyleBackendType::Servo, - "Gecko succeeded in parsing where Servo failed"); } result.mValue = value; @@ -1434,20 +1385,13 @@ HasImplicitKeyframeValues(const nsTArray& aKeyframes, } if (nsCSSProps::IsShorthand(pair.mProperty)) { - if (styleBackend == StyleBackendType::Gecko) { - nsCSSValueTokenStream* tokenStream = - pair.mValue.GetTokenStreamValue(); - nsCSSParser parser(aDocument->CSSLoader()); - if (!parser.IsValueValidForProperty(pair.mProperty, - tokenStream->mTokenStream)) { - continue; - } + nsCSSValueTokenStream* tokenStream = + pair.mValue.GetTokenStreamValue(); + nsCSSParser parser(aDocument->CSSLoader()); + if (!parser.IsValueValidForProperty(pair.mProperty, + tokenStream->mTokenStream)) { + continue; } - // For the Servo backend, invalid shorthand values are represented by - // a null mServoDeclarationBlock member which we skip above in - // IsInvalidValuePair. - MOZ_ASSERT(styleBackend != StyleBackendType::Servo || - pair.mServoDeclarationBlock); CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES( prop, pair.mProperty, CSSEnabledState::eForAllContent) { addToPropertySets(*prop, offsetToUse); diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index 711a695b78..c2dec154c7 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1749,14 +1749,10 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString, } RefPtr decl; - if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) { - decl = ServoDeclarationBlock::FromCssText(aString); - } else { - css::Loader* cssLoader = ownerDoc->CSSLoader(); - nsCSSParser cssParser(cssLoader); - decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI, - aElement->NodePrincipal()); - } + css::Loader* cssLoader = ownerDoc->CSSLoader(); + nsCSSParser cssParser(cssLoader); + decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI, + aElement->NodePrincipal()); if (!decl) { return false; } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 19e23cb6eb..39d5c6447b 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1153,10 +1153,6 @@ nsDOMStyleSheetSetList::EnsureFresh() StyleSheet* sheet = mDocument->SheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); // XXXheycam ServoStyleSheets don't expose their title yet. - if (sheet->IsServo()) { - NS_ERROR("stylo: ServoStyleSets don't expose their title yet"); - continue; - } sheet->AsGecko()->GetTitle(title); if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) { return; @@ -2193,23 +2189,18 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet) } } - if (aStyleSet->IsGecko()) { - nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); - if (sheetService) { - for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { - aStyleSet->AppendStyleSheet(SheetType::Doc, sheet); - } + nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); + if (sheetService) { + for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { + aStyleSet->AppendStyleSheet(SheetType::Doc, sheet); } + } - // Iterate backwards to maintain order - for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) { - if (sheet->IsApplicable()) { - aStyleSet->PrependStyleSheet(SheetType::Agent, sheet); - } + // Iterate backwards to maintain order + for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) { + if (sheet->IsApplicable()) { + aStyleSet->PrependStyleSheet(SheetType::Agent, sheet); } - } else { - NS_WARNING("stylo: Not yet checking nsStyleSheetService for Servo-backed " - "documents. See bug 1290224"); } AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAgentSheet], @@ -3850,11 +3841,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet) className##Init init; \ init.mBubbles = true; \ init.mCancelable = true; \ - /* XXXheycam ServoStyleSheet doesn't implement DOM interfaces yet */ \ - if (aSheet->IsServo()) { \ - NS_ERROR("stylo: can't dispatch events for ServoStyleSheets yet"); \ - } \ - init.mStylesheet = aSheet->IsGecko() ? aSheet->AsGecko() : nullptr; \ + init.mStylesheet = aSheet->AsGecko(); \ init.memberName = argName; \ \ RefPtr event = \ @@ -5623,12 +5610,6 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet) StyleSheet* sheet = SheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); - // XXXheycam Make this work with ServoStyleSheets. - if (sheet->IsServo()) { - NS_ERROR("stylo: can't handle alternate ServoStyleSheets yet"); - continue; - } - bool disabled; sheet->AsGecko()->GetDisabled(&disabled); if (disabled) { @@ -5743,12 +5724,6 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet, StyleSheet* sheet = SheetAt(index); NS_ASSERTION(sheet, "Null sheet in sheet list!"); - // XXXheycam Make this work with ServoStyleSheets. - if (sheet->IsServo()) { - NS_ERROR("stylo: can't handle alternate ServoStyleSheets yet"); - continue; - } - sheet->AsGecko()->GetTitle(title); if (!title.IsEmpty()) { sheet->AsGecko()->SetEnabled(title.Equals(aSheetSet)); @@ -9471,17 +9446,12 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) RefPtr sheet = SheetAt(i); if (sheet) { if (sheet->IsApplicable()) { - // XXXheycam Need to make ServoStyleSheet cloning work. - if (sheet->IsGecko()) { - RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); - NS_WARNING_ASSERTION(clonedSheet, - "Cloning a stylesheet didn't work!"); - if (clonedSheet) { - clonedDoc->AddStyleSheet(clonedSheet); - } - } else { - NS_ERROR("stylo: ServoStyleSheet doesn't support cloning"); + RefPtr clonedSheet = + sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); + NS_WARNING_ASSERTION(clonedSheet, + "Cloning a stylesheet didn't work!"); + if (clonedSheet) { + clonedDoc->AddStyleSheet(clonedSheet); } } } @@ -9491,17 +9461,12 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) { if (sheet) { if (sheet->IsApplicable()) { - // XXXheycam Need to make ServoStyleSheet cloning work. - if (sheet->IsGecko()) { - RefPtr clonedSheet = - sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); - NS_WARNING_ASSERTION(clonedSheet, - "Cloning a stylesheet didn't work!"); - if (clonedSheet) { - clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet); - } - } else { - NS_ERROR("stylo: ServoStyleSheet doesn't support cloning"); + RefPtr clonedSheet = + sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr); + NS_WARNING_ASSERTION(clonedSheet, + "Cloning a stylesheet didn't work!"); + if (clonedSheet) { + clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet); } } } @@ -12203,14 +12168,8 @@ nsIDocument::FlushUserFontSet() nsTArray rules; nsIPresShell* shell = GetShell(); if (shell) { - // XXXheycam ServoStyleSets don't support exposing @font-face rules yet. - if (shell->StyleSet()->IsGecko()) { - if (!shell->StyleSet()->AsGecko()->AppendFontFaceRules(rules)) { - return; - } - } else { - NS_WARNING("stylo: ServoStyleSets cannot handle @font-face rules yet. " - "See bug 1290237."); + if (!shell->StyleSet()->AsGecko()->AppendFontFaceRules(rules)) { + return; } } diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index cfc074ba28..707d36a510 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -319,14 +319,9 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument, return NS_OK; } - // XXXheycam ServoStyleSheets do not support