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

Unified Diff: third_party/WebKit/Source/core/style/StyleInheritedVariables.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/StyleInheritedVariables.cpp
diff --git a/third_party/WebKit/Source/core/style/StyleVariableData.cpp b/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp
similarity index 70%
rename from third_party/WebKit/Source/core/style/StyleVariableData.cpp
rename to third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp
index 1a8128fc14a1cb8dc96bcce01da8fa503801b72c..f1f9a874e0dd55560749675b913ac401e4f4c298 100644
--- a/third_party/WebKit/Source/core/style/StyleVariableData.cpp
+++ b/third_party/WebKit/Source/core/style/StyleInheritedVariables.cpp
@@ -2,13 +2,13 @@
// 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/StyleInheritedVariables.h"
#include "core/style/DataEquivalency.h"
namespace blink {
-bool StyleVariableData::operator==(const StyleVariableData& other) const
+bool StyleInheritedVariables::operator==(const StyleInheritedVariables& other) const
{
// It's technically possible for divergent roots to be value-equal,
// but unlikely. This equality operator is used for optimization purposes
@@ -30,7 +30,7 @@ bool StyleVariableData::operator==(const StyleVariableData& other) const
return true;
}
-StyleVariableData::StyleVariableData(StyleVariableData& other)
+StyleInheritedVariables::StyleInheritedVariables(StyleInheritedVariables& other)
{
if (!other.m_root) {
m_root = &other;
@@ -41,7 +41,7 @@ StyleVariableData::StyleVariableData(StyleVariableData& other)
}
}
-CSSVariableData* StyleVariableData::getVariable(const AtomicString& name) const
+CSSVariableData* StyleInheritedVariables::getVariable(const AtomicString& name) const
{
auto result = m_data.find(name);
if (result == m_data.end() && m_root)
@@ -51,12 +51,22 @@ CSSVariableData* StyleVariableData::getVariable(const AtomicString& name) const
return result->value.get();
}
-void StyleVariableData::setRegisteredInheritedProperty(const AtomicString& name, const CSSValue* parsedValue)
+void StyleInheritedVariables::setRegisteredVariable(const AtomicString& name, const CSSValue* parsedValue)
{
m_registeredData.set(name, const_cast<CSSValue*>(parsedValue));
}
-void StyleVariableData::removeVariable(const AtomicString& name)
+CSSValue* StyleInheritedVariables::registeredVariable(const AtomicString& name) const
+{
+ auto result = m_registeredData.find(name);
+ if (result != m_registeredData.end())
+ return result->value.get();
+ if (m_root)
+ return m_root->registeredVariable(name);
+ return nullptr;
+}
+
+void StyleInheritedVariables::removeVariable(const AtomicString& name)
{
m_data.set(name, nullptr);
auto iterator = m_registeredData.find(name);
@@ -64,7 +74,7 @@ void StyleVariableData::removeVariable(const AtomicString& name)
iterator->value = nullptr;
}
-std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> StyleVariableData::getVariables() const
+std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> StyleInheritedVariables::getVariables() const
{
std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> result;
if (m_root) {

Powered by Google App Engine
This is Rietveld 408576698