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

Unified Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.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/css/ComputedStyleCSSValueMapping.cpp
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index d95f1f656d63f77101dd2168c2af526c5b1cb519..020142094a14ef457fceb07ba76f1660e9b1b81a 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -63,7 +63,8 @@
#include "core/style/CursorData.h"
#include "core/style/QuotesData.h"
#include "core/style/ShadowList.h"
-#include "core/style/StyleVariableData.h"
+#include "core/style/StyleInheritedVariables.h"
+#include "core/style/StyleNonInheritedVariables.h"
#include "platform/LengthFunctions.h"
namespace blink {
@@ -1648,19 +1649,24 @@ static EBreak mapToColumnBreakValue(EBreak genericBreakValue)
const CSSValue* ComputedStyleCSSValueMapping::get(const AtomicString customPropertyName, const ComputedStyle& style, const PropertyRegistry* registry)
{
- StyleVariableData* variables = style.variables();
if (registry) {
const PropertyRegistry::Registration* registration = registry->registration(customPropertyName);
if (registration) {
- if (variables) {
- const CSSValue* result = variables->registeredInheritedProperty(customPropertyName);
- if (result)
- return result;
+ const CSSValue* result = nullptr;
+ if (registration->inherits()) {
+ if (StyleInheritedVariables* variables = style.inheritedVariables())
+ result = variables->registeredVariable(customPropertyName);
+ } else {
+ if (StyleNonInheritedVariables* variables = style.nonInheritedVariables())
+ result = variables->registeredVariable(customPropertyName);
}
+ if (result)
+ return result;
return registration->initial();
}
}
+ StyleInheritedVariables* variables = style.inheritedVariables();
if (!variables)
return nullptr;
@@ -1673,7 +1679,8 @@ const CSSValue* ComputedStyleCSSValueMapping::get(const AtomicString customPrope
std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> ComputedStyleCSSValueMapping::getVariables(const ComputedStyle& style)
{
- StyleVariableData* variables = style.variables();
+ // TODO(timloh): Also return non-inherited variables
+ StyleInheritedVariables* variables = style.inheritedVariables();
if (variables)
return variables->getVariables();
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698