Bug 652991 - Part 3. Add parameter aContent to ExtractComputedValue draft
authorcku <cku@mozilla.com>
Tue, 28 Jun 2016 15:16:13 +0800
changeset 392146 34ec77182362d397d16ce1ff9d02351dd4507928
parent 392145 823d6a397ef06d2bdb9bc795cd34d9ea2365d0cc
child 392147 be9b0123c58566a3e006c0bc006d7deb7a294ad8
child 392156 b6821fd344868f96ffd90439f11685b031b2cb48
push id23949
push usercku@mozilla.com
push dateSat, 23 Jul 2016 22:03:58 +0000
bugs652991
milestone50.0a1
Bug 652991 - Part 3. Add parameter aContent to ExtractComputedValue MozReview-Commit-ID: C6HFoRj9HcP
layout/style/StyleAnimationValue.cpp
layout/style/StyleAnimationValue.h
layout/style/nsAnimationManager.cpp
layout/style/nsStyleContext.cpp
layout/style/nsTransitionManager.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -2881,25 +2881,27 @@ ComputeValuesFromStyleRule(nsCSSProperty
     CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty, aEnabledState) {
       if (nsCSSProps::kAnimTypeTable[*p] == eStyleAnimType_None) {
         // Skip non-animatable component longhands.
         continue;
       }
       PropertyStyleAnimationValuePair* pair = aValues.AppendElement();
       pair->mProperty = *p;
       if (!StyleAnimationValue::ExtractComputedValue(*p, tmpStyleContext,
+                                                     aTargetElement,
                                                      pair->mValue)) {
         return false;
       }
     }
     return true;
   } else {
     PropertyStyleAnimationValuePair* pair = aValues.AppendElement();
     pair->mProperty = aProperty;
     return StyleAnimationValue::ExtractComputedValue(aProperty, tmpStyleContext,
+                                                     aTargetElement,
                                                      pair->mValue);
   }
 }
 
 /* static */ bool
 StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
                                   dom::Element* aTargetElement,
                                   nsStyleContext* aStyleContext,
@@ -3576,16 +3578,17 @@ StyleClipBasicShapeToCSSArray(const nsSt
   aResult->Item(1).SetIntValue(uint8_t(aClipPath.GetSizingBox()),
                                eCSSUnit_Enumerated);
   return true;
 }
 
 bool
 StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
                                           nsStyleContext* aStyleContext,
+                                          nsIContent* aContent,
                                           StyleAnimationValue& aComputedValue)
 {
   MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands,
              "bad property");
   const void* styleStruct =
     aStyleContext->StyleData(nsCSSProps::kSIDTable[aProperty]);
   ptrdiff_t ssOffset = nsCSSProps::kStyleStructOffsetTable[aProperty];
   nsStyleAnimType animType = nsCSSProps::kAnimTypeTable[aProperty];
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -15,16 +15,17 @@
 #include "nsCoord.h"
 #include "nsColor.h"
 #include "nsCSSProps.h"
 #include "nsCSSValue.h"
 
 class nsIFrame;
 class nsStyleContext;
 class gfx3DMatrix;
