Bug 1203009 part 5 - Remove IsUsingCustomCompositeOrder; r=heycam
authorBrian Birtles <birtles@gmail.com>
Tue, 15 Sep 2015 13:32:12 +0900
changeset 295304 44462cfe313478176cb383aa4b1068b6d3feaea8
parent 295303 37b6deedaab676639f504ad9c263486c0062da18
child 295305 1444325d48409dac0531e73f2df9d56ac7776557
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1203009
milestone43.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 1203009 part 5 - Remove IsUsingCustomCompositeOrder; r=heycam
dom/animation/Animation.h
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -263,24 +263,16 @@ public:
   }
   bool IsRelevant() const { return mIsRelevant; }
   void UpdateRelevance();
 
   /**
    * Returns true if this Animation has a lower composite order than aOther.
    */
   virtual bool HasLowerCompositeOrderThan(const Animation& aOther) const;
-  /**
-   * Returns true if this Animation is involved in some sort of
-   * custom composite ordering (such as the ordering defined for CSS
-   * animations or CSS transitions).
-   *
-   * When this is true, this class will not update the sequence number.
-   */
-  virtual bool IsUsingCustomCompositeOrder() const { return false; }
 
   void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; }
   void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; }
   /**
    * Returns true if this animation does not currently need to update
    * style on the main thread (e.g. because it is empty, or is
    * running on the compositor).
    */
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -136,32 +136,28 @@ CSSAnimation::HasLowerCompositeOrderThan
   // ok.
   const CSSAnimation* otherAnimation = aOther.AsCSSAnimation();
   if (!otherAnimation) {
     MOZ_ASSERT(aOther.AsCSSTransition(),
                "Animation being compared is a CSS transition");
     return false;
   }
 
-  // 2. CSS animations using custom composite ordering (i.e. those that
-  //    correspond to an animation-name property) sort lower than other CSS
-  //    animations (e.g. those created or kept-alive by script).
-  if (!IsUsingCustomCompositeOrder()) {
-    return !aOther.IsUsingCustomCompositeOrder() ?
+  // 2. CSS animations that correspond to an animation-name property sort lower
+  //    than other CSS animations (e.g. those created or kept-alive by script).
+  if (!IsTiedToMarkup()) {
+    return !otherAnimation->IsTiedToMarkup() ?
            Animation::HasLowerCompositeOrderThan(aOther) :
            false;
   }
-  if (!aOther.IsUsingCustomCompositeOrder()) {
+  if (!otherAnimation->IsTiedToMarkup()) {
     return true;
   }
 
   // 3. Sort by document order
-  MOZ_ASSERT(mOwningElement.IsSet() && otherAnimation->mOwningElement.IsSet(),
-             "Animations using custom composite order should have an "
-             "owning element");
   if (!mOwningElement.Equals(otherAnimation->mOwningElement)) {
     return mOwningElement.LessThan(otherAnimation->mOwningElement);
   }
 
   // 4. (Same element and pseudo): Sort by position in animation-name
   return mAnimationIndex < otherAnimation->mAnimationIndex;
 }
 
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -117,41 +117,39 @@ public:
 
   void Tick() override;
   void QueueEvents();
   bool HasEndEventToQueue() const override;
 
   bool IsStylePaused() const { return mIsStylePaused; }
 
   bool HasLowerCompositeOrderThan(const Animation& aOther) const override;
-  bool IsUsingCustomCompositeOrder() const override
-  {
-    return mOwningElement.IsSet();
-  }
 
   void SetAnimationIndex(uint64_t aIndex)
   {
-    MOZ_ASSERT(IsUsingCustomCompositeOrder());
+    MOZ_ASSERT(IsTiedToMarkup());
     mAnimationIndex = aIndex;
   }
   void CopyAnimationIndex(const CSSAnimation& aOther)
   {
-    MOZ_ASSERT(IsUsingCustomCompositeOrder() &&
-               aOther.IsUsingCustomCompositeOrder());
+    MOZ_ASSERT(IsTiedToMarkup() && aOther.IsTiedToMarkup());
     mAnimationIndex = aOther.mAnimationIndex;
   }
 
   // Sets the owning element which is used for determining the composite
   // order of CSSAnimation objects generated from CSS markup.
   //
   // @see mOwningElement
   void SetOwningElement(const OwningElementRef& aElement)
   {
     mOwningElement = aElement;
   }
+  // True for animations that are generated from CSS markup and continue to
+  // reflect changes to that markup.
+  bool IsTiedToMarkup() const { return mOwningElement.IsSet(); }
 
   // Is this animation currently in effect for the purposes of computing
   // mWinsInCascade.  (In general, this can be computed from the timing
   // function.  This boolean remembers the state as of the last time we
   // called UpdateCascadeResults so we know if it changes and we need to
   // call UpdateCascadeResults again.)
   bool mInEffectForCascadeResults;
 
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -194,29 +194,26 @@ CSSTransition::HasLowerCompositeOrderTha
   // 1. Transitions sort lowest
   const CSSTransition* otherTransition = aOther.AsCSSTransition();
   if (!otherTransition) {
     return true;
   }
 
   // 2. CSS transitions that correspond to a transition-property property sort
   // lower than CSS transitions owned by script.
-  if (!IsUsingCustomCompositeOrder()) {
-    return !aOther.IsUsingCustomCompositeOrder() ?
+  if (!IsTiedToMarkup()) {
+    return !otherTransition->IsTiedToMarkup() ?
            Animation::HasLowerCompositeOrderThan(aOther) :
            false;
   }
-  if (!aOther.IsUsingCustomCompositeOrder()) {
+  if (!otherTransition->IsTiedToMarkup()) {
     return true;
   }
 
   // 3. Sort by document order
-  MOZ_ASSERT(mOwningElement.IsSet() && otherTransition->mOwningElement.IsSet(),
-             "Transitions using custom composite order should have an owning "
-             "element");
   if (!mOwningElement.Equals(otherTransition->mOwningElement)) {
     return mOwningElement.LessThan(otherTransition->mOwningElement);
   }
 
   // 4. (Same element and pseudo): Sort by transition generation
   if (mAnimationIndex != otherTransition->mAnimationIndex) {
     return mAnimationIndex < otherTransition->mAnimationIndex;
   }
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -128,35 +128,33 @@ public:
     Animation::CancelFromStyle();
   }
 
   void Tick() override;
 
   nsCSSProperty TransitionProperty() const;
 
   bool HasLowerCompositeOrderThan(const Animation& aOther) const override;
-  bool IsUsingCustomCompositeOrder() const override
-  {
-    return mOwningElement.IsSet();
-  }
-
   void SetCreationSequence(uint64_t aIndex)
   {
-    MOZ_ASSERT(IsUsingCustomCompositeOrder());
+    MOZ_ASSERT(IsTiedToMarkup());
     mAnimationIndex = aIndex;
   }
 
   // Sets the owning element which is used for determining the composite
   // oder of CSSTransition objects generated from CSS markup.
   //
   // @see mOwningElement
   void SetOwningElement(const OwningElementRef& aElement)
   {
     mOwningElement = aElement;
   }
+  // True for transitions that are generated from CSS markup and continue to
+  // reflect changes to that markup.
+  bool IsTiedToMarkup() const { return mOwningElement.IsSet(); }
 
 protected:
   virtual ~CSSTransition()
   {
     MOZ_ASSERT(!mOwningElement.IsSet(), "Owning element should be cleared "
                                         "before a CSS transition is destroyed");
   }