| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef StyleInheritedVariables_h | 5 #ifndef StyleInheritedVariables_h |
| 6 #define StyleInheritedVariables_h | 6 #define StyleInheritedVariables_h |
| 7 | 7 |
| 8 #include "core/css/CSSValue.h" | 8 #include "core/css/CSSValue.h" |
| 9 #include "core/css/CSSVariableData.h" | 9 #include "core/css/CSSVariableData.h" |
| 10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 void setVariable(const AtomicString& name, | 32 void setVariable(const AtomicString& name, |
| 33 PassRefPtr<CSSVariableData> value) { | 33 PassRefPtr<CSSVariableData> value) { |
| 34 m_data.set(name, std::move(value)); | 34 m_data.set(name, std::move(value)); |
| 35 } | 35 } |
| 36 CSSVariableData* getVariable(const AtomicString& name) const; | 36 CSSVariableData* getVariable(const AtomicString& name) const; |
| 37 void removeVariable(const AtomicString&); | 37 void removeVariable(const AtomicString&); |
| 38 | 38 |
| 39 void setRegisteredVariable(const AtomicString&, const CSSValue*); | 39 void setRegisteredVariable(const AtomicString&, const CSSValue*); |
| 40 CSSValue* registeredVariable(const AtomicString&) const; | 40 const CSSValue* registeredVariable(const AtomicString&) const; |
| 41 | 41 |
| 42 // This map will contain null pointers if variables are invalid due to | 42 // This map will contain null pointers if variables are invalid due to |
| 43 // cycles or referencing invalid variables without using a fallback. | 43 // cycles or referencing invalid variables without using a fallback. |
| 44 // Note that this method is slow as a new map is constructed. | 44 // Note that this method is slow as a new map is constructed. |
| 45 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> getVariables() | 45 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> getVariables() |
| 46 const; | 46 const; |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 StyleInheritedVariables() : m_root(nullptr) {} | 49 StyleInheritedVariables() : m_root(nullptr) {} |
| 50 StyleInheritedVariables(StyleInheritedVariables& other); | 50 StyleInheritedVariables(StyleInheritedVariables& other); |
| 51 | 51 |
| 52 friend class CSSVariableResolver; | 52 friend class CSSVariableResolver; |
| 53 | 53 |
| 54 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; | 54 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; |
| 55 HashMap<AtomicString, Persistent<CSSValue>> m_registeredData; | 55 HashMap<AtomicString, Persistent<CSSValue>> m_registeredData; |
| 56 RefPtr<StyleInheritedVariables> m_root; | 56 RefPtr<StyleInheritedVariables> m_root; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif // StyleInheritedVariables_h | 61 #endif // StyleInheritedVariables_h |
| OLD | NEW |