+class nsIContent;
 
 namespace mozilla {
 
 namespace css {
 class StyleRule;
 } // namespace css
 
 namespace dom {
@@ -233,16 +234,17 @@ public:
    *
    * @param aProperty     The property whose value we're looking up.
    * @param aStyleContext The style context to check for the computed value.
    * @param [out] aComputedValue The resulting computed value.
    * @return true on success, false on failure.
    */
   static bool ExtractComputedValue(nsCSSProperty aProperty,
                                    nsStyleContext* aStyleContext,
+                                   nsIContent* aContent,
                                    StyleAnimationValue& aComputedValue);
 
   /**
    * Interpolates between 2 matrices by decomposing them.
    *
    * @param aMatrix1   First matrix, using CSS pixel units.
    * @param aMatrix2   Second matrix, using CSS pixel units.
    * @param aProgress  Interpolation value in the range [0.0, 1.0]
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -889,16 +889,17 @@ CSSAnimationBuilder::GetKeyframeProperty
       continue;
     }
 
     PropertyValuePair pair;
     pair.mProperty = prop;
 
     StyleAnimationValue computedValue;
     if (!StyleAnimationValue::ExtractComputedValue(prop, styleContext,
+                                                   mTarget,
                                                    computedValue)) {
       continue;
     }
     DebugOnly<bool> uncomputeResult =
       StyleAnimationValue::UncomputeValue(prop, Move(computedValue),
                                           pair.mValue);
     MOZ_ASSERT(uncomputeResult,
                "Unable to get specified value from computed value");
@@ -1039,16 +1040,17 @@ CSSAnimationBuilder::GetComputedValue(ns
                "animations");
     mStyleWithoutAnimation = aPresContext->StyleSet()->AsGecko()->
       ResolveStyleWithoutAnimation(mTarget, mStyleContext,
                                    eRestyle_AllHintsWithAnimations);
   }
 
   if (StyleAnimationValue::ExtractComputedValue(aProperty,
                                                 mStyleWithoutAnimation,
+                                                mTarget,
                                                 computedValue)) {
     StyleAnimationValue::UncomputeValue(aProperty, Move(computedValue), result);
   }
 
   // If we hit this assertion, it probably means we are fetching a value from
   // the computed style that we don't know how to represent as
   // a StyleAnimationValue.
   MOZ_ASSERT(result.GetUnit() != eCSSUnit_Null, "Got null computed value");
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -1337,16 +1337,17 @@ nsStyleContext::Arena()
 
 static inline void
 ExtractAnimationValue(nsCSSProperty aProperty,
                       nsStyleContext* aStyleContext,
                       StyleAnimationValue& aResult)
 {
   DebugOnly<bool> success =
     StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext,
+                                              nullptr,
                                               aResult);
   MOZ_ASSERT(success,
              "aProperty must be extractable by StyleAnimationValue");
 }
 
 static nscolor
 ExtractColor(nsCSSProperty aProperty,
              nsStyleContext *aStyleContext)
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -549,16 +549,17 @@ nsTransitionManager::UpdateTransitions(
            !allTransitionProperties.HasProperty(anim->TransitionProperty())) ||
           // properties whose computed values changed but for which we
           // did not start a new transition (because delay and
           // duration are both zero, or because the new value is not
           // interpolable); a new transition would have anim->ToValue()
           // matching currentValue
           !StyleAnimationValue::ExtractComputedValue(anim->TransitionProperty(),
                                                      aNewStyleContext,
+                                                     aElement,
                                                      currentValue) ||
           currentValue != anim->ToValue()) {
         // stop the transition
         if (anim->HasCurrentEffect()) {
           EffectSet* effectSet =
             EffectSet::GetEffectSet(aElement,
                                     aNewStyleContext->GetPseudoType());
           if (effectSet) {
@@ -616,19 +617,21 @@ nsTransitionManager::ConsiderStartingTra
   }
 
   dom::DocumentTimeline* timeline = aElement->OwnerDoc()->Timeline();
 
   StyleAnimationValue startValue, endValue, dummyValue;
   bool haveValues =
     StyleAnimationValue::ExtractComputedValue(aProperty,
                                               aOldStyleContext,
+                                              aElement,
                                               startValue) &&
     StyleAnimationValue::ExtractComputedValue(aProperty,
                                               aNewStyleContext,
+                                              aElement,
                                               endValue);
 
   bool haveChange = startValue != endValue;
 
   bool shouldAnimate =
     haveValues &&
     haveChange &&
     // Check that we can interpolate between these values
@@ -926,16 +929,17 @@ nsTransitionManager::PruneCompletedTrans
       continue;
     }
 
     // Since effect is a finished transition, we know it didn't
     // influence style.
     StyleAnimationValue currentValue;
     if (!StyleAnimationValue::ExtractComputedValue(anim->TransitionProperty(),
                                                    aNewStyleContext,
+                                                   aElement,
                                                    currentValue) ||
         currentValue != anim->ToValue()) {
       anim->CancelFromStyle();
       animations.RemoveElementAt(i);
     }
   } while (i != 0);
 
   if (collection->mAnimations.IsEmpty()) {