Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: third_party/WebKit/Source/core/style/StyleVariableData.cpp

Issue 2366313006: CSS Properties and Values API: Support non-inherited custom properties (Closed)
Patch Set: use de morgan's law Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleVariableData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/StyleVariableData.cpp
diff --git a/third_party/WebKit/Source/core/style/StyleVariableData.cpp b/third_party/WebKit/Source/core/style/StyleVariableData.cpp
deleted file mode 100644
index 1a8128fc14a1cb8dc96bcce01da8fa503801b72c..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/style/StyleVariableData.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/style/StyleVariableData.h"
-
-#include "core/style/DataEquivalency.h"
-
-namespace blink {
-
-bool StyleVariableData::operator==(const StyleVariableData& other) const
-{
- // It's technically possible for divergent roots to be value-equal,
- // but unlikely. This equality operator is used for optimization purposes
- // so it's OK to be occasionally wrong.
- // TODO(shanestephens): Rename this to something that indicates it may not
- // always return equality.
- if (m_root != other.m_root)
- return false;
-
- if (m_data.size() != other.m_data.size())
- return false;
-
- for (const auto& iter : m_data) {
- RefPtr<CSSVariableData> otherData = other.m_data.get(iter.key);
- if (!dataEquivalent(iter.value, otherData))
- return false;
- }
-
- return true;
-}
-
-StyleVariableData::StyleVariableData(StyleVariableData& other)
-{
- if (!other.m_root) {
- m_root = &other;
- } else {
- m_data = other.m_data;
- m_registeredData = other.m_registeredData;
- m_root = other.m_root;
- }
-}
-
-CSSVariableData* StyleVariableData::getVariable(const AtomicString& name) const
-{
- auto result = m_data.find(name);
- if (result == m_data.end() && m_root)
- return m_root->getVariable(name);
- if (result == m_data.end())
- return nullptr;
- return result->value.get();
-}
-
-void StyleVariableData::setRegisteredInheritedProperty(const AtomicString& name, const CSSValue* parsedValue)
-{
- m_registeredData.set(name, const_cast<CSSValue*>(parsedValue));
-}
-
-void StyleVariableData::removeVariable(const AtomicString& name)
-{
- m_data.set(name, nullptr);
- auto iterator = m_registeredData.find(name);
- if (iterator != m_registeredData.end())
- iterator->value = nullptr;
-}
-
-std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> StyleVariableData::getVariables() const
-{
- std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> result;
- if (m_root) {
- result.reset(new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_root->m_data));
- for (auto it = m_data.begin(); it != m_data.end(); ++it)
- result->set(it->key, it->value);
- } else {
- result.reset(new HashMap<AtomicString, RefPtr<CSSVariableData>>(m_data));
- }
- return result;
-}
-
-} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleVariableData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698