Bug 1302949 - Serialize specified keyframe values; r=heycam draft
authorBrian Birtles <birtles@gmail.com>
Fri, 16 Sep 2016 09:26:48 +0900
changeset 420998 b0532e144b3208d79e1e26ce3bff9a20c896abad
parent 420997 4a44d4265603c982483e5d7ef9460a7ab35c1e1e
child 420999 83e415febf10cf90631fd7a1b447921822a44bc0
push id31345
push userbbirtles@mozilla.com
push dateWed, 05 Oct 2016 02:47:30 +0000
reviewersheycam
bugs1302949
milestone52.0a1
Bug 1302949 - Serialize specified keyframe values; r=heycam MozReview-Commit-ID: 9BSkci1kqU6
dom/animation/KeyframeEffectReadOnly.cpp
layout/style/ServoBindingList.h
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -854,18 +854,23 @@ KeyframeEffectReadOnly::GetKeyframes(JSC
       // works with token stream values if we pass eCSSProperty_UNKNOWN as
       // the property.
       nsCSSPropertyID propertyForSerializing =
         nsCSSProps::IsShorthand(propertyValue.mProperty)
         ? eCSSProperty_UNKNOWN
         : propertyValue.mProperty;
 
       nsAutoString stringValue;
-      propertyValue.mValue.AppendToString(
-        propertyForSerializing, stringValue, nsCSSValue::eNormalized);
+      if (propertyValue.mServoDeclarationBlock) {
+        Servo_DeclarationBlock_SerializeOneValue(
+          propertyValue.mServoDeclarationBlock, &stringValue);
+      } else {
+        propertyValue.mValue.AppendToString(
+          propertyForSerializing, stringValue, nsCSSValue::eNormalized);
+      }
 
       JS::Rooted<JS::Value> value(aCx);
       if (!ToJSValue(aCx, stringValue, &value) ||
           !JS_DefineProperty(aCx, keyframeObject, name, value,
                              JSPROP_ENUMERATE)) {
         aRv.Throw(NS_ERROR_FAILURE);
         return;
       }
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -59,16 +59,19 @@ SERVO_BINDING_FUNC(Servo_DeclarationBloc
                    ServoDeclarationBlockBorrowed a,
                    ServoDeclarationBlockBorrowed b)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCache, nsHTMLCSSStyleSheet*,
                    ServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetImmutable, void,
                    ServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_ClearCachePointer, void,
                    ServoDeclarationBlockBorrowed declarations)
+SERVO_BINDING_FUNC(Servo_DeclarationBlock_SerializeOneValue, void,
+                   ServoDeclarationBlockBorrowed declarations,
+                   nsString* buffer)
 
 // CSS supports()
 SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
                    const uint8_t* name, uint32_t name_length,
                    const uint8_t* value, uint32_t value_length)
 
 // Computed style data
 SERVO_BINDING_FUNC(Servo_ComputedValues_Get, ServoComputedValuesStrong,