OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef StyleNonInheritedVariables_h |
| 6 #define StyleNonInheritedVariables_h |
| 7 |
| 8 #include "core/css/CSSValue.h" |
| 9 #include "core/css/CSSVariableData.h" |
| 10 #include "wtf/Forward.h" |
| 11 #include "wtf/HashMap.h" |
| 12 #include "wtf/text/AtomicStringHash.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class StyleNonInheritedVariables { |
| 17 public: |
| 18 static std::unique_ptr<StyleNonInheritedVariables> create() { return wrapUni
que(new StyleNonInheritedVariables); } |
| 19 |
| 20 std::unique_ptr<StyleNonInheritedVariables> copy() { return wrapUnique(new S
tyleNonInheritedVariables(*this)); } |
| 21 |
| 22 bool operator==(const StyleNonInheritedVariables& other) const; |
| 23 bool operator!=(const StyleNonInheritedVariables& other) const { return !(*t
his == other); } |
| 24 |
| 25 void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value
) { m_data.set(name, value); } |
| 26 CSSVariableData* getVariable(const AtomicString& name) const; |
| 27 void removeVariable(const AtomicString&); |
| 28 |
| 29 void setRegisteredVariable(const AtomicString&, const CSSValue*); |
| 30 CSSValue* registeredVariable(const AtomicString& name) const { return m_regi
steredData.get(name); } |
| 31 |
| 32 private: |
| 33 StyleNonInheritedVariables() = default; |
| 34 StyleNonInheritedVariables(StyleNonInheritedVariables&); |
| 35 |
| 36 friend class CSSVariableResolver; |
| 37 |
| 38 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; |
| 39 HashMap<AtomicString, Persistent<CSSValue>> m_registeredData; |
| 40 }; |
| 41 |
| 42 } // namespace blink |
| 43 |
| 44 #endif // StyleNonInheritedVariables_h |
OLD | NEW |