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

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

Issue 13992003: Add support for parsing <grid-line> that includes a 'span' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed the change to match the specification Created 7 years, 8 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 | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSValueKeywords.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser.cpp
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index d5986b7312f64ce49759eb68bd6df02d68bff85b..a5a69cedf7529d7500d5f712aed6612261782e4b 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -2549,7 +2549,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
if (!cssGridLayoutEnabled())
return false;
- validPrimitive = id == CSSValueAuto || (validUnit(value, FInteger) && value->fValue);
+ parsedValue = parseGridPosition();
break;
case CSSPropertyWebkitGridColumn:
@@ -4609,6 +4609,50 @@ bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& r
return false;
}
+PassRefPtr<CSSValue> CSSParser::parseGridPosition()
+{
+ CSSParserValue* value = m_valueList->current();
+ if (value->id == CSSValueAuto) {
+ m_valueList->next();
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ }
+
+ RefPtr<CSSPrimitiveValue> numericValue;
+ bool hasSeenSpanKeyword = false;
+
+ if (validUnit(value, FInteger) && value->fValue) {
+ numericValue = createPrimitiveNumericValue(value);
+ value = m_valueList->next();
+ if (value && value->id == CSSValueSpan) {
+ hasSeenSpanKeyword = true;
+ m_valueList->next();
+ }
+ } else if (value->id == CSSValueSpan) {
+ hasSeenSpanKeyword = true;
+ value = m_valueList->next();
+ if (value && (validUnit(value, FInteger) && value->fValue)) {
+ numericValue = createPrimitiveNumericValue(value);
+ m_valueList->next();
+ }
+ }
+
+ if (!hasSeenSpanKeyword)
+ return numericValue.release();
+
+ if (!numericValue && hasSeenSpanKeyword)
+ return cssValuePool().createIdentifierValue(CSSValueSpan);
+
+ // Negative numbers are not allowed for span (but are for <integer>).
+ if (numericValue && numericValue->getIntValue() < 0)
+ return 0;
+
+ RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+ values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
+ if (numericValue)
+ values->append(numericValue.release());
+ return values.release();
+}
+
bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool important)
{
ShorthandScope scope(this, shorthandId);
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSValueKeywords.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698