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

Unified Diff: Source/core/css/CSSParser.cpp

Issue 16917013: [CSS Grid Layout] CSSParser should reject <track-list> without a <track-size> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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: Source/core/css/CSSParser.cpp
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index 7fc56703e0ac30392f93629a398a3faab28a06d3..6c82615a4866997f73af890955689698c48c2408 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -4595,24 +4595,34 @@ bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important)
}
RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
- size_t currentLineNumber = 0;
+ // Handle leading <string>*.
+ while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) {
+ RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current());
+ values->append(name);
+ m_valueList->next();
+ }
+
+ bool seenTrackSize = false;
while (m_valueList->current()) {
+ RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
+ if (!primitiveValue)
+ return false;
+
+ seenTrackSize = true;
+ values->append(primitiveValue.release());
+
+ // This will handle the trailing <string>* in the grammar.
while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) {
RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current());
values->append(name);
m_valueList->next();
}
+ }
- // This allows trailing <string>* per the specification.
- if (!m_valueList->current())
- break;
-
- RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
- if (!primitiveValue)
- return false;
+ // We should have found a <track-size> or else it is not a valid <track-list>
+ if (!seenTrackSize)
+ return false;
- values->append(primitiveValue.release());
- }
addProperty(propId, values.release(), important);
return true;
}
« no previous file with comments | « LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698