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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2089593002: Add expansion of shorthands with custom properties to longhands using a pending substition value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dates and remove unnecessary comments Created 4 years, 6 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/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 0f2164fc8d17e09e5e7cbbdb58426b985702ed97..382e8893db0c84dce120461d80f7a5444e39cd18 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -25,6 +25,7 @@
#include "core/css/CSSInitialValue.h"
#include "core/css/CSSPaintValue.h"
#include "core/css/CSSPathValue.h"
+#include "core/css/CSSPendingSubstitutionValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSQuadValue.h"
#include "core/css/CSSReflectValue.h"
@@ -151,8 +152,10 @@ bool CSSPropertyParser::parseValueStart(CSSPropertyID unresolvedProperty, bool i
CSSParserTokenRange originalRange = m_range;
CSSPropertyID propertyId = resolveCSSPropertyID(unresolvedProperty);
+ bool isShorthand = isShorthandProperty(propertyId);
- if (isShorthandProperty(propertyId)) {
+ if (isShorthand) {
+ // Variable references will fail to parse here and will fall out to the variable ref parser below.
if (parseShorthand(unresolvedProperty, important))
return true;
} else {
@@ -165,9 +168,14 @@ bool CSSPropertyParser::parseValueStart(CSSPropertyID unresolvedProperty, bool i
}
if (RuntimeEnabledFeatures::cssVariablesEnabled() && CSSVariableParser::containsValidVariableReferences(originalRange)) {
- // We don't expand the shorthand here because crazypants.
CSSVariableReferenceValue* variable = CSSVariableReferenceValue::create(CSSVariableData::create(originalRange));
- addProperty(propertyId, CSSPropertyInvalid, variable, important);
+
+ if (isShorthand) {
+ CSSPendingSubstitutionValue* pendingValue = CSSPendingSubstitutionValue::create(propertyId, variable);
+ addExpandedPropertyForValue(propertyId, pendingValue, important);
+ } else {
+ addProperty(propertyId, CSSPropertyInvalid, variable, important);
+ }
return true;
}

Powered by Google App Engine
This is Rietveld 408576698