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

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolationType.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 InterpolationType_h 5 #ifndef InterpolationType_h
6 #define InterpolationType_h 6 #define InterpolationType_h
7 7
8 #include "core/animation/InterpolationValue.h" 8 #include "core/animation/InterpolationValue.h"
9 #include "core/animation/Keyframe.h" 9 #include "core/animation/Keyframe.h"
10 #include "core/animation/PairwiseInterpolationValue.h" 10 #include "core/animation/PairwiseInterpolationValue.h"
11 #include "core/animation/PrimitiveInterpolation.h" 11 #include "core/animation/PrimitiveInterpolation.h"
12 #include "core/animation/PropertyHandle.h" 12 #include "core/animation/PropertyHandle.h"
13 #include "core/animation/UnderlyingValueOwner.h" 13 #include "core/animation/UnderlyingValueOwner.h"
14 #include "platform/heap/Handle.h" 14 #include "platform/heap/Handle.h"
15 #include "wtf/Allocator.h" 15 #include "wtf/Allocator.h"
16 #include <memory> 16 #include <memory>
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class InterpolationEnvironment; 20 class InterpolationEnvironment;
21 21
22 // Subclasses of InterpolationType implement the logic for a specific value type of a specific PropertyHandle to: 22 // Subclasses of InterpolationType implement the logic for a specific value type
23 // - Convert PropertySpecificKeyframe values to (Pairwise)?InterpolationValues: maybeConvertPairwise() and maybeConvertSingle() 23 // of a specific PropertyHandle to:
24 // - Convert the target Element's property value to an InterpolationValue: maybe ConvertUnderlyingValue() 24 // - Convert PropertySpecificKeyframe values to (Pairwise)?InterpolationValues:
25 // maybeConvertPairwise() and maybeConvertSingle()
26 // - Convert the target Element's property value to an InterpolationValue:
27 // maybeConvertUnderlyingValue()
25 // - Apply an InterpolationValue to a target Element's property: apply(). 28 // - Apply an InterpolationValue to a target Element's property: apply().
26 class InterpolationType { 29 class InterpolationType {
27 USING_FAST_MALLOC(InterpolationType); 30 USING_FAST_MALLOC(InterpolationType);
28 WTF_MAKE_NONCOPYABLE(InterpolationType); 31 WTF_MAKE_NONCOPYABLE(InterpolationType);
29 32
30 public: 33 public:
31 virtual ~InterpolationType() { NOTREACHED(); } 34 virtual ~InterpolationType() { NOTREACHED(); }
32 35
33 PropertyHandle getProperty() const { return m_property; } 36 PropertyHandle getProperty() const { return m_property; }
34 37
35 // ConversionCheckers are returned from calls to maybeConvertPairwise() and ma ybeConvertSingle() to enable the caller to check 38 // ConversionCheckers are returned from calls to maybeConvertPairwise() and
36 // whether the result is still valid given changes in the InterpolationEnviron ment and underlying InterpolationValue. 39 // maybeConvertSingle() to enable the caller to check whether the result is
40 // still valid given changes in the InterpolationEnvironment and underlying
41 // InterpolationValue.
37 class ConversionChecker { 42 class ConversionChecker {
38 USING_FAST_MALLOC(ConversionChecker); 43 USING_FAST_MALLOC(ConversionChecker);
39 WTF_MAKE_NONCOPYABLE(ConversionChecker); 44 WTF_MAKE_NONCOPYABLE(ConversionChecker);
40 45
41 public: 46 public:
42 virtual ~ConversionChecker() {} 47 virtual ~ConversionChecker() {}
43 void setType(const InterpolationType& type) { m_type = &type; } 48 void setType(const InterpolationType& type) { m_type = &type; }
44 const InterpolationType& type() const { return *m_type; } 49 const InterpolationType& type() const { return *m_type; }
45 virtual bool isValid(const InterpolationEnvironment&, 50 virtual bool isValid(const InterpolationEnvironment&,
46 const InterpolationValue& underlying) const = 0; 51 const InterpolationValue& underlying) const = 0;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DCHECK(!underlyingValueOwner.value().nonInterpolableValue); 89 DCHECK(!underlyingValueOwner.value().nonInterpolableValue);
85 DCHECK(!value.nonInterpolableValue); 90 DCHECK(!value.nonInterpolableValue);
86 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd( 91 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(
87 underlyingFraction, *value.interpolableValue); 92 underlyingFraction, *value.interpolableValue);
88 } 93 }
89 94
90 virtual void apply(const InterpolableValue&, 95 virtual void apply(const InterpolableValue&,
91 const NonInterpolableValue*, 96 const NonInterpolableValue*,
92 InterpolationEnvironment&) const = 0; 97 InterpolationEnvironment&) const = 0;
93 98
94 // Implement reference equality checking via pointer equality checking as thes e are singletons. 99 // Implement reference equality checking via pointer equality checking as
100 // these are singletons.
95 bool operator==(const InterpolationType& other) const { 101 bool operator==(const InterpolationType& other) const {
96 return this == &other; 102 return this == &other;
97 } 103 }
98 bool operator!=(const InterpolationType& other) const { 104 bool operator!=(const InterpolationType& other) const {
99 return this != &other; 105 return this != &other;
100 } 106 }
101 107
102 protected: 108 protected:
103 InterpolationType(PropertyHandle property) : m_property(property) {} 109 InterpolationType(PropertyHandle property) : m_property(property) {}
104 110
105 virtual PairwiseInterpolationValue maybeMergeSingles( 111 virtual PairwiseInterpolationValue maybeMergeSingles(
106 InterpolationValue&& start, 112 InterpolationValue&& start,
107 InterpolationValue&& end) const { 113 InterpolationValue&& end) const {
108 DCHECK(!start.nonInterpolableValue); 114 DCHECK(!start.nonInterpolableValue);
109 DCHECK(!end.nonInterpolableValue); 115 DCHECK(!end.nonInterpolableValue);
110 return PairwiseInterpolationValue(std::move(start.interpolableValue), 116 return PairwiseInterpolationValue(std::move(start.interpolableValue),
111 std::move(end.interpolableValue), 117 std::move(end.interpolableValue),
112 nullptr); 118 nullptr);
113 } 119 }
114 120
115 const PropertyHandle m_property; 121 const PropertyHandle m_property;
116 }; 122 };
117 123
118 } // namespace blink 124 } // namespace blink
119 125
120 #endif // InterpolationType_h 126 #endif // InterpolationType_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698