Bug 1302949 - Store Servo declaration block in keyframe values; r=heycam
MozReview-Commit-ID: I09XpkU8bT0
--- 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()