Bug 1337229 - Implement the deep operator== for RawServoAnimationValue
MozReview-Commit-ID: BiNNrIFXqtf
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -13,17 +13,16 @@
#include "mozilla/AnimationRule.h"
#include "mozilla/AnimationUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/EffectSet.h"
#include "mozilla/FloatingPoint.h" // For IsFinite
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/ServoBindings.h"
-#include "mozilla/StyleAnimationValueInlines.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
#include "nsContentUtils.h" // nsContentUtils::ReportToConsole
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsIPresShell.h"
#include "nsIScriptError.h"
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -18,17 +18,17 @@
#include "mozilla/AnimationTarget.h"
#include "mozilla/Attributes.h"
#include "mozilla/ComputedTimingFunction.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/Keyframe.h"
#include "mozilla/KeyframeEffectParams.h"
// RawServoDeclarationBlock and associated RefPtrTraits
#include "mozilla/ServoBindingTypes.h"
-#include "mozilla/StyleAnimationValue.h"
+#include "mozilla/StyleAnimationValueInlines.h"
#include "mozilla/dom/AnimationEffectReadOnly.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Element.h"
struct JSContext;
class JSObject;
class nsIContent;
class nsIDocument;
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -125,16 +125,19 @@ SERVO_BINDING_FUNC(Servo_AnimationValue_
RawServoAnimationValueBorrowed value,
nsCSSPropertyID property,
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)
// Style attribute
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
const nsACString* data)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty,
RawServoDeclarationBlockStrong)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Clone, RawServoDeclarationBlockStrong,
RawServoDeclarationBlockBorrowed declarations)
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -571,21 +571,17 @@ private:
}
};
struct AnimationValue
{
StyleAnimationValue mGecko;
RefPtr<RawServoAnimationValue> mServo;
- bool operator==(const AnimationValue& aOther) const
- {
- // FIXME: Bug 1337229: add a deep == impl for RawServoAnimationValue.
- return mGecko == aOther.mGecko && mServo == aOther.mServo;
- }
+ inline bool operator==(const AnimationValue& aOther) const;
bool IsNull() const { return mGecko.IsNull() && !mServo; }
inline float GetOpacity() const;
// Returns the scale for mGecko or mServo, which are calculated with
// reference to aFrame.
inline gfxSize GetScaleValue(const nsIFrame* aFrame) const;
--- a/layout/style/StyleAnimationValueInlines.h
+++ b/layout/style/StyleAnimationValueInlines.h
@@ -6,16 +6,26 @@
#ifndef mozilla_StyleAnimationValueInlines_h_
#define mozilla_StyleAnimationValueInlines_h_
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/ServoBindings.h"
namespace mozilla {
+bool
+AnimationValue::operator==(const AnimationValue& aOther) const
+{
+ // mGecko and mServo are mutual exclusive, one of them must be null
+ if (mServo) {
+ return Servo_AnimationValue_DeepEqual(mServo, aOther.mServo);
+ }
+ return mGecko == aOther.mGecko;
+}
+
float
AnimationValue::GetOpacity() const
{
return mServo ? Servo_AnimationValue_GetOpacity(mServo)
: mGecko.GetFloatValue();
}
gfxSize