| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PropertyRegistry_h | 5 #ifndef PropertyRegistry_h |
| 6 #define PropertyRegistry_h | 6 #define PropertyRegistry_h |
| 7 | 7 |
| 8 #include "core/animation/InterpolationType.h" | 8 #include "core/css/PropertyRegistration.h" |
| 9 #include "core/animation/InterpolationTypesMap.h" | |
| 10 #include "core/css/CSSSyntaxDescriptor.h" | |
| 11 #include "core/css/CSSValue.h" | |
| 12 #include "core/css/CSSVariableData.h" | |
| 13 #include "wtf/HashMap.h" | |
| 14 #include "wtf/RefPtr.h" | |
| 15 #include "wtf/text/AtomicString.h" | 9 #include "wtf/text/AtomicString.h" |
| 16 #include "wtf/text/AtomicStringHash.h" | 10 #include "wtf/text/AtomicStringHash.h" |
| 17 | 11 |
| 18 namespace blink { | 12 namespace blink { |
| 19 | 13 |
| 20 class PropertyRegistry : public GarbageCollected<PropertyRegistry> { | 14 class PropertyRegistry : public GarbageCollected<PropertyRegistry> { |
| 21 public: | 15 public: |
| 22 static PropertyRegistry* create() { return new PropertyRegistry(); } | 16 static PropertyRegistry* create() { return new PropertyRegistry(); } |
| 23 | 17 |
| 24 class Registration : public GarbageCollectedFinalized<Registration> { | |
| 25 public: | |
| 26 Registration(const CSSSyntaxDescriptor& syntax, | |
| 27 bool inherits, | |
| 28 const CSSValue* initial, | |
| 29 PassRefPtr<CSSVariableData> initialVariableData, | |
| 30 InterpolationTypes interpolationTypes) | |
| 31 : m_syntax(syntax), | |
| 32 m_inherits(inherits), | |
| 33 m_initial(initial), | |
| 34 m_initialVariableData(initialVariableData), | |
| 35 m_interpolationTypes(std::move(interpolationTypes)) {} | |
| 36 | |
| 37 const CSSSyntaxDescriptor& syntax() const { return m_syntax; } | |
| 38 bool inherits() const { return m_inherits; } | |
| 39 const CSSValue* initial() const { return m_initial; } | |
| 40 CSSVariableData* initialVariableData() const { | |
| 41 return m_initialVariableData.get(); | |
| 42 } | |
| 43 const InterpolationTypes& interpolationTypes() const { | |
| 44 return m_interpolationTypes; | |
| 45 } | |
| 46 | |
| 47 DEFINE_INLINE_TRACE() { visitor->trace(m_initial); } | |
| 48 | |
| 49 private: | |
| 50 const CSSSyntaxDescriptor m_syntax; | |
| 51 const bool m_inherits; | |
| 52 const Member<const CSSValue> m_initial; | |
| 53 const RefPtr<CSSVariableData> m_initialVariableData; | |
| 54 const InterpolationTypes m_interpolationTypes; | |
| 55 }; | |
| 56 | |
| 57 void registerProperty(const AtomicString&, | 18 void registerProperty(const AtomicString&, |
| 58 const CSSSyntaxDescriptor&, | 19 const CSSSyntaxDescriptor&, |
| 59 bool inherits, | 20 bool inherits, |
| 60 const CSSValue* initial, | 21 const CSSValue* initial, |
| 61 PassRefPtr<CSSVariableData> initialVariableData, | 22 PassRefPtr<CSSVariableData> initialVariableData, |
| 62 InterpolationTypes); | 23 InterpolationTypes); |
| 63 const Registration* registration(const AtomicString&) const; | 24 const PropertyRegistration* registration(const AtomicString&) const; |
| 64 size_t registrationCount() const { return m_registrations.size(); } | 25 size_t registrationCount() const { return m_registrations.size(); } |
| 65 | 26 |
| 66 DEFINE_INLINE_TRACE() { visitor->trace(m_registrations); } | 27 DEFINE_INLINE_TRACE() { visitor->trace(m_registrations); } |
| 67 | 28 |
| 68 private: | 29 private: |
| 69 HeapHashMap<AtomicString, Member<Registration>> m_registrations; | 30 HeapHashMap<AtomicString, Member<PropertyRegistration>> m_registrations; |
| 70 }; | 31 }; |
| 71 | 32 |
| 72 } // namespace blink | 33 } // namespace blink |
| 73 | 34 |
| 74 #endif // PropertyRegistry_h | 35 #endif // PropertyRegistry_h |
| OLD | NEW |