OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/animation/CSSPaintInterpolationType.h" | 5 #include "core/animation/CSSPaintInterpolationType.h" |
6 | 6 |
7 #include "core/animation/CSSColorInterpolationType.h" | 7 #include "core/animation/CSSColorInterpolationType.h" |
8 #include "core/animation/PaintPropertyFunctions.h" | 8 #include "core/animation/PaintPropertyFunctions.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ConversionCheckers&) const { | 82 ConversionCheckers&) const { |
83 std::unique_ptr<InterpolableValue> interpolableColor = | 83 std::unique_ptr<InterpolableValue> interpolableColor = |
84 CSSColorInterpolationType::maybeCreateInterpolableColor(value); | 84 CSSColorInterpolationType::maybeCreateInterpolableColor(value); |
85 if (!interpolableColor) | 85 if (!interpolableColor) |
86 return nullptr; | 86 return nullptr; |
87 return InterpolationValue(std::move(interpolableColor)); | 87 return InterpolationValue(std::move(interpolableColor)); |
88 } | 88 } |
89 | 89 |
90 InterpolationValue CSSPaintInterpolationType::maybeConvertUnderlyingValue( | 90 InterpolationValue CSSPaintInterpolationType::maybeConvertUnderlyingValue( |
91 const InterpolationEnvironment& environment) const { | 91 const InterpolationEnvironment& environment) const { |
92 // TODO(alancutter): Support capturing and animating with the visited paint co
lor. | 92 // TODO(alancutter): Support capturing and animating with the visited paint |
| 93 // color. |
93 StyleColor underlyingColor; | 94 StyleColor underlyingColor; |
94 if (!PaintPropertyFunctions::getColor( | 95 if (!PaintPropertyFunctions::getColor( |
95 cssProperty(), *environment.state().style(), underlyingColor)) | 96 cssProperty(), *environment.state().style(), underlyingColor)) |
96 return nullptr; | 97 return nullptr; |
97 return InterpolationValue( | 98 return InterpolationValue( |
98 CSSColorInterpolationType::createInterpolableColor(underlyingColor)); | 99 CSSColorInterpolationType::createInterpolableColor(underlyingColor)); |
99 } | 100 } |
100 | 101 |
101 void CSSPaintInterpolationType::apply( | 102 void CSSPaintInterpolationType::apply( |
102 const InterpolableValue& interpolableColor, | 103 const InterpolableValue& interpolableColor, |
103 const NonInterpolableValue*, | 104 const NonInterpolableValue*, |
104 InterpolationEnvironment& environment) const { | 105 InterpolationEnvironment& environment) const { |
105 PaintPropertyFunctions::setColor( | 106 PaintPropertyFunctions::setColor( |
106 cssProperty(), *environment.state().style(), | 107 cssProperty(), *environment.state().style(), |
107 CSSColorInterpolationType::resolveInterpolableColor(interpolableColor, | 108 CSSColorInterpolationType::resolveInterpolableColor(interpolableColor, |
108 environment.state())); | 109 environment.state())); |
109 } | 110 } |
110 | 111 |
111 } // namespace blink | 112 } // namespace blink |
OLD | NEW |