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

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

Issue 1311503006: Make parseColumnsShorthand not mark 'auto' initial value as implicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: V3 Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 5c88c54ae81208312709032cb2c521cefb9ec113..16adb442bce04076adeb194ed3ac6e63f3da6cd0 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1905,17 +1905,13 @@ bool CSSPropertyParser::parseColumnsShorthand(bool important)
{
RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr;
RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr;
- bool hasPendingExplicitAuto = false;
for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->current(); propertiesParsed++) {
if (propertiesParsed >= 2)
return false; // Too many values for this shorthand. Invalid declaration.
- if (!propertiesParsed && value->id == CSSValueAuto) {
- // 'auto' is a valid value for any of the two longhands, and at this point we
- // don't know which one(s) it is meant for. We need to see if there are other
- // values first.
+ if (value->id == CSSValueAuto) {
+ // Skip 'auto' as we will use it for initial value if no width/count was parsed.
m_valueList->next();
- hasPendingExplicitAuto = true;
} else {
if (!columnWidth) {
if ((columnWidth = parseColumnWidth()))
@@ -1930,29 +1926,13 @@ bool CSSPropertyParser::parseColumnsShorthand(bool important)
return false;
}
}
- if (hasPendingExplicitAuto) {
- // Time to assign the previously skipped 'auto' value to a property. If both properties are
- // unassigned at this point (i.e. 'columns:auto'), it doesn't matter that much which one we
- // set (although it does make a slight difference to web-inspector). The one we don't set
- // here will get an implicit 'auto' value further down.
- if (!columnWidth) {
- columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto);
- } else {
- ASSERT(!columnCount);
- columnCount = cssValuePool().createIdentifierValue(CSSValueAuto);
- }
- }
- ASSERT(columnCount || columnWidth);
- // Any unassigned property at this point will become implicit 'auto'.
- if (columnWidth)
- addProperty(CSSPropertyWebkitColumnWidth, columnWidth, important);
- else
- addProperty(CSSPropertyWebkitColumnWidth, cssValuePool().createIdentifierValue(CSSValueAuto), important, true /* implicit */);
- if (columnCount)
- addProperty(CSSPropertyWebkitColumnCount, columnCount, important);
- else
- addProperty(CSSPropertyWebkitColumnCount, cssValuePool().createIdentifierValue(CSSValueAuto), important, true /* implicit */);
+ if (!columnWidth)
+ columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto);
+ addProperty(CSSPropertyWebkitColumnWidth, columnWidth, important);
+ if (!columnCount)
+ columnCount = cssValuePool().createIdentifierValue(CSSValueAuto);
+ addProperty(CSSPropertyWebkitColumnCount, columnCount, important);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698