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 CSSTransitionData_h | 5 #ifndef CSSTransitionData_h |
6 #define CSSTransitionData_h | 6 #define CSSTransitionData_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/animation/css/CSSTimingData.h" | 9 #include "core/animation/css/CSSTimingData.h" |
10 #include "wtf/Vector.h" | 10 #include "wtf/Vector.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CSSTransitionData final : public CSSTimingData { | 14 class CSSTransitionData final : public CSSTimingData { |
15 public: | 15 public: |
16 enum TransitionPropertyType { | 16 enum TransitionPropertyType { |
17 TransitionNone, | 17 TransitionNone, |
alancutter (OOO until 2018)
2015/08/26 02:57:17
Unrelated to this patch but I'm not sure why we re
Timothy Loh
2015/08/26 03:36:37
Probably to make it consistent with the other tran
| |
18 TransitionSingleProperty, | 18 TransitionKnownProperty, |
19 TransitionUnknown, | 19 TransitionUnknownProperty, |
20 TransitionAll | |
21 }; | 20 }; |
22 | 21 |
23 // FIXME: We shouldn't allow 'none' to be used alongside other properties. | 22 // FIXME: We shouldn't allow 'none' to be used alongside other properties. |
24 struct TransitionProperty { | 23 struct TransitionProperty { |
25 ALLOW_ONLY_INLINE_ALLOCATION(); | 24 ALLOW_ONLY_INLINE_ALLOCATION(); |
26 TransitionProperty(CSSPropertyID id) | 25 TransitionProperty(CSSPropertyID id) |
27 : propertyType(TransitionSingleProperty) | 26 : propertyType(TransitionKnownProperty) |
28 , unresolvedProperty(id) | 27 , unresolvedProperty(id) |
29 { | 28 { |
30 ASSERT(id != CSSPropertyInvalid); | 29 ASSERT(id != CSSPropertyInvalid); |
31 } | 30 } |
32 | 31 |
33 TransitionProperty(const String& string) | 32 TransitionProperty(const String& string) |
34 : propertyType(TransitionUnknown) | 33 : propertyType(TransitionUnknownProperty) |
35 , unresolvedProperty(CSSPropertyInvalid) | 34 , unresolvedProperty(CSSPropertyInvalid) |
36 , propertyString(string) | 35 , propertyString(string) |
37 { | 36 { |
38 } | 37 } |
39 | 38 |
40 TransitionProperty(TransitionPropertyType type) | 39 TransitionProperty(TransitionPropertyType type) |
41 : propertyType(type) | 40 : propertyType(type) |
42 , unresolvedProperty(CSSPropertyInvalid) | 41 , unresolvedProperty(CSSPropertyInvalid) |
43 { | 42 { |
44 ASSERT(type == TransitionNone || type == TransitionAll); | 43 ASSERT(type == TransitionNone); |
45 } | 44 } |
46 | 45 |
47 bool operator==(const TransitionProperty& other) const { return property Type == other.propertyType && unresolvedProperty == other.unresolvedProperty && propertyString == other.propertyString; } | 46 bool operator==(const TransitionProperty& other) const { return property Type == other.propertyType && unresolvedProperty == other.unresolvedProperty && propertyString == other.propertyString; } |
48 | 47 |
49 TransitionPropertyType propertyType; | 48 TransitionPropertyType propertyType; |
50 CSSPropertyID unresolvedProperty; | 49 CSSPropertyID unresolvedProperty; |
51 String propertyString; | 50 String propertyString; |
52 }; | 51 }; |
53 | 52 |
54 static PassOwnPtr<CSSTransitionData> create() | 53 static PassOwnPtr<CSSTransitionData> create() |
55 { | 54 { |
56 return adoptPtr(new CSSTransitionData); | 55 return adoptPtr(new CSSTransitionData); |
57 } | 56 } |
58 | 57 |
59 static PassOwnPtr<CSSTransitionData> create(const CSSTransitionData& transit ionData) | 58 static PassOwnPtr<CSSTransitionData> create(const CSSTransitionData& transit ionData) |
60 { | 59 { |
61 return adoptPtr(new CSSTransitionData(transitionData)); | 60 return adoptPtr(new CSSTransitionData(transitionData)); |
62 } | 61 } |
63 | 62 |
64 bool transitionsMatchForStyleRecalc(const CSSTransitionData& other) const; | 63 bool transitionsMatchForStyleRecalc(const CSSTransitionData& other) const; |
65 | 64 |
66 Timing convertToTiming(size_t index) const; | 65 Timing convertToTiming(size_t index) const; |
67 | 66 |
68 const Vector<TransitionProperty>& propertyList() const { return m_propertyLi st; } | 67 const Vector<TransitionProperty>& propertyList() const { return m_propertyLi st; } |
69 Vector<TransitionProperty>& propertyList() { return m_propertyList; } | 68 Vector<TransitionProperty>& propertyList() { return m_propertyList; } |
70 | 69 |
71 static TransitionProperty initialProperty() { return TransitionProperty(Tran sitionAll); } | 70 static TransitionProperty initialProperty() { return TransitionProperty(CSSP ropertyAll); } |
72 | 71 |
73 private: | 72 private: |
74 CSSTransitionData(); | 73 CSSTransitionData(); |
75 explicit CSSTransitionData(const CSSTransitionData&); | 74 explicit CSSTransitionData(const CSSTransitionData&); |
76 | 75 |
77 Vector<TransitionProperty> m_propertyList; | 76 Vector<TransitionProperty> m_propertyList; |
78 }; | 77 }; |
79 | 78 |
80 } // namespace blink | 79 } // namespace blink |
81 | 80 |
82 #endif // CSSTransitionData_h | 81 #endif // CSSTransitionData_h |
OLD | NEW |