Bug 1337229 - Implement the deep operator== for RawServoAnimationValue r=hiro,manishearth
authorShing Lyu <slyu@mozilla.com>
Fri, 24 Feb 2017 15:05:23 +0800
changeset 373712 7967050a8fa0fa8706cae540f1e125ec4d4690eb
parent 373711 757d5ee3dbc38876d9c207857ab239d55e26a6dd
child 373713 9c05f32dd0b1fff119c5bf698704d8d206957931
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro, manishearth
bugs1337229
milestone54.0a1
Bug 1337229 - Implement the deep operator== for RawServoAnimationValue r=hiro,manishearth 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