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

Unified Diff: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp

Issue 2406203004: Compute registered properties after resolving high priority properties (Closed)
Patch Set: font size cycle test Created 4 years, 2 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/resolver/CSSVariableResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
index 08aab457152cbb5ee33af2f311ab1645411fb16a..219ea54eb84c380de3b72dd9f5ea375be35acc8c 100644
--- a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
@@ -70,10 +70,7 @@ CSSVariableData* CSSVariableResolver::valueForCustomProperty(
const CSSValue* parsedValue = nullptr;
if (newVariableData) {
parsedValue = newVariableData->parseForSyntax(registration->syntax());
- if (parsedValue)
- parsedValue = &StyleBuilderConverter::convertRegisteredPropertyValue(
- m_styleResolverState, *parsedValue);
- else
+ if (!parsedValue)
newVariableData = nullptr;
}
if (registration->inherits()) {
@@ -301,9 +298,37 @@ void CSSVariableResolver::resolveVariableDefinitions(
}
}
+void CSSVariableResolver::computeRegisteredVariables(
+ const StyleResolverState& state) {
+ // const_cast is needed because Persistent<const ...> doesn't work properly.
+
+ StyleInheritedVariables* inheritedVariables =
+ state.style()->inheritedVariables();
+ if (inheritedVariables) {
+ for (auto& variable : inheritedVariables->m_registeredData) {
+ if (variable.value) {
+ variable.value = const_cast<CSSValue*>(
+ &StyleBuilderConverter::convertRegisteredPropertyValue(
+ state, *variable.value));
+ }
+ }
+ }
+
+ StyleNonInheritedVariables* nonInheritedVariables =
+ state.style()->nonInheritedVariables();
+ if (nonInheritedVariables) {
+ for (auto& variable : nonInheritedVariables->m_registeredData) {
+ if (variable.value) {
+ variable.value = const_cast<CSSValue*>(
+ &StyleBuilderConverter::convertRegisteredPropertyValue(
+ state, *variable.value));
+ }
+ }
+ }
+}
+
CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state)
- : m_styleResolverState(state),
- m_inheritedVariables(state.style()->inheritedVariables()),
+ : m_inheritedVariables(state.style()->inheritedVariables()),
m_nonInheritedVariables(state.style()->nonInheritedVariables()),
m_registry(state.document().propertyRegistry()) {}

Powered by Google App Engine
This is Rietveld 408576698