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

Unified Diff: third_party/WebKit/Source/core/style/StyleNonInheritedVariables.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
Index: third_party/WebKit/Source/core/style/StyleNonInheritedVariables.cpp
diff --git a/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.cpp b/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..23a3cdcdbc5a6175961ac8f6ca7095f9d28ea0ad
--- /dev/null
+++ b/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.cpp
@@ -0,0 +1,47 @@
+// Copyright 2016 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/StyleNonInheritedVariables.h"
+
+#include "core/style/DataEquivalency.h"
+
+namespace blink {
+
+bool StyleNonInheritedVariables::operator==(const StyleNonInheritedVariables& other) const
+{
+ 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;
+}
+
+CSSVariableData* StyleNonInheritedVariables::getVariable(const AtomicString& name) const
+{
+ return m_data.get(name);
+}
+
+void StyleNonInheritedVariables::setRegisteredVariable(const AtomicString& name, const CSSValue* parsedValue)
+{
+ m_registeredData.set(name, const_cast<CSSValue*>(parsedValue));
+}
+
+void StyleNonInheritedVariables::removeVariable(const AtomicString& name)
+{
+ m_data.set(name, nullptr);
+ m_registeredData.set(name, nullptr);
+}
+
+StyleNonInheritedVariables::StyleNonInheritedVariables(StyleNonInheritedVariables& other)
+{
+ m_data = other.m_data;
+ m_registeredData = other.m_registeredData;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698