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 #include "core/style/StyleInheritedVariables.h" | 5 #include "core/style/StyleInheritedVariables.h" |
6 | 6 |
7 #include "core/style/DataEquivalency.h" | 7 #include "core/style/DataEquivalency.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return nullptr; | 50 return nullptr; |
51 return result->value.get(); | 51 return result->value.get(); |
52 } | 52 } |
53 | 53 |
54 void StyleInheritedVariables::setRegisteredVariable( | 54 void StyleInheritedVariables::setRegisteredVariable( |
55 const AtomicString& name, | 55 const AtomicString& name, |
56 const CSSValue* parsedValue) { | 56 const CSSValue* parsedValue) { |
57 m_registeredData.set(name, const_cast<CSSValue*>(parsedValue)); | 57 m_registeredData.set(name, const_cast<CSSValue*>(parsedValue)); |
58 } | 58 } |
59 | 59 |
60 CSSValue* StyleInheritedVariables::registeredVariable( | 60 const CSSValue* StyleInheritedVariables::registeredVariable( |
61 const AtomicString& name) const { | 61 const AtomicString& name) const { |
62 auto result = m_registeredData.find(name); | 62 auto result = m_registeredData.find(name); |
63 if (result != m_registeredData.end()) | 63 if (result != m_registeredData.end()) |
64 return result->value.get(); | 64 return result->value.get(); |
65 if (m_root) | 65 if (m_root) |
66 return m_root->registeredVariable(name); | 66 return m_root->registeredVariable(name); |
67 return nullptr; | 67 return nullptr; |
68 } | 68 } |
69 | 69 |
70 void StyleInheritedVariables::removeVariable(const AtomicString& name) { | 70 void StyleInheritedVariables::removeVariable(const AtomicString& name) { |
(...skipping 11 matching lines...) Expand all Loading... |
82 new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_root->m_data)); | 82 new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_root->m_data)); |
83 for (auto it = m_data.begin(); it != m_data.end(); ++it) | 83 for (auto it = m_data.begin(); it != m_data.end(); ++it) |
84 result->set(it->key, it->value); | 84 result->set(it->key, it->value); |
85 } else { | 85 } else { |
86 result.reset(new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_data)); | 86 result.reset(new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_data)); |
87 } | 87 } |
88 return result; | 88 return result; |
89 } | 89 } |
90 | 90 |
91 } // namespace blink | 91 } // namespace blink |
OLD | NEW |