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