Chromium Code Reviews| 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(); |
| } |