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

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

Issue 863863004: Implemented additive animations for length (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed AnimationStackTest Created 5 years, 10 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 Interpolation_h 5 #ifndef Interpolation_h
6 #define Interpolation_h 6 #define Interpolation_h
7 7
8 #include "core/animation/AnimationEffect.h"
8 #include "core/animation/InterpolableValue.h" 9 #include "core/animation/InterpolableValue.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpola tion> { 14 class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpola tion> {
14 public: 15 public:
15 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) 16 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end)
16 { 17 {
17 return adoptRefWillBeNoop(new Interpolation(start, end)); 18 return adoptRefWillBeNoop(new Interpolation(start, end));
18 } 19 }
19 20
20 virtual ~Interpolation(); 21 virtual ~Interpolation();
21 22
23 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end,
24 AnimationEffect::CompositeOperation compositeStart, AnimationEffect::Com positeOperation compositeEnd)
25 {
26 return adoptRefWillBeNoop(new Interpolation(start, end, compositeStart, compositeEnd));
27 }
28
22 void interpolate(int iteration, double fraction) const; 29 void interpolate(int iteration, double fraction) const;
23 30
31 const InterpolableValue& cachedValue() const { return *m_cachedValue.get(); }
32 double cachedUnderlyingFraction() const { return m_cachedUnderlyingFraction; }
33
34 bool isReplaceOnly() const { return m_compositeStart == AnimationEffect::Com positeReplace && m_compositeEnd == AnimationEffect::CompositeReplace; }
35
24 virtual bool isStyleInterpolation() const { return false; } 36 virtual bool isStyleInterpolation() const { return false; }
25 virtual bool isLegacyStyleInterpolation() const { return false; } 37 virtual bool isLegacyStyleInterpolation() const { return false; }
26 38
27 virtual void trace(Visitor*); 39 virtual void trace(Visitor*);
28 40
29 protected: 41 protected:
30 const OwnPtrWillBeMember<InterpolableValue> m_start; 42 const OwnPtrWillBeMember<InterpolableValue> m_start;
31 const OwnPtrWillBeMember<InterpolableValue> m_end; 43 const OwnPtrWillBeMember<InterpolableValue> m_end;
44 const AnimationEffect::CompositeOperation m_compositeStart;
45 const AnimationEffect::CompositeOperation m_compositeEnd;
32 46
33 mutable double m_cachedFraction; 47 mutable double m_cachedFraction;
34 mutable int m_cachedIteration; 48 mutable int m_cachedIteration;
35 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; 49 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue;
50 mutable double m_cachedUnderlyingFraction;
36 51
52 // FIXME: Remove old constructor
37 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end); 53 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end);
38 54
55 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end,
56 AnimationEffect::CompositeOperation compositeStart, AnimationEffect::Com positeOperation compositeEnd);
57
39 private: 58 private:
40 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g et(); } 59 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g et(); }
41 60
42 friend class AnimationInterpolableValueTest; 61 friend class AnimationInterpolableValueTest;
43 friend class AnimationInterpolationEffectTest; 62 friend class AnimationInterpolationEffectTest;
44 friend class AnimationDoubleStyleInterpolationTest; 63 friend class AnimationDoubleStyleInterpolationTest;
45 friend class AnimationVisibilityStyleInterpolationTest; 64 friend class AnimationVisibilityStyleInterpolationTest;
46 friend class AnimationColorStyleInterpolationTest; 65 friend class AnimationColorStyleInterpolationTest;
47 }; 66 };
48 67
68 using InterpolationPipeline = WillBeHeapVector<RefPtrWillBeMember<Interpolation> >;
69 using InterpolationPipelineMap = WillBeHeapHashMap<CSSPropertyID, InterpolationP ipeline>;
alancutter (OOO until 2018) 2015/02/17 03:50:56 I'm a bit iffy about having InterpolationPipelineM
70
49 } // namespace blink 71 } // namespace blink
50 72
51 #endif // Interpolation_h 73 #endif // Interpolation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698