Chromium Code Reviews| 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 explicit StyleVariableData() : RefCounted<StyleVariableData>() { } | |
|
Timothy Loh
2015/10/15 03:43:48
Not sure if you need to define either of these con
leviw_travelin_and_unemployed
2015/10/20 21:56:53
It's actually necessary for the copy constructor.
Timothy Loh
2015/10/28 05:12:41
But we can write m_data(other.m_data), right?
| |
| 25 StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariable Data>(), m_data(HashMap<AtomicString, RefPtr<CSSVariableData>>(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 |