| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/StyleNonInheritedVariables.h" | 5 #include "core/style/StyleNonInheritedVariables.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 |
| 11 bool StyleNonInheritedVariables::operator==( | 11 bool StyleNonInheritedVariables::operator==( |
| 12 const StyleNonInheritedVariables& other) const { | 12 const StyleNonInheritedVariables& other) const { |
| 13 if (m_data.size() != other.m_data.size()) | 13 if (m_data.size() != other.m_data.size()) |
| 14 return false; | 14 return false; |
| 15 | 15 |
| 16 for (const auto& iter : m_data) { | 16 for (const auto& iter : m_data) { |
| 17 RefPtr<CSSVariableData> otherData = other.m_data.get(iter.key); | 17 RefPtr<CSSVariableData> otherData = other.m_data.at(iter.key); |
| 18 if (!dataEquivalent(iter.value, otherData)) | 18 if (!dataEquivalent(iter.value, otherData)) |
| 19 return false; | 19 return false; |
| 20 } | 20 } |
| 21 | 21 |
| 22 return true; | 22 return true; |
| 23 } | 23 } |
| 24 | 24 |
| 25 CSSVariableData* StyleNonInheritedVariables::getVariable( | 25 CSSVariableData* StyleNonInheritedVariables::getVariable( |
| 26 const AtomicString& name) const { | 26 const AtomicString& name) const { |
| 27 return m_data.get(name); | 27 return m_data.at(name); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void StyleNonInheritedVariables::setRegisteredVariable( | 30 void StyleNonInheritedVariables::setRegisteredVariable( |
| 31 const AtomicString& name, | 31 const AtomicString& name, |
| 32 const CSSValue* parsedValue) { | 32 const CSSValue* parsedValue) { |
| 33 m_registeredData.set(name, const_cast<CSSValue*>(parsedValue)); | 33 m_registeredData.set(name, const_cast<CSSValue*>(parsedValue)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void StyleNonInheritedVariables::removeVariable(const AtomicString& name) { | 36 void StyleNonInheritedVariables::removeVariable(const AtomicString& name) { |
| 37 m_data.set(name, nullptr); | 37 m_data.set(name, nullptr); |
| 38 m_registeredData.set(name, nullptr); | 38 m_registeredData.set(name, nullptr); |
| 39 } | 39 } |
| 40 | 40 |
| 41 StyleNonInheritedVariables::StyleNonInheritedVariables( | 41 StyleNonInheritedVariables::StyleNonInheritedVariables( |
| 42 StyleNonInheritedVariables& other) { | 42 StyleNonInheritedVariables& other) { |
| 43 m_data = other.m_data; | 43 m_data = other.m_data; |
| 44 m_registeredData = other.m_registeredData; | 44 m_registeredData = other.m_registeredData; |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace blink | 47 } // namespace blink |
| OLD | NEW |