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 NonInterpolableValue_h | 5 #ifndef NonInterpolableValue_h |
6 #define NonInterpolableValue_h | 6 #define NonInterpolableValue_h |
7 | 7 |
8 #include "wtf/RefCounted.h" | 8 #include "wtf/RefCounted.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 // Represents components of a PropertySpecificKeyframe's value that either do no
t change or 50% flip when interpolating with an adjacent value. | 12 // Represents components of a PropertySpecificKeyframe's value that either do |
| 13 // not change or 50% flip when interpolating with an adjacent value. |
13 class NonInterpolableValue : public RefCounted<NonInterpolableValue> { | 14 class NonInterpolableValue : public RefCounted<NonInterpolableValue> { |
14 public: | 15 public: |
15 virtual ~NonInterpolableValue() {} | 16 virtual ~NonInterpolableValue() {} |
16 | 17 |
17 typedef const void* Type; | 18 typedef const void* Type; |
18 virtual Type getType() const = 0; | 19 virtual Type getType() const = 0; |
19 }; | 20 }; |
20 | 21 |
21 // These macros provide safe downcasts of NonInterpolableValue subclasses with d
ebug assertions. | 22 // These macros provide safe downcasts of NonInterpolableValue subclasses with |
| 23 // debug assertions. |
22 // See CSSValueInterpolationType.cpp for example usage. | 24 // See CSSValueInterpolationType.cpp for example usage. |
23 #define DECLARE_NON_INTERPOLABLE_VALUE_TYPE() \ | 25 #define DECLARE_NON_INTERPOLABLE_VALUE_TYPE() \ |
24 static Type staticType; \ | 26 static Type staticType; \ |
25 Type getType() const final { return staticType; } | 27 Type getType() const final { return staticType; } |
26 | 28 |
27 #define DEFINE_NON_INTERPOLABLE_VALUE_TYPE(T) \ | 29 #define DEFINE_NON_INTERPOLABLE_VALUE_TYPE(T) \ |
28 NonInterpolableValue::Type T::staticType = &T::staticType; | 30 NonInterpolableValue::Type T::staticType = &T::staticType; |
29 | 31 |
30 #define DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(T) \ | 32 #define DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(T) \ |
31 inline bool is##T(const NonInterpolableValue* value) { \ | 33 inline bool is##T(const NonInterpolableValue* value) { \ |
32 return !value || value->getType() == T::staticType; \ | 34 return !value || value->getType() == T::staticType; \ |
33 } \ | 35 } \ |
34 DEFINE_TYPE_CASTS(T, NonInterpolableValue, value, is##T(value), \ | 36 DEFINE_TYPE_CASTS(T, NonInterpolableValue, value, is##T(value), \ |
35 is##T(&value)); | 37 is##T(&value)); |
36 | 38 |
37 } // namespace blink | 39 } // namespace blink |
38 | 40 |
39 #endif // NonInterpolableValue_h | 41 #endif // NonInterpolableValue_h |
OLD | NEW |