OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef StyleInterpolation_h | |
6 #define StyleInterpolation_h | |
7 | |
8 #include "core/CSSPropertyNames.h" | |
9 #include "core/CoreExport.h" | |
10 #include "core/animation/Interpolation.h" | |
11 #include "core/animation/PropertyHandle.h" | |
12 #include <memory> | |
13 | |
14 namespace blink { | |
15 | |
16 class StyleResolverState; | |
17 | |
18 class CORE_EXPORT StyleInterpolation : public Interpolation { | |
19 public: | |
20 // 1) convert m_cachedValue into an X | |
21 // 2) shove X into StyleResolverState | |
22 // X can be: | |
23 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) | |
24 // (2) an AnimatableValue (and applied via | |
25 // AnimatedStyleBuilder::applyProperty) | |
26 // (3) a custom value that is inserted directly into the StyleResolverState. | |
27 virtual void apply(StyleResolverState&) const = 0; | |
28 | |
29 bool isStyleInterpolation() const final { return true; } | |
30 | |
31 CSSPropertyID id() const { return m_id; } | |
32 | |
33 PropertyHandle getProperty() const final { return PropertyHandle(id()); } | |
34 | |
35 protected: | |
36 CSSPropertyID m_id; | |
37 | |
38 StyleInterpolation(std::unique_ptr<InterpolableValue> start, | |
39 std::unique_ptr<InterpolableValue> end, | |
40 CSSPropertyID id) | |
41 : Interpolation(std::move(start), std::move(end)), m_id(id) {} | |
42 }; | |
43 | |
44 DEFINE_TYPE_CASTS(StyleInterpolation, | |
45 Interpolation, | |
46 value, | |
47 value->isStyleInterpolation(), | |
48 value.isStyleInterpolation()); | |
49 | |
50 } // namespace blink | |
51 | |
52 #endif | |
OLD | NEW |