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

Side by Side Diff: Source/core/animation/Interpolation.h

Issue 182383011: Web Animations: Add Interpolation class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolableValue
Patch Set: Created 6 years, 9 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
(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 Interpolation_h
6 #define Interpolation_h
7
8 #include "core/animation/InterpolableValue.h"
9 #include "core/css/resolver/StyleResolverState.h"
10 #include "wtf/RefCounted.h"
11
12 namespace WebCore {
13
14 class Interpolation : public RefCounted<Interpolation> {
15 public:
16 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end)
17 {
18 return adoptRef(new Interpolation(start, end));
19 }
20
21 void interpolate(double fraction) const;
22
23 protected:
24 const OwnPtr<InterpolableValue> m_start;
25 const OwnPtr<InterpolableValue> m_end;
26
27 mutable double m_cachedFraction;
28 mutable OwnPtr<InterpolableValue> m_cachedValue;
29
30 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa lue> end);
31
32 private:
33 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g et(); }
34
35 friend class AnimationInterpolableValueTest;
36 };
37
38 class StyleInterpolation : public Interpolation {
39 public:
40 // 1) convert m_cachedValue into an X
41 // 2) shove X into StyleResolverState
42 // X can be:
43 // (1) a CSSValue (and applied via StyleBuilder::applyProperty)
44 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro perty)
45 // (3) a custom value that is inserted directly into the StyleResolverState.
46 virtual void apply(StyleResolverState&) = 0;
47
48 protected:
49 CSSPropertyID m_id;
50
51 StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpola bleValue> end, CSSPropertyID id)
52 : Interpolation(start, end)
53 , m_id(id)
54 { }
55 };
56
57 }
58 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/InterpolableValueTest.cpp ('k') | Source/core/animation/Interpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698