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
--- 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;