diff options
author | Moonchild <moonchild@palemoon.org> | 2021-06-12 11:36:16 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-06-12 11:36:16 +0000 |
commit | 205e69e2bb90617f65b2a49146c47ae18ef24da0 (patch) | |
tree | 5f6d530760d2a6aa4040367de9a2c7438bfc008b /layout/style | |
parent | c337c1496b4cdcdab3b3c52a9ad8c627b52e06a1 (diff) | |
download | uxp-205e69e2bb90617f65b2a49146c47ae18ef24da0.tar.gz |
Issue #1781 - Part 2: Fix animation interpolation for stroke-dashoffset.
Since we have calc() and floats working now, this is a trivial fix.
Diffstat (limited to 'layout/style')
-rw-r--r-- | layout/style/StyleAnimationValue.cpp | 14 | ||||
-rw-r--r-- | layout/style/nsCSSPropList.h | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index ff67835536..2332de6a6a 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -63,11 +63,15 @@ GetCommonUnit(nsCSSPropertyID aProperty, StyleAnimationValue::Unit aSecondUnit) { if (aFirstUnit != aSecondUnit) { + bool numberAsPixel = + nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_NUMBERS_ARE_PIXELS); if (nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_STORES_CALC) && - (aFirstUnit == StyleAnimationValue::eUnit_Coord || + ((aFirstUnit == StyleAnimationValue::eUnit_Float && numberAsPixel) || + aFirstUnit == StyleAnimationValue::eUnit_Coord || aFirstUnit == StyleAnimationValue::eUnit_Percent || aFirstUnit == StyleAnimationValue::eUnit_Calc) && - (aSecondUnit == StyleAnimationValue::eUnit_Coord || + ((aSecondUnit == StyleAnimationValue::eUnit_Float && numberAsPixel) || + aSecondUnit == StyleAnimationValue::eUnit_Coord || aSecondUnit == StyleAnimationValue::eUnit_Percent || aSecondUnit == StyleAnimationValue::eUnit_Calc)) { // We can use calc() as the common unit. @@ -354,6 +358,12 @@ ExtractCalcValue(const StyleAnimationValue& aValue) result.mHasPercent = true; return result; } + if (aValue.GetUnit() == StyleAnimationValue::eUnit_Float) { + result.mLength = aValue.GetFloatValue(); + result.mPercent = 0.0f; + result.mHasPercent = false; + return result; + } MOZ_ASSERT(aValue.GetUnit() == StyleAnimationValue::eUnit_Calc, "unexpected unit"); nsCSSValue *val = aValue.GetCSSValueValue(); diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index f0cab6b131..45e919d4f8 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3814,7 +3814,8 @@ CSS_PROP_SVG( stroke_dashoffset, StrokeDashoffset, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_NUMBERS_ARE_PIXELS, + CSS_PROPERTY_NUMBERS_ARE_PIXELS | + CSS_PROPERTY_STORES_CALC, "", VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD | VARIANT_CALC, kStrokeContextValueKTable, |