Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h

Issue 2611123004: Combine {Legacy,}StyleInterpolation.h (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef LegacyStyleInterpolation_h 5 #ifndef LegacyStyleInterpolation_h
6 #define LegacyStyleInterpolation_h 6 #define LegacyStyleInterpolation_h
7 7
8 #include "core/animation/StyleInterpolation.h" 8 #include "core/CSSPropertyNames.h"
9 #include "core/CoreExport.h"
10 #include "core/animation/Interpolation.h"
11 #include "core/animation/PropertyHandle.h"
9 #include "core/css/resolver/AnimatedStyleBuilder.h" 12 #include "core/css/resolver/AnimatedStyleBuilder.h"
10 #include <memory> 13 #include <memory>
11 14
12 namespace blink { 15 namespace blink {
13 16
17 class StyleResolverState;
18
19 class CORE_EXPORT StyleInterpolation : public Interpolation {
20 public:
21 // 1) convert m_cachedValue into an X
22 // 2) shove X into StyleResolverState
23 // X can be:
24 // (1) a CSSValue (and applied via StyleBuilder::applyProperty)
25 // (2) an AnimatableValue (and applied via
26 // AnimatedStyleBuilder::applyProperty)
27 // (3) a custom value that is inserted directly into the StyleResolverState.
28 virtual void apply(StyleResolverState&) const = 0;
29
30 bool isStyleInterpolation() const final { return true; }
31
32 CSSPropertyID id() const { return m_id; }
33
34 PropertyHandle getProperty() const final { return PropertyHandle(id()); }
35
36 protected:
37 CSSPropertyID m_id;
38
39 StyleInterpolation(std::unique_ptr<InterpolableValue> start,
40 std::unique_ptr<InterpolableValue> end,
41 CSSPropertyID id)
42 : Interpolation(std::move(start), std::move(end)), m_id(id) {}
43 };
44
45 DEFINE_TYPE_CASTS(StyleInterpolation,
46 Interpolation,
47 value,
48 value->isStyleInterpolation(),
49 value.isStyleInterpolation());
50
14 class LegacyStyleInterpolation : public StyleInterpolation { 51 class LegacyStyleInterpolation : public StyleInterpolation {
15 public: 52 public:
16 static PassRefPtr<LegacyStyleInterpolation> create( 53 static PassRefPtr<LegacyStyleInterpolation> create(
17 PassRefPtr<AnimatableValue> start, 54 PassRefPtr<AnimatableValue> start,
18 PassRefPtr<AnimatableValue> end, 55 PassRefPtr<AnimatableValue> end,
19 CSSPropertyID id) { 56 CSSPropertyID id) {
20 return adoptRef(new LegacyStyleInterpolation( 57 return adoptRef(new LegacyStyleInterpolation(
21 InterpolableAnimatableValue::create(std::move(start)), 58 InterpolableAnimatableValue::create(std::move(start)),
22 InterpolableAnimatableValue::create(std::move(end)), id)); 59 InterpolableAnimatableValue::create(std::move(end)), id));
23 } 60 }
(...skipping 16 matching lines...) Expand all
40 77
41 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, 78 DEFINE_TYPE_CASTS(LegacyStyleInterpolation,
42 Interpolation, 79 Interpolation,
43 value, 80 value,
44 value->isLegacyStyleInterpolation(), 81 value->isLegacyStyleInterpolation(),
45 value.isLegacyStyleInterpolation()); 82 value.isLegacyStyleInterpolation());
46 83
47 } // namespace blink 84 } // namespace blink
48 85
49 #endif 86 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698