Bug 1358966 - Serialize multiple AnimationValue(s) for sub properties of a shorthand into single shorthand string. r?birtles,manishearth draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 09 Jun 2017 06:19:38 +0900
changeset 591342 ee1b4d7a7e9aa58dfd8c9874b673431fb64eeb9c
parent 591341 a7a710863941f4448d8950ede010bef3e9b99790
child 591343 8dcf437ec0067b6bc232f00c6cd64d57dee44e7c
push id63021
push userhikezoe@mozilla.com
push dateThu, 08 Jun 2017 22:52:23 +0000
reviewersbirtles, manishearth
bugs1358966
milestone55.0a1
Bug 1358966 - Serialize multiple AnimationValue(s) for sub properties of a shorthand into single shorthand string. r?birtles,manishearth MozReview-Commit-ID: KihUZRSD6pg
dom/smil/nsSMILCSSValueType.cpp
layout/style/ServoBindingList.h
layout/style/ServoBindingTypes.h
--- 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)