| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_ENGINE_CORE_ANIMATION_CSS_CSSTRANSITIONDATA_H_ | |
| 6 #define SKY_ENGINE_CORE_ANIMATION_CSS_CSSTRANSITIONDATA_H_ | |
| 7 | |
| 8 #include "gen/sky/core/CSSPropertyNames.h" | |
| 9 #include "sky/engine/core/animation/css/CSSTimingData.h" | |
| 10 #include "sky/engine/wtf/Vector.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class CSSTransitionData final : public CSSTimingData { | |
| 15 public: | |
| 16 enum TransitionPropertyType { | |
| 17 TransitionNone, | |
| 18 TransitionSingleProperty, | |
| 19 TransitionUnknown, | |
| 20 TransitionAll | |
| 21 }; | |
| 22 | |
| 23 // FIXME: We shouldn't allow 'none' to be used alongside other properties. | |
| 24 struct TransitionProperty { | |
| 25 TransitionProperty(CSSPropertyID id) | |
| 26 : propertyType(TransitionSingleProperty) | |
| 27 , propertyId(id) | |
| 28 { | |
| 29 ASSERT(id != CSSPropertyInvalid); | |
| 30 } | |
| 31 | |
| 32 TransitionProperty(const String& string) | |
| 33 : propertyType(TransitionUnknown) | |
| 34 , propertyId(CSSPropertyInvalid) | |
| 35 , propertyString(string) | |
| 36 { | |
| 37 } | |
| 38 | |
| 39 TransitionProperty(TransitionPropertyType type) | |
| 40 : propertyType(type) | |
| 41 , propertyId(CSSPropertyInvalid) | |
| 42 { | |
| 43 ASSERT(type == TransitionNone || type == TransitionAll); | |
| 44 } | |
| 45 | |
| 46 bool operator==(const TransitionProperty& other) const { return property
Type == other.propertyType && propertyId == other.propertyId && propertyString =
= other.propertyString; } | |
| 47 | |
| 48 TransitionPropertyType propertyType; | |
| 49 CSSPropertyID propertyId; | |
| 50 String propertyString; | |
| 51 }; | |
| 52 | |
| 53 static PassOwnPtr<CSSTransitionData> create() | |
| 54 { | |
| 55 return adoptPtr(new CSSTransitionData); | |
| 56 } | |
| 57 | |
| 58 static PassOwnPtr<CSSTransitionData> create(const CSSTransitionData& transit
ionData) | |
| 59 { | |
| 60 return adoptPtr(new CSSTransitionData(transitionData)); | |
| 61 } | |
| 62 | |
| 63 bool transitionsMatchForStyleRecalc(const CSSTransitionData& other) const; | |
| 64 | |
| 65 Timing convertToTiming(size_t index) const; | |
| 66 | |
| 67 const Vector<TransitionProperty>& propertyList() const { return m_propertyLi
st; } | |
| 68 Vector<TransitionProperty>& propertyList() { return m_propertyList; } | |
| 69 | |
| 70 static TransitionProperty initialProperty() { return TransitionProperty(Tran
sitionAll); } | |
| 71 | |
| 72 private: | |
| 73 CSSTransitionData(); | |
| 74 explicit CSSTransitionData(const CSSTransitionData&); | |
| 75 | |
| 76 Vector<TransitionProperty> m_propertyList; | |
| 77 }; | |
| 78 | |
| 79 } // namespace blink | |
| 80 | |
| 81 #endif // SKY_ENGINE_CORE_ANIMATION_CSS_CSSTRANSITIONDATA_H_ | |
| OLD | NEW |