Bug 1302949 - Store Servo declaration block in keyframe values; r=heycam draft
authorBrian Birtles <birtles@gmail.com>
Thu, 15 Sep 2016 16:26:07 +0900
changeset 420996 2403ee41f8a71261705eca0f6e5fd250dfc5c007
parent 420990 ea104eeb14cc54da9a06c3766da63f73117723a0
child 420997 4a44d4265603c982483e5d7ef9460a7ab35c1e1e
push id31345
push userbbirtles@mozilla.com
push dateWed, 05 Oct 2016 02:47:30 +0000
reviewersheycam
bugs1302949
milestone52.0a1
Bug 1302949 - Store Servo declaration block in keyframe values; r=heycam MozReview-Commit-ID: I09XpkU8bT0
dom/animation/KeyframeEffectReadOnly.h
layout/style/ServoBindingList.h
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -15,16 +15,18 @@
 #include "nsWrapperCache.h"
 #include "mozilla/AnimationPerformanceWarning.h"
 #include "mozilla/AnimationTarget.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ComputedTimingFunction.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/KeyframeEffectParams.h"
 #include "mozilla/LayerAnimationInfo.h" // LayerAnimations::kRecords
+#include "mozilla/ServoBindingHelpers.h" // ServoDeclarationBlock and
+                                         // associated RefPtrTraits
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/dom/AnimationEffectReadOnly.h"
 #include "mozilla/dom/Element.h"
 
 struct JSContext;
 class JSObject;
 class nsCSSPropertyIDSet;
 class nsIContent;
@@ -55,21 +57,30 @@ struct AnimationPropertyDetails;
  * A property-value pair specified on a keyframe.
  */
 struct PropertyValuePair
 {
   nsCSSPropertyID mProperty;
   // The specified value for the property. For shorthand properties or invalid
   // property values, we store the specified property value as a token stream
   // (string).
-  nsCSSValue    mValue;
+  nsCSSValue mValue;
+
+  // The specified value when using the Servo backend. However, even when
+  // using the Servo backend, we still fill in |mValue| in the case where we
+  // fail to parse the value since we use it to store the original string.
+  RefPtr<ServoDeclarationBlock> mServoDeclarationBlock;
 
   bool operator==(const PropertyValuePair& aOther) const {
     return mProperty == aOther.mProperty &&
-           mValue == aOther.mValue;
+           mValue == aOther.mValue &&
+           !mServoDeclarationBlock == !aOther.mServoDeclarationBlock &&
+           (!mServoDeclarationBlock ||
+            Servo_DeclarationBlock_Equals(mServoDeclarationBlock,
+                                          aOther.mServoDeclarationBlock));
   }
 };
 
 /**
  * A single keyframe.
  *
  * This is the canonical form in which keyframe effects are stored and
  * corresponds closely to the type of objects returned via the getKeyframes()
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -50,16 +50,19 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Insert
 // Style attribute
 SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, ServoDeclarationBlockStrong,
                    const uint8_t* bytes, uint32_t length,
                    nsHTMLCSSStyleSheet* cache)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
                    ServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
                    ServoDeclarationBlockBorrowed declarations)
+SERVO_BINDING_FUNC(Servo_DeclarationBlock_Equals, bool,
+                   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)
 
 // CSS supports()