Bug 1263962 - Expand on the StyleAnimationValue::ExtractComputedValue documentation. r=dholbert
authorJonathan Watt <jwatt@jwatt.org>
Fri, 01 Apr 2016 21:37:01 +0100
changeset 316683 f996f81bb492526e87ada48eabb4339bb5ff99fc
parent 316682 c93227b825a468a344a6129e1b5a4391ef16ae03
child 316684 2ebe18ffb2e38b331286c7322110931c6c1fc6e1
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1263962
milestone48.0a1
Bug 1263962 - Expand on the StyleAnimationValue::ExtractComputedValue documentation. r=dholbert
layout/style/StyleAnimationValue.cpp
layout/style/StyleAnimationValue.h
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -462,16 +462,17 @@ StyleAnimationValue::ComputeDistance(nsC
     GetCommonUnit(aProperty, aStartValue.GetUnit(), aEndValue.GetUnit());
 
   switch (commonUnit) {
     case eUnit_Null:
     case eUnit_Auto:
     case eUnit_None:
     case eUnit_Normal:
     case eUnit_UnparsedString:
+    case eUnit_URL:
       return false;
 
     case eUnit_Enumerated:
       switch (aProperty) {
         case eCSSProperty_font_stretch: {
           // just like eUnit_Integer.
           int32_t startInt = aStartValue.GetIntValue();
           int32_t endInt = aEndValue.GetIntValue();
@@ -1997,16 +1998,17 @@ StyleAnimationValue::AddWeighted(nsCSSPr
   // better.)
 
   switch (commonUnit) {
     case eUnit_Null:
     case eUnit_Auto:
     case eUnit_None:
     case eUnit_Normal:
     case eUnit_UnparsedString:
+    case eUnit_URL:
       return false;
 
     case eUnit_Enumerated:
       switch (aProperty) {
         case eCSSProperty_font_stretch: {
           // Animate just like eUnit_Integer.
           int32_t result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
                                  aCoeff2 * double(aValue2.GetIntValue()));
@@ -2874,16 +2876,20 @@ StyleAnimationValue::UncomputeValue(nsCS
     case eUnit_Transform:
       aSpecifiedValue.
         SetSharedListValue(aComputedValue.GetCSSValueSharedListValue());
       break;
     case eUnit_CSSValuePairList:
       aSpecifiedValue.
         SetDependentPairListValue(aComputedValue.GetCSSValuePairListValue());
       break;
+    case eUnit_URL:
+      aSpecifiedValue.
+      SetFloatValue(aComputedValue.GetURLV(), eCSSUnit_URL);
+      break;
     default:
       return false;
   }
   return true;
 }
 
 bool
 StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty,
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -221,16 +221,21 @@ public:
   static bool UncomputeValue(nsCSSProperty aProperty,
                              const StyleAnimationValue& aComputedValue,
                              nsAString& aSpecifiedValue);
 
   /**
    * Gets the computed value for the given property from the given style
    * context.
    *
+   * Obtaining the computed value allows us to animate properties when the
+   * content author has specified a value like "inherit" or "initial" or some
+   * other keyword that isn't directly interpolatable, but which *computes* to
+   * something interpolatable.
+   *
    * @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,
                                    StyleAnimationValue& aComputedValue);