Bug 1302949 - Store Servo declaration block in keyframe values; r=manishearth draft
authorBrian Birtles <birtles@gmail.com>
Thu, 15 Sep 2016 16:26:07 +0900
changeset 418211 eb27be9c54156cd51beadef7369113f589f7bc04
parent 418210 005cee5565171d18c8f3eb0e2830dfa3f6fd543f
child 418212 0a272889138b0383b9c602021488c2b32d7b3da7
push id30635
push userbbirtles@mozilla.com
push dateWed, 28 Sep 2016 00:25:30 +0000
reviewersmanishearth
bugs1302949
milestone52.0a1
Bug 1302949 - Store Servo declaration block in keyframe values; r=manishearth 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()