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