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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolation
Type::maybeCreateInterpolableColor(value); | 78 std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolation
Type::maybeCreateInterpolableColor(value); |
79 if (!interpolableColor) | 79 if (!interpolableColor) |
80 return nullptr; | 80 return nullptr; |
81 return InterpolationValue(std::move(interpolableColor)); | 81 return InterpolationValue(std::move(interpolableColor)); |
82 } | 82 } |
83 | 83 |
84 InterpolationValue CSSPaintInterpolationType::maybeConvertUnderlyingValue(const
InterpolationEnvironment& environment) const | 84 InterpolationValue CSSPaintInterpolationType::maybeConvertUnderlyingValue(const
InterpolationEnvironment& environment) const |
85 { | 85 { |
86 // TODO(alancutter): Support capturing and animating with the visited paint
color. | 86 // TODO(alancutter): Support capturing and animating with the visited paint
color. |
87 StyleColor underlyingColor; | 87 StyleColor underlyingColor; |
88 if (!PaintPropertyFunctions::getColor(cssProperty(), *environment.state().st
yle(), underlyingColor)) | 88 if (!PaintPropertyFunctions::getColor(cssProperty(), environment.style(), un
derlyingColor)) |
89 return nullptr; | 89 return nullptr; |
90 return InterpolationValue(CSSColorInterpolationType::createInterpolableColor
(underlyingColor)); | 90 return InterpolationValue(CSSColorInterpolationType::createInterpolableColor
(underlyingColor)); |
91 } | 91 } |
92 | 92 |
93 void CSSPaintInterpolationType::apply(const InterpolableValue& interpolableColor
, const NonInterpolableValue*, InterpolationEnvironment& environment) const | 93 void CSSPaintInterpolationType::apply(const InterpolableValue& interpolableColor
, const NonInterpolableValue*, InterpolationEnvironment& environment) const |
94 { | 94 { |
95 PaintPropertyFunctions::setColor(cssProperty(), *environment.state().style()
, CSSColorInterpolationType::resolveInterpolableColor(interpolableColor, environ
ment.state())); | 95 PaintPropertyFunctions::setColor(cssProperty(), environment.style(), CSSColo
rInterpolationType::resolveInterpolableColor(interpolableColor, environment.stat
e())); |
96 } | 96 } |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
OLD | NEW |