Bug 1216843 - Part 5: Reuse AddWeightedColors and DiluteColor in AddShadowItems(). r=dholbert
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 13 Sep 2016 11:48:45 +0900
changeset 354922 5b9e1beaf507734232082af1920380595fda0fcf
parent 354921 0ad4796f6bb82e2734c26d048304b6f19651e16d
child 354923 8c1631ef0ad9d31c59a02a0a6fc26968414ea376
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1216843
milestone51.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 1216843 - Part 5: Reuse AddWeightedColors and DiluteColor in AddShadowItems(). r=dholbert Now we can modify AddWeightedColors to use for accumulation. MozReview-Commit-ID: JQb2fhhDj7g
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -1264,29 +1264,21 @@ AddShadowItems(double aCoeff1, const nsC
   if (color1.GetUnit() != color2.GetUnit() ||
       inset1.GetUnit() != inset2.GetUnit()) {
     // We don't know how to animate between color and no-color, or
     // between inset and not-inset.
     return false;
   }
 
   if (color1.GetUnit() != eCSSUnit_Null) {
-    StyleAnimationValue color1Value
-      (color1.GetColorValue(), StyleAnimationValue::ColorConstructor);
-    StyleAnimationValue color2Value
-      (color2.GetColorValue(), StyleAnimationValue::ColorConstructor);
-    StyleAnimationValue resultColorValue;
-    DebugOnly<bool> ok =
-      StyleAnimationValue::AddWeighted(eCSSProperty_color,
-                                       aCoeff1, color1Value,
-                                       aCoeff2, color2Value,
-                                       resultColorValue);
-    MOZ_ASSERT(ok, "should not fail");
-    resultArray->Item(4).SetColorValue(
-      resultColorValue.GetCSSValueValue()->GetColorValue());
+    if (aCoeff2 == 0.0 && aCoeff1 != 1.0) {
+      DiluteColor(color1, aCoeff1, resultArray->Item(4));
+    } else {
+      AddWeightedColors(aCoeff1, color1, aCoeff2, color2, resultArray->Item(4));
+    }
   }
 
   MOZ_ASSERT(inset1 == inset2, "should match");
   resultArray->Item(5) = inset1;
 
   nsCSSValueList *resultItem = new nsCSSValueList;
   resultItem->mValue.SetArrayValue(resultArray, eCSSUnit_Array);
   *aResultTail = resultItem;