| Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| index 74823b2295cd23ee6631267c0b8f68aa2298ac43..5ba3dfbcf8fc764f7d3d7f133983db6c98f5c7be 100644
|
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| @@ -189,6 +189,11 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeInteger(CSSParserTokenRa
|
| return nullptr;
|
| }
|
|
|
| +static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumePositiveInteger(CSSParserTokenRange& range, CSSParserMode cssParserMode)
|
| +{
|
| + return consumeInteger(range, cssParserMode, 1);
|
| +}
|
| +
|
| static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeNumber(CSSParserTokenRange& range, ValueRange valueRange)
|
| {
|
| const CSSParserToken& token = range.peek();
|
| @@ -754,6 +759,47 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& r
|
| return list.release();
|
| }
|
|
|
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnWidth(CSSParserTokenRange& range)
|
| +{
|
| + if (range.peek().id() == CSSValueAuto)
|
| + return consumeIdent(range);
|
| + // Always parse lengths in strict mode here, since it would be ambiguous otherwise when used in
|
| + // the 'columns' shorthand property.
|
| + RefPtrWillBeRawPtr<CSSPrimitiveValue> columnWidth = consumeLength(range, HTMLStandardMode, ValueRangeNonNegative);
|
| + if (!columnWidth || (!columnWidth->isCalculated() && columnWidth->getDoubleValue() == 0))
|
| + return nullptr;
|
| + return columnWidth.release();
|
| +}
|
| +
|
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnCount(CSSParserTokenRange& range, CSSParserMode cssParserMode)
|
| +{
|
| + if (range.peek().id() == CSSValueAuto)
|
| + return consumeIdent(range);
|
| + return consumePositiveInteger(range, cssParserMode);
|
| +}
|
| +
|
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnGap(CSSParserTokenRange& range, CSSParserMode cssParserMode)
|
| +{
|
| + if (range.peek().id() == CSSValueNormal)
|
| + return consumeIdent(range);
|
| + return consumeLength(range, cssParserMode, ValueRangeNonNegative);
|
| +}
|
| +
|
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeColumnSpan(CSSParserTokenRange& range, CSSParserMode cssParserMode)
|
| +{
|
| + CSSValueID id = range.peek().id();
|
| + if (id == CSSValueAll || id == CSSValueNone)
|
| + return consumeIdent(range);
|
| + if (range.peek().type() != NumberToken)
|
| + return nullptr;
|
| + if (RefPtrWillBeRawPtr<CSSPrimitiveValue> spanValue = consumeInteger(range, cssParserMode)) {
|
| + // 1 (will be dropped in the unprefixed property).
|
| + if (spanValue->getIntValue() == 1)
|
| + return spanValue.release();
|
| + }
|
| + return nullptr;
|
| +}
|
| +
|
| PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
|
| {
|
| m_range.consumeWhitespace();
|
| @@ -797,6 +843,14 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
|
| return consumeSize(m_range, m_context.mode());
|
| case CSSPropertyTextIndent:
|
| return consumeTextIndent(m_range, m_context.mode());
|
| + case CSSPropertyWebkitColumnWidth:
|
| + return consumeColumnWidth(m_range);
|
| + case CSSPropertyWebkitColumnCount:
|
| + return consumeColumnCount(m_range, m_context.mode());
|
| + case CSSPropertyWebkitColumnGap:
|
| + return consumeColumnGap(m_range, m_context.mode());
|
| + case CSSPropertyWebkitColumnSpan:
|
| + return consumeColumnSpan(m_range, m_context.mode());
|
| default:
|
| return nullptr;
|
| }
|
| @@ -1131,6 +1185,37 @@ bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, bool impor
|
| }
|
| }
|
|
|
| +static void consumeColumnWidthOrCount(CSSParserTokenRange& range, CSSParserMode cssParserMode, RefPtrWillBeRawPtr<CSSValue> &columnWidth, RefPtrWillBeRawPtr<CSSValue> &columnCount)
|
| +{
|
| + if (range.peek().id() == CSSValueAuto) {
|
| + consumeIdent(range);
|
| + return;
|
| + }
|
| + if (!columnWidth) {
|
| + if ((columnWidth = consumeColumnWidth(range)))
|
| + return;
|
| + }
|
| + if (!columnCount)
|
| + columnCount = consumeColumnCount(range, cssParserMode);
|
| +}
|
| +
|
| +bool CSSPropertyParser::consumeColumns(bool important)
|
| +{
|
| + RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr;
|
| + RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr;
|
| + consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, columnCount);
|
| + consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, columnCount);
|
| + if (!m_range.atEnd())
|
| + return false;
|
| + if (!columnWidth)
|
| + columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto);
|
| + if (!columnCount)
|
| + columnCount = cssValuePool().createIdentifierValue(CSSValueAuto);
|
| + addProperty(CSSPropertyWebkitColumnWidth, columnWidth.release(), important);
|
| + addProperty(CSSPropertyWebkitColumnCount, columnCount.release(), important);
|
| + return true;
|
| +}
|
| +
|
| bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, bool important)
|
| {
|
| m_range.consumeWhitespace();
|
| @@ -1184,6 +1269,10 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, bool important)
|
| }
|
| case CSSPropertyBorderSpacing:
|
| return consumeBorderSpacing(important);
|
| + case CSSPropertyWebkitColumns: {
|
| + m_currentShorthand = oldShorthand;
|
| + return consumeColumns(important);
|
| + }
|
| default:
|
| m_currentShorthand = oldShorthand;
|
| return false;
|
|
|