| 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 "CSSPropertyNames.h" | 8 #include "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 WebCore { | 12 namespace WebCore { |
| 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, |
| 18 TransitionSingleProperty, | 18 TransitionSingleProperty, |
| 19 TransitionUnknown, |
| 19 TransitionAll | 20 TransitionAll |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 // FIXME: This is incorrect as per CSS3 Transitions, we should allow the | 23 // FIXME: We shouldn't allow 'none' to be used alongside other properties. |
| 23 // user to specify unknown properties and keep them in the list (crbug.com/3
04020). | |
| 24 // Also, we shouldn't allow 'none' to be used alongside other properties. | |
| 25 struct TransitionProperty { | 24 struct TransitionProperty { |
| 26 TransitionProperty(CSSPropertyID id) | 25 TransitionProperty(CSSPropertyID id) |
| 27 : propertyType(TransitionSingleProperty) | 26 : propertyType(TransitionSingleProperty) |
| 28 , propertyId(id) | 27 , propertyId(id) |
| 29 { | 28 { |
| 30 ASSERT(id != CSSPropertyInvalid); | 29 ASSERT(id != CSSPropertyInvalid); |
| 31 } | 30 } |
| 32 | 31 |
| 32 TransitionProperty(const String& string) |
| 33 : propertyType(TransitionUnknown) |
| 34 , propertyId(CSSPropertyInvalid) |
| 35 , propertyString(string) |
| 36 { |
| 37 } |
| 38 |
| 33 TransitionProperty(TransitionPropertyType type) | 39 TransitionProperty(TransitionPropertyType type) |
| 34 : propertyType(type) | 40 : propertyType(type) |
| 35 , propertyId(CSSPropertyInvalid) | 41 , propertyId(CSSPropertyInvalid) |
| 36 { | 42 { |
| 37 ASSERT(type != TransitionSingleProperty); | 43 ASSERT(type == TransitionNone || type == TransitionAll); |
| 38 } | 44 } |
| 39 | 45 |
| 40 bool operator==(const TransitionProperty& other) const { return property
Type == other.propertyType && propertyId == other.propertyId; } | 46 bool operator==(const TransitionProperty& other) const { return property
Type == other.propertyType && propertyId == other.propertyId && propertyString =
= other.propertyString; } |
| 41 | 47 |
| 42 TransitionPropertyType propertyType; | 48 TransitionPropertyType propertyType; |
| 43 CSSPropertyID propertyId; | 49 CSSPropertyID propertyId; |
| 50 String propertyString; |
| 44 }; | 51 }; |
| 45 | 52 |
| 46 static PassOwnPtrWillBeRawPtr<CSSTransitionData> create() | 53 static PassOwnPtrWillBeRawPtr<CSSTransitionData> create() |
| 47 { | 54 { |
| 48 return adoptPtrWillBeNoop(new CSSTransitionData); | 55 return adoptPtrWillBeNoop(new CSSTransitionData); |
| 49 } | 56 } |
| 50 | 57 |
| 51 static PassOwnPtrWillBeRawPtr<CSSTransitionData> create(const CSSTransitionD
ata& transitionData) | 58 static PassOwnPtrWillBeRawPtr<CSSTransitionData> create(const CSSTransitionD
ata& transitionData) |
| 52 { | 59 { |
| 53 return adoptPtrWillBeNoop(new CSSTransitionData(transitionData)); | 60 return adoptPtrWillBeNoop(new CSSTransitionData(transitionData)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 private: | 72 private: |
| 66 CSSTransitionData(); | 73 CSSTransitionData(); |
| 67 explicit CSSTransitionData(const CSSTransitionData&); | 74 explicit CSSTransitionData(const CSSTransitionData&); |
| 68 | 75 |
| 69 Vector<TransitionProperty> m_propertyList; | 76 Vector<TransitionProperty> m_propertyList; |
| 70 }; | 77 }; |
| 71 | 78 |
| 72 } // namespace WebCore | 79 } // namespace WebCore |
| 73 | 80 |
| 74 #endif // CSSTransitionData_h | 81 #endif // CSSTransitionData_h |
| OLD | NEW |