OLD | NEW |
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 CSSLengthInterpolationType_h | 5 #ifndef CSSLengthInterpolationType_h |
6 #define CSSLengthInterpolationType_h | 6 #define CSSLengthInterpolationType_h |
7 | 7 |
8 #include "core/animation/CSSInterpolationType.h" | 8 #include "core/animation/CSSInterpolationType.h" |
9 #include "core/animation/LengthPropertyFunctions.h" | 9 #include "core/animation/LengthPropertyFunctions.h" |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class ComputedStyle; | 14 class ComputedStyle; |
15 class CSSToLengthConversionData; | 15 class CSSToLengthConversionData; |
16 | 16 |
17 class CSSLengthInterpolationType : public CSSInterpolationType { | 17 class CSSLengthInterpolationType : public CSSInterpolationType { |
18 public: | 18 public: |
19 CSSLengthInterpolationType(CSSPropertyID); | 19 CSSLengthInterpolationType(CSSPropertyID); |
20 | 20 |
21 InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironmen
t&) const final; | 21 InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironmen
t&) const final; |
22 void composite(UnderlyingValueOwner&, double underlyingFraction, const Inter
polationValue&, double interpolationFraction) const final; | 22 void composite(UnderlyingValueOwner&, double underlyingFraction, const Inter
polationValue&, double interpolationFraction) const final; |
23 void apply(const InterpolableValue&, const NonInterpolableValue*, Interpolat
ionEnvironment&) const final; | 23 void apply(const InterpolableValue&, const NonInterpolableValue*, Interpolat
ionEnvironment&) const final; |
24 | 24 |
25 static Length createLength(const InterpolableValue&, const NonInterpolableVa
lue*, const CSSToLengthConversionData&, ValueRange = ValueRangeAll); | |
26 static std::unique_ptr<InterpolableValue> createInterpolablePixels(double pi
xels); | |
27 static InterpolationValue createInterpolablePercent(double percent); | |
28 static InterpolationValue maybeConvertCSSValue(const CSSValue&); | |
29 static InterpolationValue maybeConvertLength(const Length&, float zoom); | |
30 static std::unique_ptr<InterpolableList> createNeutralInterpolableValue(); | |
31 static PairwiseInterpolationValue staticMergeSingleConversions(Interpolation
Value&& start, InterpolationValue&& end); | |
32 static bool nonInterpolableValuesAreCompatible(const NonInterpolableValue*,
const NonInterpolableValue*); | |
33 static void composite(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpo
lableValue>&, double underlyingFraction, const InterpolableValue&, const NonInte
rpolableValue*); | |
34 static void subtractFromOneHundredPercent(InterpolationValue& result); | |
35 | |
36 private: | 25 private: |
37 float effectiveZoom(const ComputedStyle&) const; | 26 float effectiveZoom(const ComputedStyle&) const; |
38 | 27 |
39 InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying,
ConversionCheckers&) const final; | 28 InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying,
ConversionCheckers&) const final; |
40 InterpolationValue maybeConvertInitial(const StyleResolverState&, Conversion
Checkers&) const final; | 29 InterpolationValue maybeConvertInitial(const StyleResolverState&, Conversion
Checkers&) const final; |
41 InterpolationValue maybeConvertInherit(const StyleResolverState&, Conversion
Checkers&) const final; | 30 InterpolationValue maybeConvertInherit(const StyleResolverState&, Conversion
Checkers&) const final; |
42 InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverSta
te&, ConversionCheckers&) const final; | 31 InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverSta
te&, ConversionCheckers&) const final; |
43 | 32 |
44 PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, Int
erpolationValue&& end) const final | 33 PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, Int
erpolationValue&& end) const final; |
45 { | |
46 return staticMergeSingleConversions(std::move(start), std::move(end)); | |
47 } | |
48 | 34 |
49 const ValueRange m_valueRange; | 35 const ValueRange m_valueRange; |
50 }; | 36 }; |
51 | 37 |
52 } // namespace blink | 38 } // namespace blink |
53 | 39 |
54 #endif // CSSLengthInterpolationType_h | 40 #endif // CSSLengthInterpolationType_h |
OLD | NEW |