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/css/CSSSyntaxDescriptor.h" | 8 #include "core/css/CSSSyntaxDescriptor.h" |
9 #include "core/css/CSSValue.h" | 9 #include "core/css/CSSValue.h" |
10 #include "core/css/CSSVariableData.h" | 10 #include "core/css/CSSVariableData.h" |
11 #include "wtf/HashMap.h" | 11 #include "wtf/HashMap.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 #include "wtf/text/AtomicString.h" | 13 #include "wtf/text/AtomicString.h" |
14 #include "wtf/text/AtomicStringHash.h" | 14 #include "wtf/text/AtomicStringHash.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class PropertyRegistry : public GarbageCollected<PropertyRegistry> { | 18 class PropertyRegistry : public GarbageCollected<PropertyRegistry> { |
19 public: | 19 public: |
20 static PropertyRegistry* create() | 20 static PropertyRegistry* create() |
21 { | 21 { |
22 return new PropertyRegistry(); | 22 return new PropertyRegistry(); |
23 } | 23 } |
24 | 24 |
25 class Registration : public GarbageCollectedFinalized<Registration> { | 25 class Registration : public GarbageCollectedFinalized<Registration> { |
26 public: | 26 public: |
27 Registration(const CSSSyntaxDescriptor& syntax, bool inherits, const CSS
Value* initial) | 27 Registration(const CSSSyntaxDescriptor& syntax, bool inherits, const CSS
Value* initial, PassRefPtr<CSSVariableData> initialVariableData) |
28 : m_syntax(syntax), m_inherits(inherits), m_initial(initial) { } | 28 : m_syntax(syntax) |
| 29 , m_inherits(inherits) |
| 30 , m_initial(initial) |
| 31 , m_initialVariableData(initialVariableData) |
| 32 { } |
29 | 33 |
30 const CSSSyntaxDescriptor& syntax() const { return m_syntax; } | 34 const CSSSyntaxDescriptor& syntax() const { return m_syntax; } |
31 bool inherits() const { return m_inherits; } | 35 bool inherits() const { return m_inherits; } |
32 const CSSValue* initial() const { return m_initial; } | 36 const CSSValue* initial() const { return m_initial; } |
| 37 CSSVariableData* initialVariableData() const { return m_initialVariableD
ata.get(); } |
33 | 38 |
34 DEFINE_INLINE_TRACE() { visitor->trace(m_initial); } | 39 DEFINE_INLINE_TRACE() { visitor->trace(m_initial); } |
35 | 40 |
36 private: | 41 private: |
37 const CSSSyntaxDescriptor m_syntax; | 42 const CSSSyntaxDescriptor m_syntax; |
38 const bool m_inherits; | 43 const bool m_inherits; |
39 const Member<const CSSValue> m_initial; | 44 const Member<const CSSValue> m_initial; |
| 45 const RefPtr<CSSVariableData> m_initialVariableData; |
40 }; | 46 }; |
41 | 47 |
42 void registerProperty(const AtomicString&, const CSSSyntaxDescriptor&, bool
inherits, const CSSValue* initial); | 48 void registerProperty(const AtomicString&, const CSSSyntaxDescriptor&, bool
inherits, const CSSValue* initial, PassRefPtr<CSSVariableData> initialVariableDa
ta); |
43 void unregisterProperty(const AtomicString&); | 49 void unregisterProperty(const AtomicString&); |
44 const Registration* registration(const AtomicString&) const; | 50 const Registration* registration(const AtomicString&) const; |
45 | 51 |
46 DEFINE_INLINE_TRACE() { visitor->trace(m_registrations); } | 52 DEFINE_INLINE_TRACE() { visitor->trace(m_registrations); } |
47 | 53 |
48 private: | 54 private: |
49 HeapHashMap<AtomicString, Member<Registration>> m_registrations; | 55 HeapHashMap<AtomicString, Member<Registration>> m_registrations; |
50 }; | 56 }; |
51 | 57 |
52 } // namespace blink | 58 } // namespace blink |
53 | 59 |
54 #endif // PropertyRegistry_h | 60 #endif // PropertyRegistry_h |
OLD | NEW |