Bug 1456394 - Moving timing updates to KeyframeEffectReadOnly; r=hiro
authorBrian Birtles <birtles@gmail.com>
Mon, 07 May 2018 11:02:12 +0900
changeset 417841 831f34bd841d593041fac84ca07d852a2f72339c
parent 417840 45e028b105e5ee6136c1dff28a59d99f0c304b39
child 417842 5f8a3f4a435a734c4fd954cb55b8780395ac1b4a
push id33980
push userebalazs@mozilla.com
push dateFri, 11 May 2018 09:35:12 +0000
treeherdermozilla-central@8e9a4a323f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1456394
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456394 - Moving timing updates to KeyframeEffectReadOnly; r=hiro This might seem a bit odd but later in this patch series we will rename KeyframeEffectReadOnly to KeyframeEffect. MozReview-Commit-ID: H9b8brtA36W
dom/animation/AnimationEffectTiming.cpp
dom/animation/AnimationEffectTiming.h
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeEffectReadOnly.h
--- a/dom/animation/AnimationEffectTiming.cpp
+++ b/dom/animation/AnimationEffectTiming.cpp
@@ -3,31 +3,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/AnimationEffectTiming.h"
 
 #include "mozilla/dom/AnimatableBinding.h"
 #include "mozilla/dom/AnimationEffectTimingBinding.h"
-#include "mozilla/dom/KeyframeEffect.h"
+#include "mozilla/dom/KeyframeEffectReadOnly.h"
 #include "mozilla/TimingParams.h"
 #include "nsAString.h"
 
 namespace mozilla {
 namespace dom {
 
 JSObject*
 AnimationEffectTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return AnimationEffectTimingBinding::Wrap(aCx, this, aGivenProto);
 }
 
 static inline void
-PostSpecifiedTimingUpdated(KeyframeEffect* aEffect)
+PostSpecifiedTimingUpdated(KeyframeEffectReadOnly* aEffect)
 {
   if (aEffect) {
     aEffect->NotifySpecifiedTimingUpdated();
   }
 }
 
 void
 AnimationEffectTiming::SetDelay(double aDelay)
--- a/dom/animation/AnimationEffectTiming.h
+++ b/dom/animation/AnimationEffectTiming.h
@@ -9,24 +9,24 @@
 
 #include "mozilla/dom/AnimationEffectTimingReadOnly.h"
 #include "mozilla/Attributes.h" // For MOZ_NON_OWNING_REF
 #include "nsStringFwd.h"
 
 namespace mozilla {
 namespace dom {
 
-class KeyframeEffect;
+class KeyframeEffectReadOnly;
 
 class AnimationEffectTiming : public AnimationEffectTimingReadOnly
 {
 public:
   AnimationEffectTiming(nsIDocument* aDocument,
                         const TimingParams& aTiming,
-                        KeyframeEffect* aEffect)
+                        KeyframeEffectReadOnly* aEffect)
     : AnimationEffectTimingReadOnly(aDocument, aTiming)
     , mEffect(aEffect) { }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   void Unlink() override { mEffect = nullptr; }
 
   void SetDelay(double aDelay);
@@ -35,15 +35,15 @@ public:
   void SetIterationStart(double aIterationStart, ErrorResult& aRv);
   void SetIterations(double aIterations, ErrorResult& aRv);
   void SetDuration(const UnrestrictedDoubleOrString& aDuration,
                    ErrorResult& aRv);
   void SetDirection(const PlaybackDirection& aDirection);
   void SetEasing(const nsAString& aEasing, ErrorResult& aRv);
 
 private:
-  KeyframeEffect* MOZ_NON_OWNING_REF mEffect;
+  KeyframeEffectReadOnly* MOZ_NON_OWNING_REF mEffect;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_AnimationEffectTiming_h
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -61,29 +61,10 @@ KeyframeEffect::Constructor(
     JS::Handle<JSObject*> aKeyframes,
     const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
     ErrorResult& aRv)
 {
   return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aKeyframes,
                                                  aOptions, aRv);
 }
 
-void
-KeyframeEffect::NotifySpecifiedTimingUpdated()
-{
-  // Use the same document for a pseudo element and its parent element.
-  // Use nullptr if we don't have mTarget, so disable the mutation batch.
-  nsAutoAnimationMutationBatch mb(mTarget ? mTarget->mElement->OwnerDoc()
-                                          : nullptr);
-
-  if (mAnimation) {
-    mAnimation->NotifyEffectTimingUpdated();
-
-    if (mAnimation->IsRelevant()) {
-      nsNodeUtils::AnimationChanged(mAnimation);
-    }
-
-    RequestRestyle(EffectCompositor::RestyleType::Layer);
-  }
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -57,16 +57,14 @@ public:
   // for use with for Animatable.animate.
   // Not exposed to content.
   static already_AddRefed<KeyframeEffect>
   Constructor(const GlobalObject& aGlobal,
               const Nullable<ElementOrCSSPseudoElement>& aTarget,
               JS::Handle<JSObject*> aKeyframes,
               const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
               ErrorResult& aRv);
-
-  void NotifySpecifiedTimingUpdated();
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_KeyframeEffect_h
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -152,16 +152,35 @@ KeyframeEffectReadOnly::SetComposite(con
     RefPtr<ComputedStyle> computedStyle = GetTargetComputedStyle();
     if (computedStyle) {
       UpdateProperties(computedStyle);
     }
   }
 }
 
 void
+KeyframeEffectReadOnly::NotifySpecifiedTimingUpdated()
+{
+  // Use the same document for a pseudo element and its parent element.
+  // Use nullptr if we don't have mTarget, so disable the mutation batch.
+  nsAutoAnimationMutationBatch mb(mTarget ? mTarget->mElement->OwnerDoc()
+                                          : nullptr);
+
+  if (mAnimation) {
+    mAnimation->NotifyEffectTimingUpdated();
+
+    if (mAnimation->IsRelevant()) {
+      nsNodeUtils::AnimationChanged(mAnimation);
+    }
+
+    RequestRestyle(EffectCompositor::RestyleType::Layer);
+  }
+}
+
+void
 KeyframeEffectReadOnly::NotifyAnimationTimingUpdated()
 {
   UpdateTargetRegistration();
 
   // If the effect is not relevant it will be removed from the target
   // element's effect set. However, effects not in the effect set
   // will not be included in the set of candidate effects for running on
   // the compositor and hence they won't have their compositor status
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -170,16 +170,17 @@ public:
     CallerType aCallerType = CallerType::System) const;
   void SetIterationComposite(
     const IterationCompositeOperation& aIterationComposite,
     CallerType aCallerType);
 
   CompositeOperation Composite() const;
   void SetComposite(const CompositeOperation& aComposite);
 
+  void NotifySpecifiedTimingUpdated();
   void NotifyAnimationTimingUpdated();
   void RequestRestyle(EffectCompositor::RestyleType aRestyleType);
   void SetAnimation(Animation* aAnimation) override;
   void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
                     ErrorResult& aRv);
   void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
                     const ComputedStyle* aStyle);