Bug 1125455 patch 1 - Add boolean for whether an animation of a property wins in the CSS cascade. r=birtles
authorL. David Baron <dbaron@dbaron.org>
Thu, 19 Mar 2015 21:10:00 -0700
changeset 263514 8d01ce976a2bb348a8b5a23145951f681bfef160
parent 263513 ceaac3da2eff663f326dbf863029756ac8b93dff
child 263515 52e314d3037e8ea28c474f4494b0715228441e26
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1125455
milestone39.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 1125455 patch 1 - Add boolean for whether an animation of a property wins in the CSS cascade. r=birtles
dom/animation/Animation.h
layout/style/nsAnimationManager.cpp
layout/style/nsTransitionManager.cpp
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -145,20 +145,35 @@ struct AnimationPropertySegment
   bool operator!=(const AnimationPropertySegment& aOther) const {
     return !(*this == aOther);
   }
 };
 
 struct AnimationProperty
 {
   nsCSSProperty mProperty;
+
+  // Does this property win in the CSS Cascade?
+  //
+  // For CSS transitions, this is true as long as a CSS animation on the
+  // same property and element is not running, in which case we set this
+  // to false so that the animation (lower in the cascade) can win.  We
+  // then use this to decide whether to apply the style both in the CSS
+  // cascade and for OMTA.
+  //
+  // FIXME (bug 847287): For CSS Animations, which are overridden by
+  // !important rules in the cascade, we actually determine this from
+  // the CSS cascade computations, and then use it for OMTA.
+  bool mWinsInCascade;
+
   InfallibleTArray<AnimationPropertySegment> mSegments;
 
   bool operator==(const AnimationProperty& aOther) const {
     return mProperty == aOther.mProperty &&
+           mWinsInCascade == aOther.mWinsInCascade &&
            mSegments == aOther.mSegments;
   }
   bool operator!=(const AnimationProperty& aOther) const {
     return !(*this == aOther);
   }
 };
 
 struct ElementPropertyTransition;
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -589,16 +589,17 @@ nsAnimationManager::BuildAnimations(nsSt
         } else {
           keyframesWithProperty.AppendElement(kfIdx);
         }
         lastKey = kf.mKey;
       }
 
       AnimationProperty &propData = *destAnim->Properties().AppendElement();
       propData.mProperty = prop;
+      propData.mWinsInCascade = true;
 
       KeyframeData *fromKeyframe = nullptr;
       nsRefPtr<nsStyleContext> fromContext;
       bool interpolated = true;
       for (uint32_t wpIdx = 0, wpEnd = keyframesWithProperty.Length();
            wpIdx != wpEnd; ++wpIdx) {
         uint32_t kfIdx = keyframesWithProperty[wpIdx];
         KeyframeData &toKeyframe = sortedKeyframes[kfIdx];
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -540,16 +540,17 @@ nsTransitionManager::ConsiderStartingTra
   nsRefPtr<ElementPropertyTransition> pt =
     new ElementPropertyTransition(aElement->OwnerDoc(), aElement,
                                   aNewStyleContext->GetPseudoType(), timing);
   pt->mStartForReversingTest = startForReversingTest;
   pt->mReversePortion = reversePortion;
 
   AnimationProperty& prop = *pt->Properties().AppendElement();
   prop.mProperty = aProperty;
+  prop.mWinsInCascade = true;
 
   AnimationPropertySegment& segment = *prop.mSegments.AppendElement();
   segment.mFromValue = startValue;
   segment.mToValue = endValue;
   segment.mFromKey = 0;
   segment.mToKey = 1;
   segment.mTimingFunction.Init(tf);