--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -1003,32 +1003,31 @@ KeyframeEffectReadOnly::GetKeyframes(JSC
MOZ_ASSERT(aResult.IsEmpty());
MOZ_ASSERT(!aRv.Failed());
if (!aResult.SetCapacity(mKeyframes.Length(), mozilla::fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
- bool isServo = mDocument->IsStyledByServo();
bool isCSSAnimation = mAnimation && mAnimation->AsCSSAnimation();
// For Servo, when we have CSS Animation @keyframes with variables, we convert
// shorthands to longhands if needed, and store a reference to the unparsed
// value. When it comes time to serialize, however, what do you serialize for
// a longhand that comes from a variable reference in a shorthand? Servo says,
// "an empty string" which is not particularly helpful.
//
// We should just store shorthands as-is (bug 1391537) and then return the
// variable references, but for now, since we don't do that, and in order to
// be consistent with Gecko, we just expand the variables (assuming we have
// enough context to do so). For that we need to grab the style context so we
// know what custom property values to provide.
RefPtr<ComputedStyle> computedStyle;
- if (isServo && isCSSAnimation) {
+ if (isCSSAnimation) {
// The following will flush style but that's ok since if you update
// a variable's computed value, you expect to see that updated value in the
// result of getKeyframes().
//
// If we don't have a target, the following will return null. In that case
// we might end up returning variables as-is or empty string. That should be
// acceptable however, since such a case is rare and this is only
// short-term (and unshipped) behavior until bug 1391537 is fixed.
@@ -1059,54 +1058,50 @@ KeyframeEffectReadOnly::GetKeyframes(JSC
return;
}
RefPtr<RawServoDeclarationBlock> customProperties;
// A workaround for CSS Animations in servo backend, custom properties in
// keyframe are stored in a servo's declaration block. Find the declaration
// block to resolve CSS variables in the keyframe.
// This workaround will be solved by bug 1391537.
- if (isServo && isCSSAnimation) {
+ if (isCSSAnimation) {
for (const PropertyValuePair& propertyValue : keyframe.mPropertyValues) {
if (propertyValue.mProperty ==
nsCSSPropertyID::eCSSPropertyExtra_variable) {
customProperties = propertyValue.mServoDeclarationBlock;
break;
}
}
}
JS::Rooted<JSObject*> keyframeObject(aCx, &keyframeJSValue.toObject());
for (const PropertyValuePair& propertyValue : keyframe.mPropertyValues) {
nsAutoString stringValue;
- if (isServo) {
- // Don't serialize the custom properties for this keyframe.
- if (propertyValue.mProperty ==
- nsCSSPropertyID::eCSSPropertyExtra_variable) {
- continue;
+ // Don't serialize the custom properties for this keyframe.
+ if (propertyValue.mProperty ==
+ nsCSSPropertyID::eCSSPropertyExtra_variable) {
+ continue;
+ }
+ if (propertyValue.mServoDeclarationBlock) {
+ Servo_DeclarationBlock_SerializeOneValue(
+ propertyValue.mServoDeclarationBlock,
+ propertyValue.mProperty,
+ &stringValue,
+ computedStyle,
+ customProperties);
+ } else {
+ RawServoAnimationValue* value =
+ mBaseStyleValuesForServo.GetWeak(propertyValue.mProperty);
+
+ if (value) {
+ Servo_AnimationValue_Serialize(value,
+ propertyValue.mProperty,
+ &stringValue);
}
- if (propertyValue.mServoDeclarationBlock) {
- Servo_DeclarationBlock_SerializeOneValue(
- propertyValue.mServoDeclarationBlock,
- propertyValue.mProperty,
- &stringValue,
- computedStyle,
- customProperties);
- } else {
- RawServoAnimationValue* value =
- mBaseStyleValuesForServo.GetWeak(propertyValue.mProperty);
-
- if (value) {
- Servo_AnimationValue_Serialize(value,
- propertyValue.mProperty,
- &stringValue);
- }
- }
- } else {
- MOZ_CRASH("old style system disabled");
}
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
JS::Rooted<JS::Value> value(aCx);
if (!ToJSValue(aCx, stringValue, &value) ||
!JS_DefineProperty(aCx, keyframeObject, name, value,
JSPROP_ENUMERATE)) {
aRv.Throw(NS_ERROR_FAILURE);
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -256,24 +256,20 @@ public:
// Returns true if the effect is current state and has scale animation.
// |aFrame| is used for calculation of scale values.
bool ContainsAnimatedScale(const nsIFrame* aFrame) const;
AnimationValue BaseStyle(nsCSSPropertyID aProperty) const
{
AnimationValue result;
bool hasProperty = false;
- if (mDocument->IsStyledByServo()) {
- // We cannot use getters_AddRefs on RawServoAnimationValue because it is
- // an incomplete type, so Get() doesn't work. Instead, use GetWeak, and
- // then assign the raw pointer to a RefPtr.
- result.mServo = mBaseStyleValuesForServo.GetWeak(aProperty, &hasProperty);
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ // We cannot use getters_AddRefs on RawServoAnimationValue because it is
+ // an incomplete type, so Get() doesn't work. Instead, use GetWeak, and
+ // then assign the raw pointer to a RefPtr.
+ result.mServo = mBaseStyleValuesForServo.GetWeak(aProperty, &hasProperty);
MOZ_ASSERT(hasProperty || result.IsNull());
return result;
}
protected:
KeyframeEffectReadOnly(nsIDocument* aDocument,
const Maybe<OwningAnimationTarget>& aTarget,
AnimationEffectTimingReadOnly* aTiming,
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -872,31 +872,27 @@ ReportInvalidPropertyValueToConsole(nsCS
*/
static Maybe<PropertyValuePair>
MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
nsCSSParser& aParser, nsIDocument* aDocument)
{
MOZ_ASSERT(aDocument);
Maybe<PropertyValuePair> result;
- if (aDocument->GetStyleBackendType() == StyleBackendType::Servo) {
- ServoCSSParser::ParsingEnvironment env =
- ServoCSSParser::GetParsingEnvironment(aDocument);
- RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
- ServoCSSParser::ParseProperty(aProperty, aStringValue, env);
+ ServoCSSParser::ParsingEnvironment env =
+ ServoCSSParser::GetParsingEnvironment(aDocument);
+ RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
+ ServoCSSParser::ParseProperty(aProperty, aStringValue, env);
- if (servoDeclarationBlock) {
- result.emplace(aProperty, Move(servoDeclarationBlock));
- } else {
- ReportInvalidPropertyValueToConsole(aProperty, aStringValue, aDocument);
- }
- return result;
+ if (servoDeclarationBlock) {
+ result.emplace(aProperty, Move(servoDeclarationBlock));
+ } else {
+ ReportInvalidPropertyValueToConsole(aProperty, aStringValue, aDocument);
}
-
- MOZ_CRASH("old style system disabled");
+ return result;
}
/**
* Checks that the given keyframes are loosely ordered (each keyframe's
* offset that is not null is greater than or equal to the previous
* non-null offset) and that all values are within the range [0.0, 1.0].
*
* @return true if the keyframes' offsets are correctly ordered and
@@ -943,17 +939,16 @@ MarkAsComputeValuesFailureKey(PropertyVa
* The variation of the above function. This is for Servo backend.
*/
static nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ComputedStyle* aComputedStyle)
{
MOZ_ASSERT(aElement);
- MOZ_ASSERT(aElement->IsStyledByServo());
nsTArray<ComputedKeyframeValues> result;
nsPresContext* presContext = nsContentUtils::GetContextForContent(aElement);
if (!presContext) {
// This has been reported to happen with some combinations of content
// (particularly involving resize events and layout flushes? See bug 1407898
// and bug 1408420) but no reproducible steps have been found.
@@ -1463,40 +1458,33 @@ RequiresAdditiveAnimation(const nsTArray
properties.AddProperty(aProperty);
if (aOffset == 0.0) {
propertiesWithFromValue.AddProperty(aProperty);
} else if (aOffset == 1.0) {
propertiesWithToValue.AddProperty(aProperty);
}
};
- StyleBackendType styleBackend = aDocument->GetStyleBackendType();
-
for (size_t i = 0, len = aKeyframes.Length(); i < len; i++) {
const Keyframe& frame = aKeyframes[i];
// We won't have called DistributeKeyframes when this is called so
// we can't use frame.mComputedOffset. Instead we do a rough version
// of that algorithm that substitutes null offsets with 0.0 for the first
// frame, 1.0 for the last frame, and 0.5 for everything else.
double computedOffset = i == len - 1
? 1.0
: i == 0 ? 0.0 : 0.5;
double offsetToUse = frame.mOffset
? frame.mOffset.value()
: computedOffset;
for (const PropertyValuePair& pair : frame.mPropertyValues) {
if (nsCSSProps::IsShorthand(pair.mProperty)) {
- if (styleBackend == StyleBackendType::Gecko) {
- MOZ_CRASH("old style system disabled");
- }
-
- MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
- pair.mServoDeclarationBlock);
+ MOZ_ASSERT(pair.mServoDeclarationBlock);
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
prop, pair.mProperty, CSSEnabledState::eForAllContent) {
addToPropertySets(*prop, offsetToUse);
}
} else {
addToPropertySets(pair.mProperty, offsetToUse);
}
}
--- a/dom/animation/TimingParams.cpp
+++ b/dom/animation/TimingParams.cpp
@@ -111,34 +111,28 @@ TimingParams::FromOptionsUnion(
/* static */ Maybe<ComputedTimingFunction>
TimingParams::ParseEasing(const nsAString& aEasing,
nsIDocument* aDocument,
ErrorResult& aRv)
{
MOZ_ASSERT(aDocument);
- if (aDocument->IsStyledByServo()) {
- nsTimingFunction timingFunction;
- RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(aDocument);
- if (!ServoCSSParser::ParseEasing(aEasing, url, timingFunction)) {
- aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
- return Nothing();
- }
-
- if (timingFunction.mType == nsTimingFunction::Type::Linear) {
- return Nothing();
- }
-
- return Some(ComputedTimingFunction(timingFunction));
+ nsTimingFunction timingFunction;
+ RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(aDocument);
+ if (!ServoCSSParser::ParseEasing(aEasing, url, timingFunction)) {
+ aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
+ return Nothing();
}
- MOZ_CRASH("old style system disabled");
+ if (timingFunction.mType == nsTimingFunction::Type::Linear) {
+ return Nothing();
+ }
- return Nothing();
+ return Some(ComputedTimingFunction(timingFunction));
}
bool
TimingParams::operator==(const TimingParams& aOther) const
{
// We don't compare mActiveDuration and mEndTime because they are calculated
// from other timing parameters.
return mDuration == aOther.mDuration &&
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -111,22 +111,18 @@ DOMIntersectionObserver::Constructor(con
}
return observer.forget();
}
bool
DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
{
- if (mDocument && mDocument->IsStyledByServo()) {
- return ServoCSSParser::ParseIntersectionObserverRootMargin(aString,
- &mRootMargin);
- }
-
- MOZ_CRASH("old style system disabled");
+ return ServoCSSParser::ParseIntersectionObserverRootMargin(aString,
+ &mRootMargin);
}
void
DOMIntersectionObserver::GetRootMargin(mozilla::dom::DOMString& aRetVal)
{
mRootMargin.AppendToString(eCSSProperty_DOM, aRetVal);
}
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -339,38 +339,27 @@ DOMMatrixReadOnly::Stringify(nsAString&
AppendFloat(matrixStr, E()); matrixStr.AppendLiteral(", ");
AppendFloat(matrixStr, F());
matrixStr.AppendLiteral(")");
}
aResult = matrixStr;
}
-static bool
-IsStyledByServo(JSContext* aContext)
-{
- nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aContext);
- nsIDocument* doc = win ? win->GetDoc() : nullptr;
- return doc ? doc->IsStyledByServo() : false;
-}
-
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
- RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv)
{
- RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
-
+ RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
obj = obj->SetMatrixValue(aTransformList, aRv);
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOther, ErrorResult& aRv)
{
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), aOther);
@@ -406,40 +395,37 @@ template <typename T> void SetDataInMatr
} else {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
}
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv)
{
- RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
aArray32.ComputeLengthAndData();
SetDataInMatrix(obj, aArray32.Data(), aArray32.Length(), aRv);
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv)
{
- RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
aArray64.ComputeLengthAndData();
SetDataInMatrix(obj, aArray64.Data(), aArray64.Length(), aRv);
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv)
{
- RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
SetDataInMatrix(obj, aNumberSequence.Elements(), aNumberSequence.Length(), aRv);
return obj.forget();
}
void DOMMatrix::Ensure3DMatrix()
{
if (!mMatrix3D) {
@@ -672,25 +658,21 @@ DOMMatrix::SetMatrixValue(const nsAStrin
{
// An empty string is a no-op.
if (aTransformList.IsEmpty()) {
return this;
}
gfx::Matrix4x4 transform;
bool contains3dTransform = false;
- if (mIsServo) {
- if (!ServoCSSParser::ParseTransformIntoMatrix(aTransformList,
- contains3dTransform,
- transform.components)) {
- aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
- return nullptr;
- }
- } else {
- MOZ_CRASH("old style system disabled");
+ if (!ServoCSSParser::ParseTransformIntoMatrix(aTransformList,
+ contains3dTransform,
+ transform.components)) {
+ aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
+ return nullptr;
}
if (!contains3dTransform) {
mMatrix3D = nullptr;
mMatrix2D = new gfx::Matrix();
SetA(transform._11);
SetB(transform._12);
--- a/dom/base/DOMMatrix.h
+++ b/dom/base/DOMMatrix.h
@@ -23,35 +23,34 @@ namespace dom {
class GlobalObject;
class DOMMatrix;
class DOMPoint;
struct DOMPointInit;
class DOMMatrixReadOnly : public nsWrapperCache
{
public:
- DOMMatrixReadOnly(nsISupports* aParent, bool aIsServo)
- : mParent(aParent), mMatrix2D(new gfx::Matrix()), mIsServo(aIsServo)
+ explicit DOMMatrixReadOnly(nsISupports* aParent)
+ : mParent(aParent)
+ , mMatrix2D(new gfx::Matrix())
{
}
DOMMatrixReadOnly(nsISupports* aParent, const DOMMatrixReadOnly& other)
- : mParent(aParent), mIsServo(other.mIsServo)
+ : mParent(aParent)
{
if (other.mMatrix2D) {
mMatrix2D = new gfx::Matrix(*other.mMatrix2D);
} else {
mMatrix3D = new gfx::Matrix4x4(*other.mMatrix3D);
}
}
- DOMMatrixReadOnly(nsISupports* aParent,
- const gfx::Matrix4x4& aMatrix,
- bool aIsServo)
- : mParent(aParent), mIsServo(aIsServo)
+ DOMMatrixReadOnly(nsISupports* aParent, const gfx::Matrix4x4& aMatrix)
+ : mParent(aParent)
{
mMatrix3D = new gfx::Matrix4x4(aMatrix);
}
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMMatrixReadOnly)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMMatrixReadOnly)
#define GetMatrixMember(entry2D, entry3D, default) \
@@ -138,39 +137,38 @@ public:
void ToFloat64Array(JSContext* aCx,
JS::MutableHandle<JSObject*> aResult,
ErrorResult& aRv) const;
void Stringify(nsAString& aResult);
protected:
nsCOMPtr<nsISupports> mParent;
nsAutoPtr<gfx::Matrix> mMatrix2D;
nsAutoPtr<gfx::Matrix4x4> mMatrix3D;
- bool mIsServo;
virtual ~DOMMatrixReadOnly() {}
private:
DOMMatrixReadOnly() = delete;
DOMMatrixReadOnly(const DOMMatrixReadOnly&) = delete;
DOMMatrixReadOnly& operator=(const DOMMatrixReadOnly&) = delete;
};
class DOMMatrix : public DOMMatrixReadOnly
{
public:
- DOMMatrix(nsISupports* aParent, bool aIsServo)
- : DOMMatrixReadOnly(aParent, aIsServo)
+ explicit DOMMatrix(nsISupports* aParent)
+ : DOMMatrixReadOnly(aParent)
{}
DOMMatrix(nsISupports* aParent, const DOMMatrixReadOnly& other)
: DOMMatrixReadOnly(aParent, other)
{}
- DOMMatrix(nsISupports* aParent, const gfx::Matrix4x4& aMatrix, bool aIsServo)
- : DOMMatrixReadOnly(aParent, aMatrix, aIsServo)
+ DOMMatrix(nsISupports* aParent, const gfx::Matrix4x4& aMatrix)
+ : DOMMatrixReadOnly(aParent, aMatrix)
{}
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOther, ErrorResult& aRv);
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1880,20 +1880,19 @@ Element::UnbindFromTree(bool aDeep, bool
"RemovedFullscreenElement");
// Fully exit full-screen.
nsIDocument::ExitFullscreenInDocTree(OwnerDoc());
}
if (HasServoData()) {
MOZ_ASSERT(document);
MOZ_ASSERT(IsInAnonymousSubtree());
- MOZ_ASSERT(document && document->IsStyledByServo());
- }
-
- if (document && document->IsStyledByServo()) {
+ }
+
+ if (document) {
ClearServoData(document);
}
if (aNullParent) {
if (GetParent() && GetParent()->IsInUncomposedDoc()) {
// Update the editable descendant count in the ancestors before we
// lose the reference to the parent.
int32_t editableDescendantChange = -1 * EditableInclusiveDescendantCount(this);
@@ -2055,17 +2054,17 @@ Element::UnbindFromTree(bool aDeep, bool
for (nsIContent* child = shadowRoot->GetFirstChild(); child;
child = child->GetNextSibling()) {
child->UnbindFromTree(true, false);
}
shadowRoot->SetIsComposedDocParticipant(false);
}
- MOZ_ASSERT_IF(IsStyledByServo(), !HasAnyOfFlags(kAllServoDescendantBits));
+ MOZ_ASSERT(!HasAnyOfFlags(kAllServoDescendantBits));
MOZ_ASSERT(!document || document->GetServoRestyleRoot() != this);
}
nsDOMCSSAttributeDeclaration*
Element::GetSMILOverrideStyle()
{
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
@@ -3628,49 +3627,49 @@ Element::GetTransformToAncestor(Element&
if (primaryFrame) {
// If aAncestor is not actually an ancestor of this (including nullptr),
// then the call to GetTransformToAncestor will return the transform
// all the way up through the parent chain.
transform = nsLayoutUtils::GetTransformToAncestor(primaryFrame,
ancestorFrame, nsIFrame::IN_CSS_UNITS).GetMatrix();
}
- DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform, IsStyledByServo());
+ DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform);
RefPtr<DOMMatrixReadOnly> result(matrix);
return result.forget();
}
already_AddRefed<DOMMatrixReadOnly>
Element::GetTransformToParent()
{
nsIFrame* primaryFrame = GetPrimaryFrame();
Matrix4x4 transform;
if (primaryFrame) {
nsIFrame* parentFrame = primaryFrame->GetParent();
transform = nsLayoutUtils::GetTransformToAncestor(primaryFrame,
parentFrame, nsIFrame::IN_CSS_UNITS).GetMatrix();
}
- DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform, IsStyledByServo());
+ DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform);
RefPtr<DOMMatrixReadOnly> result(matrix);
return result.forget();
}
already_AddRefed<DOMMatrixReadOnly>
Element::GetTransformToViewport()
{
nsIFrame* primaryFrame = GetPrimaryFrame();
Matrix4x4 transform;
if (primaryFrame) {
transform = nsLayoutUtils::GetTransformToAncestor(primaryFrame,
nsLayoutUtils::GetDisplayRootFrame(primaryFrame), nsIFrame::IN_CSS_UNITS).GetMatrix();
}
- DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform, IsStyledByServo());
+ DOMMatrixReadOnly* matrix = new DOMMatrix(this, transform);
RefPtr<DOMMatrixReadOnly> result(matrix);
return result.forget();
}
already_AddRefed<Animation>
Element::Animate(JSContext* aContext,
JS::Handle<JSObject*> aKeyframes,
const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
@@ -4295,17 +4294,16 @@ Element::UpdateIntersectionObservation(D
updated = entry.Data() != aThreshold;
entry.Data() = aThreshold;
}
return updated;
}
void
Element::ClearServoData(nsIDocument* aDoc) {
- MOZ_ASSERT(IsStyledByServo());
MOZ_ASSERT(aDoc);
if (HasServoData()) {
Servo_Element_ClearData(this);
} else {
UnsetFlags(kAllServoDescendantBits | NODE_NEEDS_FRAME);
}
// Since this element is losing its servo data, nothing under it may have
// servo data either, so we can forget restyles rooted at this element. This
@@ -4487,17 +4485,16 @@ PropagateBits(Element* aElement, uint32_
//
// Note that, since we track a root, we try to optimize the case where an
// element under the current root is dirtied, that's why we don't trivially use
// `nsContentUtils::GetCommonFlattenedTreeAncestorForStyle`.
static void
NoteDirtyElement(Element* aElement, uint32_t aBits)
{
MOZ_ASSERT(aElement->IsInComposedDoc());
- MOZ_ASSERT(aElement->IsStyledByServo());
// Check the existing root early on, since it may allow us to short-circuit
// before examining the parent chain.
nsIDocument* doc = aElement->GetComposedDoc();
nsINode* existingRoot = doc->GetServoRestyleRoot();
if (existingRoot == aElement) {
doc->SetServoRestyleRootDirtyBits(doc->GetServoRestyleRootDirtyBits() | aBits);
return;
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -464,42 +464,36 @@ public:
void NoteDirtySubtreeForServo();
void NoteDirtyForServo();
void NoteAnimationOnlyDirtyForServo();
void NoteDescendantsNeedFramesForServo();
bool HasDirtyDescendantsForServo() const
{
- MOZ_ASSERT(IsStyledByServo());
return HasFlag(ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void SetHasDirtyDescendantsForServo() {
- MOZ_ASSERT(IsStyledByServo());
SetFlags(ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void UnsetHasDirtyDescendantsForServo() {
- MOZ_ASSERT(IsStyledByServo());
UnsetFlags(ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
bool HasAnimationOnlyDirtyDescendantsForServo() const {
- MOZ_ASSERT(IsStyledByServo());
return HasFlag(ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO);
}
void SetHasAnimationOnlyDirtyDescendantsForServo() {
- MOZ_ASSERT(IsStyledByServo());
SetFlags(ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO);
}
void UnsetHasAnimationOnlyDirtyDescendantsForServo() {
- MOZ_ASSERT(IsStyledByServo());
UnsetFlags(ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO);
}
bool HasServoData() const {
return !!mServoData.Get();
}
void ClearServoData() { ClearServoData(GetComposedDoc()); }
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1248,17 +1248,17 @@ FragmentOrElement::DestroyContent()
nsIDocument* document = OwnerDoc();
// Drop any servo data. We do this before the RemovedFromDocument call below
// so that it doesn't need to try to keep the style state sane when shuffling
// around the flattened tree.
//
// TODO(emilio): I suspect this can be asserted against instead, with a bit of
// effort to avoid calling nsDocument::Destroy with a shell...
- if (IsElement() && document->IsStyledByServo()) {
+ if (IsElement()) {
AsElement()->ClearServoData();
}
document->BindingManager()->RemovedFromDocument(this, document,
nsBindingManager::eRunDtor);
document->ClearBoxObjectFor(this);
uint32_t i, count = mAttrsAndChildren.ChildCount();
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -235,23 +235,19 @@ ResponsiveImageSelector::ClearSelectedCa
mSelectedCandidateURL = nullptr;
}
bool
ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
{
ClearSelectedCandidate();
- if (Document()->IsStyledByServo()) {
- NS_ConvertUTF16toUTF8 sizes(aSizes);
- mServoSourceSizeList.reset(Servo_SourceSizeList_Parse(&sizes));
- return !!mServoSourceSizeList;
- }
-
- MOZ_CRASH("old style system disabled");
+ NS_ConvertUTF16toUTF8 sizes(aSizes);
+ mServoSourceSizeList.reset(Servo_SourceSizeList_Parse(&sizes));
+ return !!mServoSourceSizeList;
}
void
ResponsiveImageSelector::AppendCandidateIfUnique(const ResponsiveImageCandidate & aCandidate)
{
int numCandidates = mCandidates.Length();
// With the exception of Default, which should not be added until we are done
@@ -439,23 +435,19 @@ ResponsiveImageSelector::ComputeFinalWid
{
nsIDocument* doc = Document();
nsIPresShell* presShell = doc->GetShell();
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
if (!pctx) {
return false;
}
- nscoord effectiveWidth;
- if (doc->IsStyledByServo()) {
- effectiveWidth = presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
+ nscoord effectiveWidth =
+ presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
mServoSourceSizeList.get());
- } else {
- MOZ_CRASH("old style system disabled");
- }
*aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
return true;
}
ResponsiveImageCandidate::ResponsiveImageCandidate()
{
mType = eCandidateType_Invalid;
--- a/dom/base/WebKitCSSMatrix.cpp
+++ b/dom/base/WebKitCSSMatrix.cpp
@@ -12,47 +12,35 @@
#include "nsPresContext.h"
#include "nsGlobalWindowInner.h"
namespace mozilla {
namespace dom {
static const double sRadPerDegree = 2.0 * M_PI / 360.0;
-static bool
-IsStyledByServo(JSContext* aContext)
-{
- nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aContext);
- nsIDocument* doc = win ? win->GetDoc() : nullptr;
- return doc ? doc->IsStyledByServo() : false;
-}
-
bool
WebKitCSSMatrix::FeatureEnabled(JSContext* aCx, JSObject* aObj)
{
return Preferences::GetBool("layout.css.DOMMatrix.enabled", false) &&
Preferences::GetBool("layout.css.prefixes.webkit", false);
}
already_AddRefed<WebKitCSSMatrix>
WebKitCSSMatrix::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
- RefPtr<WebKitCSSMatrix> obj =
- new WebKitCSSMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<WebKitCSSMatrix> obj = new WebKitCSSMatrix(aGlobal.GetAsSupports());
return obj.forget();
}
already_AddRefed<WebKitCSSMatrix>
WebKitCSSMatrix::Constructor(const GlobalObject& aGlobal,
const nsAString& aTransformList, ErrorResult& aRv)
{
- RefPtr<WebKitCSSMatrix> obj =
- new WebKitCSSMatrix(aGlobal.GetAsSupports(),
- IsStyledByServo(aGlobal.Context()));
+ RefPtr<WebKitCSSMatrix> obj = new WebKitCSSMatrix(aGlobal.GetAsSupports());
obj = obj->SetMatrixValue(aTransformList, aRv);
return obj.forget();
}
already_AddRefed<WebKitCSSMatrix>
WebKitCSSMatrix::Constructor(const GlobalObject& aGlobal,
const DOMMatrixReadOnly& aOther, ErrorResult& aRv)
{
--- a/dom/base/WebKitCSSMatrix.h
+++ b/dom/base/WebKitCSSMatrix.h
@@ -10,18 +10,18 @@
#include "mozilla/dom/DOMMatrix.h"
namespace mozilla {
namespace dom {
class WebKitCSSMatrix final : public DOMMatrix
{
public:
- WebKitCSSMatrix(nsISupports* aParent, bool aIsServo)
- : DOMMatrix(aParent, aIsServo)
+ WebKitCSSMatrix(nsISupports* aParent)
+ : DOMMatrix(aParent)
{}
WebKitCSSMatrix(nsISupports* aParent, const DOMMatrixReadOnly& other)
: DOMMatrix(aParent, other)
{}
static bool FeatureEnabled(JSContext* aCx, JSObject* aObj);
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -4351,18 +4351,17 @@ nsDOMWindowUtils::EnsureDirtyRootFrame()
presShell->FrameNeedsReflow(frame, nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIsStyledByServo(bool* aStyledByServo)
{
- nsIDocument* doc = GetDocument();
- *aStyledByServo = doc && doc->IsStyledByServo();
+ *aStyledByServo = true;
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)
NS_INTERFACE_MAP_END
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -4018,20 +4018,18 @@ nsIDocument::DeleteShell()
// no point on it.
MarkUserFontSetDirty();
nsIPresShell* oldShell = mPresShell;
mPresShell = nullptr;
UpdateFrameRequestCallbackSchedulingState(oldShell);
mStyleSetFilled = false;
- if (IsStyledByServo()) {
- ClearStaleServoData();
- AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
- }
+ ClearStaleServoData();
+ AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
}
void
nsIDocument::SetBFCacheEntry(nsIBFCacheEntry* aEntry)
{
MOZ_ASSERT(IsBFCachingAllowed() || !aEntry, "You should have checked!");
if (mPresShell) {
@@ -4304,17 +4302,16 @@ nsIDocument::EnsureOnDemandBuiltInUAShee
AddOnDemandBuiltInUASheet(aSheet);
EndUpdate(UPDATE_STYLE);
}
void
nsIDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet)
{
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(aSheet));
- MOZ_DIAGNOSTIC_ASSERT(aSheet->IsServo() == IsStyledByServo());
// Prepend here so that we store the sheets in mOnDemandBuiltInUASheets in
// the same order that they should end up in the style set.
mOnDemandBuiltInUASheets.InsertElementAt(0, aSheet);
if (aSheet->IsApplicable()) {
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
nsCOMPtr<nsIPresShell> shell = GetShell();
@@ -4328,17 +4325,16 @@ nsIDocument::AddOnDemandBuiltInUASheet(S
}
NotifyStyleSheetAdded(aSheet, false);
}
void
nsIDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
{
- MOZ_DIAGNOSTIC_ASSERT(aSheet->IsServo() == IsStyledByServo());
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
}
}
#define DO_STYLESHEET_NOTIFICATION(className, type, memberName, argName) \
do { \
@@ -4383,17 +4379,16 @@ nsIDocument::NotifyStyleSheetRemoved(Sty
aDocumentSheet);
}
}
void
nsIDocument::AddStyleSheet(StyleSheet* aSheet)
{
MOZ_ASSERT(aSheet);
- MOZ_DIAGNOSTIC_ASSERT(aSheet->IsServo() == IsStyledByServo());
mStyleSheets.AppendElement(aSheet);
aSheet->SetAssociatedDocument(this, StyleSheet::OwnedByDocument);
if (aSheet->IsApplicable()) {
AddStyleSheetToStyleSets(aSheet);
}
NotifyStyleSheetAdded(aSheet, true);
@@ -4449,17 +4444,16 @@ nsIDocument::UpdateStyleSheets(nsTArray<
// First remove the old sheet.
NS_ASSERTION(oldSheet, "None of the old sheets should be null");
int32_t oldIndex = mStyleSheets.IndexOf(oldSheet);
RemoveStyleSheet(oldSheet); // This does the right notifications
// Now put the new one in its place. If it's null, just ignore it.
StyleSheet* newSheet = aNewSheets[i];
if (newSheet) {
- MOZ_DIAGNOSTIC_ASSERT(newSheet->IsServo() == IsStyledByServo());
mStyleSheets.InsertElementAt(oldIndex, newSheet);
newSheet->SetAssociatedDocument(this, StyleSheet::OwnedByDocument);
if (newSheet->IsApplicable()) {
AddStyleSheetToStyleSets(newSheet);
}
NotifyStyleSheetAdded(newSheet, true);
}
@@ -4467,17 +4461,16 @@ nsIDocument::UpdateStyleSheets(nsTArray<
EndUpdate(UPDATE_STYLE);
}
void
nsIDocument::InsertStyleSheetAt(StyleSheet* aSheet, size_t aIndex)
{
MOZ_ASSERT(aSheet);
- MOZ_DIAGNOSTIC_ASSERT(aSheet->IsServo() == IsStyledByServo());
// FIXME(emilio): Stop touching DocumentOrShadowRoot's members directly, and use an
// accessor.
mStyleSheets.InsertElementAt(aIndex, aSheet);
aSheet->SetAssociatedDocument(this, StyleSheet::OwnedByDocument);
if (aSheet->IsApplicable()) {
@@ -4489,19 +4482,16 @@ nsIDocument::InsertStyleSheetAt(StyleShe
void
nsIDocument::SetStyleSheetApplicableState(StyleSheet* aSheet, bool aApplicable)
{
NS_PRECONDITION(aSheet, "null arg");
// If we're actually in the document style sheet list
- //
- // FIXME(emilio): Shadow DOM.
- MOZ_DIAGNOSTIC_ASSERT(aSheet->IsServo() == IsStyledByServo());
if (mStyleSheets.IndexOf(aSheet) != mStyleSheets.NoIndex) {
if (aApplicable) {
AddStyleSheetToStyleSets(aSheet);
} else {
RemoveStyleSheetFromStyleSets(aSheet);
}
}
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1689,21 +1689,16 @@ public:
return mCSSLoader;
}
mozilla::StyleBackendType GetStyleBackendType() const
{
return mozilla::StyleBackendType::Servo;
}
- bool IsStyledByServo() const
- {
- return GetStyleBackendType() == mozilla::StyleBackendType::Servo;
- }
-
/**
* Get this document's StyleImageLoader. This is guaranteed to not return null.
*/
mozilla::css::ImageLoader* StyleImageLoader() const {
return mStyleImageLoader;
}
/**
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2479,17 +2479,16 @@ nsINode::Length() const
}
const RawServoSelectorList*
nsINode::ParseServoSelectorList(
const nsAString& aSelectorString,
ErrorResult& aRv)
{
nsIDocument* doc = OwnerDoc();
- MOZ_ASSERT(doc->IsStyledByServo());
nsIDocument::SelectorCache& cache =
doc->GetSelectorCache(mozilla::StyleBackendType::Servo);
nsIDocument::SelectorCache::SelectorList* list =
cache.GetList(aSelectorString);
if (list) {
if (!*list) {
// Invalid selector.
@@ -2749,22 +2748,16 @@ nsINode::IsApzAware() const
}
bool
nsINode::IsNodeApzAwareInternal() const
{
return EventTarget::IsApzAware();
}
-bool
-nsINode::IsStyledByServo() const
-{
- return OwnerDoc()->IsStyledByServo();
-}
-
DocGroup*
nsINode::GetDocGroup() const
{
return OwnerDoc()->GetDocGroup();
}
class LocalizationHandler : public PromiseNativeHandler
{
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -1035,24 +1035,16 @@ public:
using nsIDOMEventTarget::AddSystemEventListener;
virtual bool IsApzAware() const override;
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
virtual nsIGlobalObject* GetOwnerGlobal() const override;
/**
- * Returns true if this is a node belonging to a document that uses the Servo
- * style system.
- */
- bool IsStyledByServo() const;
-
- inline void UnsetRestyleFlagsIfGecko();
-
- /**
* Adds a mutation observer to be notified when this node, or any of its
* descendants, are modified. The node will hold a weak reference to the
* observer, which means that it is the responsibility of the observer to
* remove itself in case it dies before the node. If an observer is added
* while observers are being notified, it may also be notified. In general,
* adding observers while inside a notification is not a good idea. An
* observer that is already observing the node must not be added without
* being removed first.
@@ -2071,20 +2063,17 @@ protected:
*/
template<typename Ret, typename ServoFunctor, typename GeckoFunctor>
Ret WithSelectorList(
const nsAString& aSelectorString,
mozilla::ErrorResult& aRv,
const ServoFunctor& aServoFunctor,
const GeckoFunctor& aGeckoFunctor)
{
- if (IsStyledByServo()) {
- return aServoFunctor(ParseServoSelectorList(aSelectorString, aRv));
- }
- MOZ_CRASH("old style system disabled");
+ return aServoFunctor(ParseServoSelectorList(aSelectorString, aRv));
}
public:
/* Event stuff that documents and elements share. This needs to be
NS_IMETHOD because some subclasses implement DOM methods with
this exact name and signature and then the calling convention
needs to match.
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1085,34 +1085,26 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
nsIURI* aBaseURI)
{
nsresult rv = NS_OK;
aSanitized.Truncate();
// aSanitized will hold the permitted CSS text.
// -moz-binding is blacklisted.
bool didSanitize = false;
// Create a sheet to hold the parsed CSS
- RefPtr<StyleSheet> sheet;
- if (aDocument->IsStyledByServo()) {
- sheet = new ServoStyleSheet(mozilla::css::eAuthorSheetFeatures,
- CORS_NONE, aDocument->GetReferrerPolicy(),
- SRIMetadata());
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ RefPtr<StyleSheet> sheet =
+ new ServoStyleSheet(mozilla::css::eAuthorSheetFeatures,
+ CORS_NONE, aDocument->GetReferrerPolicy(),
+ SRIMetadata());
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
sheet->SetPrincipal(aDocument->NodePrincipal());
- if (aDocument->IsStyledByServo()) {
- sheet->AsServo()->ParseSheetSync(
- aDocument->CSSLoader(), NS_ConvertUTF16toUTF8(aOriginal),
- aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
- /* aLoadData = */ nullptr, 0, aDocument->GetCompatibilityMode());
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ sheet->AsServo()->ParseSheetSync(
+ aDocument->CSSLoader(), NS_ConvertUTF16toUTF8(aOriginal),
+ aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
+ /* aLoadData = */ nullptr, 0, aDocument->GetCompatibilityMode());
NS_ENSURE_SUCCESS(rv, true);
// Mark the sheet as complete.
MOZ_ASSERT(!sheet->HasForcedUniqueInner(),
"should not get a forced unique inner during parsing");
sheet->SetComplete();
// Loop through all the rules found in the CSS text
ErrorResult err;
RefPtr<dom::CSSRuleList> rules =
@@ -1172,30 +1164,26 @@ nsTreeSanitizer::SanitizeAttributes(mozi
for (int32_t i = ac - 1; i >= 0; --i) {
const nsAttrName* attrName = aElement->GetAttrNameAt(i);
int32_t attrNs = attrName->NamespaceID();
RefPtr<nsAtom> attrLocal = attrName->LocalName();
if (kNameSpaceID_None == attrNs) {
if (aAllowStyle && nsGkAtoms::style == attrLocal) {
- RefPtr<DeclarationBlock> decl;
nsAutoString value;
aElement->GetAttr(attrNs, attrLocal, value);
nsIDocument* document = aElement->OwnerDoc();
- if (document->IsStyledByServo()) {
- RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
- decl = ServoDeclarationBlock::FromCssText(
- value,
- urlExtra,
- document->GetCompatibilityMode(),
- document->CSSLoader());
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
+ RefPtr<DeclarationBlock> decl =
+ ServoDeclarationBlock::FromCssText(
+ value,
+ urlExtra,
+ document->GetCompatibilityMode(),
+ document->CSSLoader());
if (decl) {
if (SanitizeStyleDeclaration(decl)) {
nsAutoString cleanValue;
decl->ToString(cleanValue);
aElement->SetAttr(kNameSpaceID_None,
nsGkAtoms::style,
cleanValue,
false);
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1911,17 +1911,17 @@ interface nsIDOMWindowUtils : nsISupport
*
* This should only be used for testing.
*/
void ensureDirtyRootFrame();
/**
* Whether the current document is styled by Servo's style engine.
*
- * This calls nsIDocument::IsStyledByServo().
+ * Always true, pending removal.
*/
readonly attribute boolean isStyledByServo;
/**
* Capture the contents of the current WebRender frame and
* save them to a folder relative to the current working directory.
*/
void wrCapture();
--- a/dom/smil/nsSMILCSSProperty.cpp
+++ b/dom/smil/nsSMILCSSProperty.cpp
@@ -62,25 +62,21 @@ nsSMILCSSProperty::GetBaseValue() const
// In any case, just return a dummy value (initialized with the right
// type, so as not to indicate failure).
nsSMILValue tmpVal(&nsSMILCSSValueType::sSingleton);
Swap(baseValue, tmpVal);
return baseValue;
}
AnimationValue computedValue;
- if (mElement->IsStyledByServo()) {
- computedValue.mServo =
- Servo_ComputedValues_ExtractAnimationValue(mBaseComputedStyle, mPropID)
- .Consume();
- if (!computedValue.mServo) {
- return baseValue;
- }
- } else {
- MOZ_CRASH("old style system disabled");
+ computedValue.mServo =
+ Servo_ComputedValues_ExtractAnimationValue(mBaseComputedStyle, mPropID)
+ .Consume();
+ if (!computedValue.mServo) {
+ return baseValue;
}
baseValue =
nsSMILCSSValueType::ValueFromAnimationValue(mPropID, mElement,
computedValue);
return baseValue;
}
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -691,26 +691,16 @@ nsBindingManager::EnumerateBoundContentB
return false;
}
}
}
return true;
}
-
-bool
-nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
- mozilla::MediaFeatureChangeReason aReason)
-{
- MOZ_ASSERT(!mDocument->IsStyledByServo());
- MOZ_CRASH("old style system disabled");
- return false;
-}
-
void
nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
{
EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) {
aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray);
return true;
});
}
--- a/dom/xbl/nsBindingManager.h
+++ b/dom/xbl/nsBindingManager.h
@@ -120,27 +120,19 @@ public:
nsIStreamListener* GetLoadingDocListener(nsIURI* aURL);
void RemoveLoadingDocListener(nsIURI* aURL);
void FlushSkinBindings();
nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
- // Do any processing that needs to happen as a result of a change in the
- // characteristics of the medium, and return whether this rule processor's
- // rules or the servo style set have changed (e.g., because of media
- // queries).
- bool MediumFeaturesChanged(nsPresContext* aPresContext,
- mozilla::MediaFeatureChangeReason);
-
void AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
- void Traverse(nsIContent *aContent,
- nsCycleCollectionTraversalCallback &cb);
+ void Traverse(nsIContent *aContent, nsCycleCollectionTraversalCallback &cb);
NS_DECL_CYCLE_COLLECTION_CLASS(nsBindingManager)
// Notify the binding manager when an outermost update begins and
// ends. The end method can execute script.
void BeginOutermostUpdate()
{
mAttachedStackSizeOnOutermost = mAttachedStack.Length();
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -100,27 +100,20 @@ nsXBLPrototypeResources::FlushSkinSheets
}
else {
newSheet = oldSheet;
}
mStyleSheetList.AppendElement(newSheet);
}
- if (doc->IsStyledByServo()) {
- // There may be no shell during unlink.
- //
- // FIXME(emilio): We shouldn't skip shadow root style updates just because?
- // Though during unlink is fine I guess...
- if (auto* shell = doc->GetShell()) {
- MOZ_ASSERT(shell->GetPresContext());
- ComputeServoStyles(*shell->StyleSet()->AsServo());
- }
- } else {
- MOZ_CRASH("old style system disabled");
+ // There may be no shell during unlink.
+ if (auto* shell = doc->GetShell()) {
+ MOZ_ASSERT(shell->GetPresContext());
+ ComputeServoStyles(*shell->StyleSet()->AsServo());
}
return NS_OK;
}
nsresult
nsXBLPrototypeResources::Write(nsIObjectOutputStream* aStream)
{
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -384,17 +384,17 @@ nsXBLService::IsChromeOrResourceURI(nsIU
}
// Servo avoids wasting work styling subtrees of elements with XBL bindings by
// default, so whenever we leave LoadBindings in a way that doesn't guarantee
// that the subtree is styled we need to take care of doing it manually.
static void
EnsureSubtreeStyled(Element* aElement)
{
- if (!aElement->IsStyledByServo() || !aElement->HasServoData()) {
+ if (!aElement->HasServoData()) {
return;
}
if (Servo_Element_IsDisplayNone(aElement)) {
return;
}
nsIPresShell* presShell = aElement->OwnerDoc()->GetShell();
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -2955,36 +2955,34 @@ PresShell::DestroyFramesForAndRestyle(El
}
nsAutoScriptBlocker scriptBlocker;
// Mark ourselves as not safe to flush while we're doing frame destruction.
++mChangeNestCount;
const bool didReconstruct = FrameConstructor()->DestroyFramesFor(aElement);
- if (aElement->IsStyledByServo()) {
- if (aElement->GetFlattenedTreeParentNode()) {
- // The element is still in the flat tree, but their children may not be
- // anymore in a second.
- //
- // This is the case of a new shadow root or XBL binding about to be
- // attached.
- //
- // Clear the style data from all the flattened tree descendants, but _not_
- // from us, since otherwise we wouldn't see the reframe.
- //
- // FIXME(emilio): It'd be more ergonomic to just map the no data -> data
- // case to a reframe from the style system.
- ServoRestyleManager::ClearServoDataFromSubtree(
- aElement, ServoRestyleManager::IncludeRoot::No);
- } else {
- // This is the case of an element that was redistributed but is no longer
- // bound to any insertion point. Just forget about all the data.
- ServoRestyleManager::ClearServoDataFromSubtree(aElement);
- }
+ if (aElement->GetFlattenedTreeParentNode()) {
+ // The element is still in the flat tree, but their children may not be
+ // anymore in a second.
+ //
+ // This is the case of a new shadow root or XBL binding about to be
+ // attached.
+ //
+ // Clear the style data from all the flattened tree descendants, but _not_
+ // from us, since otherwise we wouldn't see the reframe.
+ //
+ // FIXME(emilio): It'd be more ergonomic to just map the no data -> data
+ // case to a reframe from the style system.
+ ServoRestyleManager::ClearServoDataFromSubtree(
+ aElement, ServoRestyleManager::IncludeRoot::No);
+ } else {
+ // This is the case of an element that was redistributed but is no longer
+ // bound to any insertion point. Just forget about all the data.
+ ServoRestyleManager::ClearServoDataFromSubtree(aElement);
}
auto changeHint = didReconstruct
? nsChangeHint(0)
: nsChangeHint_ReconstructFrame;
// NOTE(emilio): eRestyle_Subtree is needed to force also a full subtree
// restyle for the content (in Stylo, where the existence of frames != the
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -841,21 +841,19 @@ nsPresContext::Init(nsDeviceContext* aDe
// In certain rare cases (such as changing page mode), we tear down layout
// state and re-initialize a new prescontext for a document. Given that we
// hang style state off the DOM, we detect that re-initialization case and
// lazily drop the servo data. We don't do this eagerly during layout teardown
// because that would incur an extra whole-tree traversal that's unnecessary
// most of the time.
//
// FIXME(emilio): I'm pretty sure this doesn't happen after bug 1414999.
- if (mDocument->IsStyledByServo()) {
- Element* root = mDocument->GetRootElement();
- if (root && root->HasServoData()) {
- ServoRestyleManager::ClearServoDataFromSubtree(root);
- }
+ Element* root = mDocument->GetRootElement();
+ if (root && root->HasServoData()) {
+ ServoRestyleManager::ClearServoDataFromSubtree(root);
}
if (mDeviceContext->SetFullZoom(mFullZoom))
mDeviceContext->FlushFontCache();
mCurAppUnitsPerDevPixel = AppUnitsPerDevPixel();
mEventManager = new mozilla::EventStateManager();
@@ -1071,22 +1069,23 @@ nsPresContext::DetachShell()
}
}
void
nsPresContext::DoChangeCharSet(NotNull<const Encoding*> aCharSet)
{
UpdateCharSet(aCharSet);
mDeviceContext->FlushFontCache();
- // In Stylo, if a document contains one or more <script> elements, frame
- // construction might happen earlier than the UpdateCharSet(), so we need to
- // restyle descendants to make their style data up-to-date.
- RebuildAllStyleData(NS_STYLE_HINT_REFLOW,
- mDocument->IsStyledByServo()
- ? eRestyle_ForceDescendants : nsRestyleHint(0));
+
+ // If a document contains one or more <script> elements, frame construction
+ // might happen earlier than the UpdateCharSet(), so we need to restyle
+ // descendants to make their style data up-to-date.
+ //
+ // FIXME(emilio): Revisit whether this is true after bug 1438911.
+ RebuildAllStyleData(NS_STYLE_HINT_REFLOW, eRestyle_ForceDescendants);
}
void
nsPresContext::UpdateCharSet(NotNull<const Encoding*> aCharSet)
{
mLanguage = mLangService->LookupCharSet(aCharSet);
// this will be a language group (or script) code rather than a true language code
--- a/layout/base/nsStyleChangeList.cpp
+++ b/layout/base/nsStyleChangeList.cpp
@@ -28,17 +28,16 @@ nsStyleChangeList::AppendChange(nsIFrame
"must have content");
// XXXbz we should make this take Element instead of nsIContent
MOZ_ASSERT(!aContent || aContent->IsElement() ||
// display:contents elements posts the changes for their children:
(aFrame && aContent->GetParent() &&
aFrame->PresContext()->FrameConstructor()->
GetDisplayContentsStyleFor(aContent->GetParent())) ||
(aContent->IsNodeOfType(nsINode::eTEXT) &&
- aContent->IsStyledByServo() &&
aContent->HasFlag(NODE_NEEDS_FRAME) &&
aHint & nsChangeHint_ReconstructFrame),
"Shouldn't be trying to restyle non-elements directly, "
"except if it's a display:contents child or a text node "
"doing lazy frame construction");
MOZ_ASSERT(!(aHint & nsChangeHint_AllReflowHints) ||
(aHint & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -532,22 +532,18 @@ FontFace::ParseDescriptor(nsCSSFontDesc
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mParent);
nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull();
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mParent);
nsCOMPtr<nsIURI> docURI = window->GetDocumentURI();
nsCOMPtr<nsIURI> base = window->GetDocBaseURI();
- if (mFontFaceSet->Document()->IsStyledByServo()) {
- RefPtr<URLExtraData> url = new URLExtraData(base, docURI, principal);
- return ServoCSSParser::ParseFontDescriptor(aDescID, aString, url, aResult);
- }
-
- MOZ_CRASH("old style system disabled");
+ RefPtr<URLExtraData> url = new URLExtraData(base, docURI, principal);
+ return ServoCSSParser::ParseFontDescriptor(aDescID, aString, url, aResult);
}
void
FontFace::SetDescriptor(nsCSSFontDesc aFontDesc,
const nsAString& aValue,
ErrorResult& aRv)
{
NS_ASSERTION(!HasRule(),
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -203,33 +203,28 @@ void
FontFaceSet::ParseFontShorthandForMatching(
const nsAString& aFont,
RefPtr<SharedFontList>& aFamilyList,
uint32_t& aWeight,
int32_t& aStretch,
uint8_t& aStyle,
ErrorResult& aRv)
{
- if (mDocument->IsStyledByServo()) {
- nsCSSValue style;
- nsCSSValue stretch;
- nsCSSValue weight;
- RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(mDocument);
- if (!ServoCSSParser::ParseFontShorthandForMatching(
- aFont, url, aFamilyList, style, stretch, weight)) {
- aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
- return;
- }
- aWeight = weight.GetIntValue();
- aStretch = stretch.GetIntValue();
- aStyle = style.GetIntValue();
+ nsCSSValue style;
+ nsCSSValue stretch;
+ nsCSSValue weight;
+ RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(mDocument);
+ if (!ServoCSSParser::ParseFontShorthandForMatching(
+ aFont, url, aFamilyList, style, stretch, weight)) {
+ aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
-
- MOZ_CRASH("old style system disabled");
+ aWeight = weight.GetIntValue();
+ aStretch = stretch.GetIntValue();
+ aStyle = style.GetIntValue();
}
static bool
HasAnyCharacterInUnicodeRange(gfxUserFontEntry* aEntry,
const nsAString& aInput)
{
const char16_t* p = aInput.Data();
const char16_t* end = p + aInput.Length();
--- a/layout/style/nsCSSCounterStyleRule.cpp
+++ b/layout/style/nsCSSCounterStyleRule.cpp
@@ -119,26 +119,19 @@ nsCSSCounterStyleRule::GetName(nsAString
aName.Truncate();
nsDependentAtomString name(mName);
nsStyleUtil::AppendEscapedCSSIdent(name, aName);
}
void
nsCSSCounterStyleRule::SetName(const nsAString& aName)
{
- RefPtr<nsAtom> name;
nsIDocument* doc = GetDocument();
- if (!doc || doc->IsStyledByServo()) {
- name = ServoCSSParser::ParseCounterStyleName(aName);
- } else {
- MOZ_CRASH("old style system disabled");
- }
-
- if (name) {
+ if (RefPtr<nsAtom> name = ServoCSSParser::ParseCounterStyleName(aName)) {
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
mName = name;
if (StyleSheet* sheet = GetStyleSheet()) {
sheet->RuleChanged(this);
}
}
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -133,22 +133,17 @@ nsDOMCSSAttributeDeclaration::GetCSSDecl
return declaration;
}
if (aOperation != eOperation_Modify) {
return nullptr;
}
// cannot fail
- RefPtr<DeclarationBlock> decl;
- if (mElement->IsStyledByServo()) {
- decl = new ServoDeclarationBlock();
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ RefPtr<DeclarationBlock> decl = new ServoDeclarationBlock();
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;
if (mIsSMILOverride) {
rv = mElement->SetSMILOverrideStyleDeclaration(decl, false);
} else {
rv = mElement->SetInlineStyleDeclaration(decl, nullptr, false);
}
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -108,28 +108,24 @@ ElementPropertyTransition::UpdateStartVa
"Transitions should have exactly two animation keyframes");
MOZ_ASSERT(mKeyframes[0].mPropertyValues.Length() == 1,
"Transitions should have exactly one property in their first "
"frame");
const AnimationValue& replacedFrom = mReplacedTransition->mFromValue;
const AnimationValue& replacedTo = mReplacedTransition->mToValue;
AnimationValue startValue;
- if (mDocument->IsStyledByServo()) {
- startValue.mServo =
- Servo_AnimationValues_Interpolate(replacedFrom.mServo,
- replacedTo.mServo,
- valuePosition).Consume();
- if (startValue.mServo) {
- mKeyframes[0].mPropertyValues[0].mServoDeclarationBlock =
- Servo_AnimationValue_Uncompute(startValue.mServo).Consume();
- mProperties[0].mSegments[0].mFromValue = Move(startValue);
- }
- } else {
- MOZ_CRASH("old style system disabled");
+ startValue.mServo =
+ Servo_AnimationValues_Interpolate(replacedFrom.mServo,
+ replacedTo.mServo,
+ valuePosition).Consume();
+ if (startValue.mServo) {
+ mKeyframes[0].mPropertyValues[0].mServoDeclarationBlock =
+ Servo_AnimationValue_Uncompute(startValue.mServo).Consume();
+ mProperties[0].mSegments[0].mFromValue = Move(startValue);
}
}
mReplacedTransition.reset();
}
////////////////////////// CSSTransition ////////////////////////////
@@ -628,24 +624,19 @@ GetTransitionKeyframes(nsCSSPropertyID a
}
AppendKeyframe(1.0, aProperty, Move(aEndValue), keyframes);
return keyframes;
}
static bool
-IsTransitionable(nsCSSPropertyID aProperty, bool aIsServo)
+IsTransitionable(nsCSSPropertyID aProperty)
{
- if (aIsServo) {
- return Servo_Property_IsTransitionable(aProperty);
- }
-
- // FIXME: This should also exclude discretely-animated properties.
- return nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_None;
+ return Servo_Property_IsTransitionable(aProperty);
}
template<typename StyleType>
void
nsTransitionManager::ConsiderInitiatingTransition(
nsCSSPropertyID aProperty,
const nsStyleDisplay& aStyleDisplay,
uint32_t transitionIdx,
@@ -673,17 +664,17 @@ nsTransitionManager::ConsiderInitiatingT
if (aWhichStarted->HasProperty(aProperty)) {
// A later item in transition-property already started a
// transition for this property, so we ignore this one.
// See comment above and
// http://lists.w3.org/Archives/Public/www-style/2009Aug/0109.html .
return;
}
- if (!IsTransitionable(aProperty, aElement->IsStyledByServo())) {
+ if (!IsTransitionable(aProperty)) {
return;
}
dom::DocumentTimeline* timeline = aElement->OwnerDoc()->Timeline();
AnimationValue startValue, endValue;
bool haveValues =
ExtractNonDiscreteComputedValue(aProperty, aOldStyle, startValue) &&