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

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

Issue 2384263003: Reflow comments in core/animation and subdirs (Closed)
Patch Set: Created 4 years, 2 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 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 #ifndef PrimitiveInterpolation_h 5 #ifndef PrimitiveInterpolation_h
6 #define PrimitiveInterpolation_h 6 #define PrimitiveInterpolation_h
7 7
8 #include "core/animation/TypedInterpolationValue.h" 8 #include "core/animation/TypedInterpolationValue.h"
9 #include "platform/animation/AnimationUtilities.h" 9 #include "platform/animation/AnimationUtilities.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/PtrUtil.h" 11 #include "wtf/PtrUtil.h"
12 #include "wtf/Vector.h" 12 #include "wtf/Vector.h"
13 #include <cmath> 13 #include <cmath>
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class StyleResolverState; 18 class StyleResolverState;
19 19
20 // Represents an animation's effect between an adjacent pair of PropertySpecific Keyframes after converting 20 // Represents an animation's effect between an adjacent pair of
21 // the keyframes to an internal format with respect to the animation environment and underlying values. 21 // PropertySpecificKeyframes after converting the keyframes to an internal
22 // format with respect to the animation environment and underlying values.
22 class PrimitiveInterpolation { 23 class PrimitiveInterpolation {
23 USING_FAST_MALLOC(PrimitiveInterpolation); 24 USING_FAST_MALLOC(PrimitiveInterpolation);
24 WTF_MAKE_NONCOPYABLE(PrimitiveInterpolation); 25 WTF_MAKE_NONCOPYABLE(PrimitiveInterpolation);
25 26
26 public: 27 public:
27 virtual ~PrimitiveInterpolation() {} 28 virtual ~PrimitiveInterpolation() {}
28 29
29 virtual void interpolateValue( 30 virtual void interpolateValue(
30 double fraction, 31 double fraction,
31 std::unique_ptr<TypedInterpolationValue>& result) const = 0; 32 std::unique_ptr<TypedInterpolationValue>& result) const = 0;
32 virtual double interpolateUnderlyingFraction(double start, 33 virtual double interpolateUnderlyingFraction(double start,
33 double end, 34 double end,
34 double fraction) const = 0; 35 double fraction) const = 0;
35 virtual bool isFlip() const { return false; } 36 virtual bool isFlip() const { return false; }
36 37
37 protected: 38 protected:
38 PrimitiveInterpolation() {} 39 PrimitiveInterpolation() {}
39 }; 40 };
40 41
41 // Represents a pair of keyframes that are compatible for "smooth" interpolation eg. "0px" and "100px". 42 // Represents a pair of keyframes that are compatible for "smooth" interpolation
43 // eg. "0px" and "100px".
42 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation { 44 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation {
43 public: 45 public:
44 ~PairwisePrimitiveInterpolation() override {} 46 ~PairwisePrimitiveInterpolation() override {}
45 47
46 static std::unique_ptr<PairwisePrimitiveInterpolation> create( 48 static std::unique_ptr<PairwisePrimitiveInterpolation> create(
47 const InterpolationType& type, 49 const InterpolationType& type,
48 std::unique_ptr<InterpolableValue> start, 50 std::unique_ptr<InterpolableValue> start,
49 std::unique_ptr<InterpolableValue> end, 51 std::unique_ptr<InterpolableValue> end,
50 PassRefPtr<NonInterpolableValue> nonInterpolableValue) { 52 PassRefPtr<NonInterpolableValue> nonInterpolableValue) {
51 return wrapUnique(new PairwisePrimitiveInterpolation( 53 return wrapUnique(new PairwisePrimitiveInterpolation(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 double fraction) const final { 91 double fraction) const final {
90 return blend(start, end, fraction); 92 return blend(start, end, fraction);
91 } 93 }
92 94
93 const InterpolationType& m_type; 95 const InterpolationType& m_type;
94 std::unique_ptr<InterpolableValue> m_start; 96 std::unique_ptr<InterpolableValue> m_start;
95 std::unique_ptr<InterpolableValue> m_end; 97 std::unique_ptr<InterpolableValue> m_end;
96 RefPtr<NonInterpolableValue> m_nonInterpolableValue; 98 RefPtr<NonInterpolableValue> m_nonInterpolableValue;
97 }; 99 };
98 100
99 // Represents a pair of incompatible keyframes that fall back to 50% flip behavi our eg. "auto" and "0px". 101 // Represents a pair of incompatible keyframes that fall back to 50% flip
102 // behaviour eg. "auto" and "0px".
100 class FlipPrimitiveInterpolation : public PrimitiveInterpolation { 103 class FlipPrimitiveInterpolation : public PrimitiveInterpolation {
101 public: 104 public:
102 ~FlipPrimitiveInterpolation() override {} 105 ~FlipPrimitiveInterpolation() override {}
103 106
104 static std::unique_ptr<FlipPrimitiveInterpolation> create( 107 static std::unique_ptr<FlipPrimitiveInterpolation> create(
105 std::unique_ptr<TypedInterpolationValue> start, 108 std::unique_ptr<TypedInterpolationValue> start,
106 std::unique_ptr<TypedInterpolationValue> end) { 109 std::unique_ptr<TypedInterpolationValue> end) {
107 return wrapUnique( 110 return wrapUnique(
108 new FlipPrimitiveInterpolation(std::move(start), std::move(end))); 111 new FlipPrimitiveInterpolation(std::move(start), std::move(end)));
109 } 112 }
(...skipping 26 matching lines...) Expand all
136 bool isFlip() const final { return true; } 139 bool isFlip() const final { return true; }
137 140
138 std::unique_ptr<TypedInterpolationValue> m_start; 141 std::unique_ptr<TypedInterpolationValue> m_start;
139 std::unique_ptr<TypedInterpolationValue> m_end; 142 std::unique_ptr<TypedInterpolationValue> m_end;
140 mutable double m_lastFraction; 143 mutable double m_lastFraction;
141 }; 144 };
142 145
143 } // namespace blink 146 } // namespace blink
144 147
145 #endif // PrimitiveInterpolation_h 148 #endif // PrimitiveInterpolation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698