Bug 1338087 - Part 2: Drop the computation of StyleAnimationValue on stylo.
MozReview-Commit-ID: 4oAzC6m2vie
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -627,21 +627,31 @@ KeyframeUtils::GetComputedKeyframeValues
continue;
}
// Expand each value into the set of longhands and produce
// a KeyframeValueEntry for each value.
nsTArray<PropertyStyleAnimationValuePair> values;
if (styleBackend == StyleBackendType::Servo) {
- if (!StyleAnimationValue::ComputeValues(pair.mProperty,
- CSSEnabledState::eForAllContent, aStyleContext,
- *pair.mServoDeclarationBlock, values)) {
- continue;
+ if (nsCSSProps::IsShorthand(pair.mProperty)) {
+ CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, pair.mProperty,
+ CSSEnabledState::eForAllContent) {
+ if (nsCSSProps::kAnimTypeTable[*p] == eStyleAnimType_None) {
+ // Skip non-animatable component longhands.
+ continue;
+ }
+ PropertyStyleAnimationValuePair* valuePair = values.AppendElement();
+ valuePair->mProperty = *p;
+ }
+ } else {
+ PropertyStyleAnimationValuePair* valuePair = values.AppendElement();
+ valuePair->mProperty = pair.mProperty;
}
+
Servo_AnimationValues_Populate(&values,
pair.mServoDeclarationBlock,
currentStyle,
parentStyle,
aStyleContext->PresContext());
} else {
// For shorthands, we store the string as a token stream so we need to
// extract that first.
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -100,21 +100,16 @@ SERVO_BINDING_FUNC(Servo_StyleRule_GetSe
// Animations API
SERVO_BINDING_FUNC(Servo_ParseProperty,
RawServoDeclarationBlockStrong,
const nsACString* property, const nsACString* value,
const nsACString* base_url, ThreadSafeURIHolder* base,
ThreadSafeURIHolder* referrer,
ThreadSafePrincipalHolder* principal)
-SERVO_BINDING_FUNC(Servo_RestyleWithAddedDeclaration,
- ServoComputedValuesStrong,
- RawServoStyleSetBorrowed set,
- RawServoDeclarationBlockBorrowed declarations,
- ServoComputedValuesBorrowed previous_style)
// AnimationValues handling
SERVO_BINDING_FUNC(Servo_AnimationValues_Populate, void,
RawGeckoAnimationValueListBorrowedMut,
RawServoDeclarationBlockBorrowed,
ServoComputedValuesBorrowed,
ServoComputedValuesBorrowedOrNull,
RawGeckoPresContextBorrowed)
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -626,24 +626,15 @@ ServoStyleSet::FillKeyframesForName(cons
}
void
ServoStyleSet::RebuildData()
{
Servo_StyleSet_RebuildData(mRawSet.get());
}
-ServoComputedValuesStrong
-ServoStyleSet::RestyleWithAddedDeclaration(RawServoDeclarationBlock* aDeclarations,
- const ServoComputedValues* aPreviousStyle)
-{
- return Servo_RestyleWithAddedDeclaration(mRawSet.get(), aDeclarations,
- aPreviousStyle);
-}
-
-
already_AddRefed<ServoComputedValues>
ServoStyleSet::ResolveServoStyle(Element* aElement)
{
return Servo_ResolveStyle(aElement, mRawSet.get()).Consume();
}
bool ServoStyleSet::sInServoTraversal = false;
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -186,23 +186,16 @@ public:
void RebuildData();
/**
* Resolve style for the given element, and return it as a
* ServoComputedValues, not an nsStyleContext.
*/
already_AddRefed<ServoComputedValues> ResolveServoStyle(dom::Element* aElement);
- /**
- * Restyle with added declaration, for use in animations.
- */
- ServoComputedValuesStrong RestyleWithAddedDeclaration(
- RawServoDeclarationBlock* aDeclarations,
- const ServoComputedValues* aPreviousStyle);
-
bool FillKeyframesForName(const nsString& aName,
const nsTimingFunction& aTimingFunction,
const ServoComputedValues* aComputedValues,
nsTArray<Keyframe>& aKeyframes);
private:
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
nsStyleContext* aParentContext,
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -3642,56 +3642,16 @@ StyleAnimationValue::ComputeValues(
nsTArray<PropertyStyleAnimationValuePair>& aResult)
{
return ComputeValuesFromSpecifiedValue(aProperty, aEnabledState,
aTargetElement, aStyleContext,
aSpecifiedValue, aUseSVGMode,
aResult);
}
-/* static */ bool
-StyleAnimationValue::ComputeValues(
- nsCSSPropertyID aProperty,
- CSSEnabledState aEnabledState,
- nsStyleContext* aStyleContext,
- const RawServoDeclarationBlock& aDeclarations,
- nsTArray<PropertyStyleAnimationValuePair>& aValues)
-{
- MOZ_ASSERT(aStyleContext->PresContext()->StyleSet()->IsServo(),
- "Should be using ServoStyleSet if we have a"
- " RawServoDeclarationBlock");
-
- if (!nsCSSProps::IsEnabled(aProperty, aEnabledState)) {
- return false;
- }
-
- const ServoComputedValues* previousStyle =
- aStyleContext->StyleSource().AsServoComputedValues();
-
- // FIXME: Servo bindings don't yet represent const-ness so we just
- // cast it away for now.
- auto declarations = const_cast<RawServoDeclarationBlock*>(&aDeclarations);
- RefPtr<ServoComputedValues> computedValues =
- aStyleContext->PresContext()->StyleSet()->AsServo()->
- RestyleWithAddedDeclaration(declarations, previousStyle).Consume();
- if (!computedValues) {
- return false;
- }
-
- RefPtr<nsStyleContext> tmpStyleContext =
- NS_NewStyleContext(aStyleContext, aStyleContext->PresContext(),
- aStyleContext->GetPseudo(),
- aStyleContext->GetPseudoType(),
- computedValues.forget(),
- false /* skipFixup */);
-
- return ComputeValuesFromStyleContext(aProperty, aEnabledState,
- tmpStyleContext, aValues);
-}
-
bool
StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
const StyleAnimationValue& aComputedValue,
nsCSSValue& aSpecifiedValue)
{
Unit unit = aComputedValue.GetUnit();
switch (unit) {
case eUnit_Normal:
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -19,17 +19,16 @@
#include "nsCSSValue.h"
#include "nsStyleCoord.h"
#include "nsStyleTransformMatrix.h"
#include "ServoBindings.h"
class nsIFrame;
class nsStyleContext;
class gfx3DMatrix;
-struct RawServoDeclarationBlock;
namespace mozilla {
namespace css {
class StyleRule;
} // namespace css
namespace dom {
@@ -239,27 +238,16 @@ public:
mozilla::CSSEnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsCSSValue& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult);
/**
- * A variant of ComputeValues that takes a RawServoDeclarationBlock
- * as the specified value.
- */
- static MOZ_MUST_USE bool
- ComputeValues(nsCSSPropertyID aProperty,
- mozilla::CSSEnabledState aEnabledState,
- nsStyleContext* aStyleContext,
- const RawServoDeclarationBlock& aDeclarations,
- nsTArray<PropertyStyleAnimationValuePair>& aValues);
-
- /**
* Creates a specified value for the given computed value.
*
* The first two overloads fill in an nsCSSValue object; the third
* produces a string. For the overload that takes a const
* StyleAnimationValue& reference, the nsCSSValue result may depend on
* objects owned by the |aComputedValue| object, so users of that variant
* must keep |aComputedValue| alive longer than |aSpecifiedValue|.
* The overload that takes an rvalue StyleAnimationValue reference