OLD | NEW |
1 #ifndef StyleVariableData_h | 1 #ifndef StyleVariableData_h |
2 #define StyleVariableData_h | 2 #define StyleVariableData_h |
3 | 3 |
4 #include "core/css/CSSVariableData.h" | 4 #include "core/css/CSSVariableData.h" |
5 #include "wtf/Forward.h" | 5 #include "wtf/Forward.h" |
6 #include "wtf/HashMap.h" | 6 #include "wtf/HashMap.h" |
7 #include "wtf/RefCounted.h" | 7 #include "wtf/RefCounted.h" |
8 #include "wtf/text/AtomicStringHash.h" | 8 #include "wtf/text/AtomicStringHash.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class StyleVariableData : public RefCounted<StyleVariableData> { | 12 class StyleVariableData : public RefCounted<StyleVariableData> { |
13 public: | 13 public: |
14 static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVar
iableData()); } | 14 static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVar
iableData()); } |
15 PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariab
leData(*this)); } | 15 PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariab
leData(*this)); } |
16 | 16 |
17 bool operator==(const StyleVariableData& other) const { return other.m_data
== m_data; } | 17 bool operator==(const StyleVariableData& other) const { return other.m_data
== m_data; } |
18 bool operator!=(const StyleVariableData& other) const { return !(*this == ot
her); } | 18 bool operator!=(const StyleVariableData& other) const { return !(*this == ot
her); } |
19 | 19 |
20 void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value
) { m_data.set(name, value); } | 20 void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value
) { m_data.set(name, value); } |
21 CSSVariableData* getVariable(const AtomicString& name) const { return m_data
.get(name); } | 21 CSSVariableData* getVariable(const AtomicString& name) const { return m_data
.get(name); } |
22 void removeVariable(const AtomicString& name) { return m_data.remove(name);
} | 22 void removeVariable(const AtomicString& name) { return m_data.remove(name);
} |
| 23 |
| 24 const HashMap<AtomicString, RefPtr<CSSVariableData>>* getVariables() const {
return &m_data; } |
23 private: | 25 private: |
24 StyleVariableData() = default; | 26 StyleVariableData() = default; |
25 StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariable
Data>(), m_data(other.m_data) { } | 27 StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariable
Data>(), m_data(other.m_data) { } |
26 | 28 |
27 friend class CSSVariableResolver; | 29 friend class CSSVariableResolver; |
28 | 30 |
29 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; | 31 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; |
30 }; | 32 }; |
31 | 33 |
32 } // namespace blink | 34 } // namespace blink |
33 | 35 |
34 #endif // StyleVariableData_h | 36 #endif // StyleVariableData_h |
OLD | NEW |