Bug 1358966 - Serialize multiple AnimationValue(s) for sub properties of a shorthand into single shorthand string. r?birtles,manishearth
MozReview-Commit-ID: KihUZRSD6pg
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -818,27 +818,37 @@ nsSMILCSSValueType::ValueToString(const
{
MOZ_ASSERT(aValue.mType == &nsSMILCSSValueType::sSingleton,
"Unexpected SMIL value type");
const ValueWrapper* wrapper = ExtractValueWrapper(aValue);
if (!wrapper) {
return;
}
- if (!wrapper->mServoValues.IsEmpty()) {
- Servo_AnimationValue_Serialize(wrapper->mServoValues[0],
- wrapper->mPropID,
- &aString);
+ if (wrapper->mServoValues.IsEmpty()) {
+ DebugOnly<bool> uncomputeResult =
+ StyleAnimationValue::UncomputeValue(wrapper->mPropID,
+ wrapper->mGeckoValue,
+ aString);
return;
}
- DebugOnly<bool> uncomputeResult =
- StyleAnimationValue::UncomputeValue(wrapper->mPropID,
- wrapper->mGeckoValue,
- aString);
+ if (nsCSSProps::IsShorthand(wrapper->mPropID)) {
+ // In case of shorthand on servo, we iterate over all mServoValues array
+ // since we have multiple AnimationValues in the array for each longhand
+ // component.
+ Servo_Shorthand_AnimationValues_Serialize(wrapper->mPropID,
+ &wrapper->mServoValues,
+ &aString);
+ return;
+ }
+
+ Servo_AnimationValue_Serialize(wrapper->mServoValues[0],
+ wrapper->mPropID,
+ &aString);
}
// static
nsCSSPropertyID
nsSMILCSSValueType::PropertyFromValue(const nsSMILValue& aValue)
{
if (aValue.mType != &nsSMILCSSValueType::sSingleton) {
return eCSSProperty_UNKNOWN;
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -270,16 +270,20 @@ SERVO_BINDING_FUNC(Servo_AnimationValues
RawServoAnimationValueBorrowed value_to_match)
SERVO_BINDING_FUNC(Servo_AnimationValues_ComputeDistance, double,
RawServoAnimationValueBorrowed from,
RawServoAnimationValueBorrowed to)
SERVO_BINDING_FUNC(Servo_AnimationValue_Serialize, void,
RawServoAnimationValueBorrowed value,
nsCSSPropertyID property,
nsAString* buffer)
+SERVO_BINDING_FUNC(Servo_Shorthand_AnimationValues_Serialize, void,
+ nsCSSPropertyID shorthand_property,
+ RawGeckoServoAnimationValueListBorrowed values,
+ nsAString* buffer)
SERVO_BINDING_FUNC(Servo_AnimationValue_GetOpacity, float,
RawServoAnimationValueBorrowed value)
SERVO_BINDING_FUNC(Servo_AnimationValue_GetTransform, void,
RawServoAnimationValueBorrowed value,
RefPtr<nsCSSValueSharedList>* list)
SERVO_BINDING_FUNC(Servo_AnimationValue_DeepEqual, bool,
RawServoAnimationValueBorrowed,
RawServoAnimationValueBorrowed)
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -137,16 +137,17 @@ DECL_BORROWED_REF_TYPE_FOR(RawGeckoXBLBi
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoXBLBinding)
DECL_BORROWED_MUT_REF_TYPE_FOR(StyleChildrenIterator)
DECL_BORROWED_MUT_REF_TYPE_FOR(ServoElementSnapshot)
DECL_BORROWED_REF_TYPE_FOR(nsCSSValue)
DECL_BORROWED_MUT_REF_TYPE_FOR(nsCSSValue)
DECL_OWNED_REF_TYPE_FOR(RawGeckoPresContext)
DECL_BORROWED_REF_TYPE_FOR(RawGeckoPresContext)
DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoServoAnimationValueList)
+DECL_BORROWED_REF_TYPE_FOR(RawGeckoServoAnimationValueList)
DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoKeyframeList)
DECL_BORROWED_REF_TYPE_FOR(RawGeckoKeyframeList)
DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoComputedKeyframeValuesList)
DECL_BORROWED_REF_TYPE_FOR(RawGeckoStyleAnimationList)
DECL_BORROWED_MUT_REF_TYPE_FOR(nsTimingFunction)
DECL_BORROWED_REF_TYPE_FOR(nsTimingFunction)
DECL_BORROWED_MUT_REF_TYPE_FOR(RawGeckoFontFaceRuleList)
DECL_BORROWED_REF_TYPE_FOR(RawGeckoAnimationPropertySegment)