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

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

Issue 14715014: Add parsing for named grid lines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('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 83af384ce1002c1f1ba2298668e516ae420ccffd..6b993079a9760f11cfeefad82f42e4db9c854c07 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -4552,6 +4552,7 @@ PassRefPtr<CSSValue> CSSParser::parseGridPosition()
}
RefPtr<CSSPrimitiveValue> numericValue;
+ RefPtr<CSSPrimitiveValue> gridLineName;
bool hasSeenSpanKeyword = false;
if (validUnit(value, FInteger) && value->fValue) {
@@ -4561,6 +4562,9 @@ PassRefPtr<CSSValue> CSSParser::parseGridPosition()
hasSeenSpanKeyword = true;
m_valueList->next();
}
+ } else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
Julien - ping for review 2013/05/09 21:48:42 This change doesn't match the description unfortun
+ gridLineName = createPrimitiveStringValue(m_valueList->current());
+ m_valueList->next();
} else if (value->id == CSSValueSpan) {
hasSeenSpanKeyword = true;
value = m_valueList->next();
@@ -4570,20 +4574,27 @@ PassRefPtr<CSSValue> CSSParser::parseGridPosition()
}
}
- if (!hasSeenSpanKeyword)
- return numericValue.release();
+ // Check that we have consumed all the value list. For shorthands, the parser will pass
+ // the whole value list (including the opposite position).
+ if (m_valueList->current() && !isForwardSlashOperator(m_valueList->current()))
+ return 0;
- if (!numericValue && hasSeenSpanKeyword)
- return cssValuePool().createIdentifierValue(CSSValueSpan);
+ // If we didn't parse anything, this is not a valid grid position.
+ if (!hasSeenSpanKeyword && !gridLineName && !numericValue)
+ return 0;
// Negative numbers are not allowed for span (but are for <integer>).
- if (numericValue && numericValue->getIntValue() < 0)
+ if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
return 0;
RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
- values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
+ if (hasSeenSpanKeyword)
+ values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
if (numericValue)
values->append(numericValue.release());
+ if (gridLineName)
+ values->append(gridLineName.release());
+ ASSERT(values->length() > 0);
return values.release();
}
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698