Bug 1337229 - Implement the deep operator== for RawServoAnimationValue draft
authorShing Lyu <slyu@mozilla.com>
Fri, 24 Feb 2017 15:05:23 +0800
changeset 488993 3fbb14d9255f6a256a269feb036ed2119a9284c6
parent 485692 6cefe01ca7744d6ac3960c69eac833e2e65f7f8f
child 546906 8da893e1b94f5886b0e1b91160cfb42268134c49
push id46720
push userbmo:slyu@mozilla.com
push dateFri, 24 Feb 2017 07:05:52 +0000
bugs1337229
milestone54.0a1
Bug 1337229 - Implement the deep operator== for RawServoAnimationValue MozReview-Commit-ID: BiNNrIFXqtf
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeEffectReadOnly.h
layout/style/ServoBindingList.h
layout/style/StyleAnimationValue.h
layout/style/StyleAnimationValueInlines.h
--- 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