Chromium Code Reviews| Index: third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp |
| diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp |
| index 93f1624dc4358cfca72214bac760bd8926ae8fde..dcb189c6fd981292f3ea6fd0121561b25b460abf 100644 |
| --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp |
| +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp |
| @@ -121,11 +121,12 @@ Color CSSColorInterpolationType::resolveInterpolableColor( |
| ? ColorPropertyFunctions::getVisitedColor |
| : ColorPropertyFunctions::getUnvisitedColor; |
| StyleColor currentStyleColor = StyleColor::currentColor(); |
| - if (isTextDecoration) |
| - currentStyleColor = |
| - currentColorGetter(CSSPropertyWebkitTextFillColor, *state.style()); |
| + if (isTextDecoration) { |
| + currentColorGetter(CSSPropertyWebkitTextFillColor, *state.style(), |
| + currentStyleColor); |
| + } |
| if (currentStyleColor.isCurrentColor()) |
| - currentStyleColor = currentColorGetter(CSSPropertyColor, *state.style()); |
| + currentColorGetter(CSSPropertyColor, *state.style(), currentStyleColor); |
| addPremultipliedColor(red, green, blue, alpha, currentcolorFraction, |
| currentStyleColor.getColor()); |
| } |
| @@ -166,8 +167,11 @@ class InheritedColorChecker : public InterpolationType::ConversionChecker { |
| bool isValid(const InterpolationEnvironment& environment, |
| const InterpolationValue& underlying) const final { |
| - return m_color == ColorPropertyFunctions::getUnvisitedColor( |
| - m_property, *environment.state().parentStyle()); |
| + StyleColor unvisitedColor; |
| + if (!ColorPropertyFunctions::getUnvisitedColor( |
| + m_property, *environment.state().parentStyle(), unvisitedColor)) |
| + return false; |
| + return m_color == unvisitedColor; |
| } |
| const CSSPropertyID m_property; |
| @@ -184,9 +188,10 @@ InterpolationValue CSSColorInterpolationType::maybeConvertNeutral( |
| InterpolationValue CSSColorInterpolationType::maybeConvertInitial( |
| const StyleResolverState&, |
| ConversionCheckers& conversionCheckers) const { |
| - const StyleColor initialColor = |
| - ColorPropertyFunctions::getInitialColor(cssProperty()); |
| - return convertStyleColorPair(initialColor, initialColor); |
| + StyleColor initialColor; |
| + if (ColorPropertyFunctions::getInitialColor(cssProperty(), initialColor)) |
| + return convertStyleColorPair(initialColor, initialColor); |
| + return nullptr; |
| } |
| InterpolationValue CSSColorInterpolationType::maybeConvertInherit( |
| @@ -196,8 +201,10 @@ InterpolationValue CSSColorInterpolationType::maybeConvertInherit( |
| return nullptr; |
| // Visited color can never explicitly inherit from parent visited color so |
| // only use the unvisited color. |
| - const StyleColor inheritedColor = ColorPropertyFunctions::getUnvisitedColor( |
| - cssProperty(), *state.parentStyle()); |
| + StyleColor inheritedColor; |
| + if (!ColorPropertyFunctions::getUnvisitedColor( |
| + cssProperty(), *state.parentStyle(), inheritedColor)) |
| + return nullptr; |
| conversionCheckers.push_back( |
| InheritedColorChecker::create(cssProperty(), inheritedColor)); |
| return convertStyleColorPair(inheritedColor, inheritedColor); |
| @@ -240,11 +247,16 @@ InterpolationValue CSSColorInterpolationType::convertStyleColorPair( |
| InterpolationValue CSSColorInterpolationType::maybeConvertUnderlyingValue( |
| const InterpolationEnvironment& environment) const { |
| - return convertStyleColorPair( |
| - ColorPropertyFunctions::getUnvisitedColor(cssProperty(), |
| - *environment.state().style()), |
| - ColorPropertyFunctions::getVisitedColor(cssProperty(), |
| - *environment.state().style())); |
| + StyleColor unvisitedColor; |
| + if (!ColorPropertyFunctions::getUnvisitedColor( |
| + cssProperty(), *environment.state().style(), unvisitedColor)) |
| + return nullptr; |
| + StyleColor visitedColor; |
| + if (!ColorPropertyFunctions::getVisitedColor( |
| + cssProperty(), *environment.state().style(), visitedColor)) |
| + return nullptr; |
|
alancutter (OOO until 2018)
2016/12/21 00:49:05
I see a problem here. If either the visited or unv
Manuel Rego
2016/12/21 13:14:38
Wow, it's clear this is getting more complex. :-)
|
| + |
| + return convertStyleColorPair(unvisitedColor, visitedColor); |
| } |
| void CSSColorInterpolationType::apply( |