OLD | NEW |
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 AnimatableDoubleAndBool_h | 5 #ifndef AnimatableDoubleAndBool_h |
6 #define AnimatableDoubleAndBool_h | 6 #define AnimatableDoubleAndBool_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/animatable/AnimatableValue.h" | 9 #include "core/animation/animatable/AnimatableValue.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT AnimatableDoubleAndBool final : public AnimatableValue { | 13 class AnimatableDoubleAndBool final : public AnimatableValue { |
14 public: | 14 public: |
15 ~AnimatableDoubleAndBool() override {} | 15 ~AnimatableDoubleAndBool() override {} |
16 static PassRefPtr<AnimatableDoubleAndBool> create(double number, bool flag) { | 16 static PassRefPtr<AnimatableDoubleAndBool> create(double number, bool flag) { |
17 return adoptRef(new AnimatableDoubleAndBool(number, flag)); | 17 return adoptRef(new AnimatableDoubleAndBool(number, flag)); |
18 } | 18 } |
19 | 19 |
20 double toDouble() const { return m_number; } | |
21 bool flag() const { return m_flag; } | |
22 | |
23 protected: | |
24 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, | |
25 double fraction) const override; | |
26 bool usesDefaultInterpolationWith(const AnimatableValue*) const override; | |
27 | |
28 private: | 20 private: |
29 AnimatableDoubleAndBool(double number, bool flag) | 21 AnimatableDoubleAndBool(double number, bool flag) |
30 : m_number(number), m_flag(flag) {} | 22 : m_number(number), m_flag(flag) {} |
31 AnimatableType type() const override { return TypeDoubleAndBool; } | 23 AnimatableType type() const override { return TypeDoubleAndBool; } |
32 bool equalTo(const AnimatableValue*) const override; | 24 bool equalTo(const AnimatableValue*) const override; |
33 | 25 |
34 double m_number; | 26 double m_number; |
35 bool m_flag; | 27 bool m_flag; |
36 }; | 28 }; |
37 | 29 |
38 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableDoubleAndBool, isDoubleAndBool()); | 30 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableDoubleAndBool, isDoubleAndBool()); |
39 | 31 |
40 } // namespace blink | 32 } // namespace blink |
41 | 33 |
42 #endif // AnimatableDoubleAndBool_h | 34 #endif // AnimatableDoubleAndBool_h |
OLD | NEW |