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