Commit b36f7565 authored by timloh's avatar timloh Committed by Commit bot

Consume initial whitespace up front in CSSPropertyParser

This patch makes the CSSPropertyParser consume the initial whitespace
at the start, instead of in each of the separate top-level parsing
functions (parseShorthand, parseSingleValue, parseViewportDescriptor,
parseFontFaceDescriptor).

BUG=499780

Review URL: https://codereview.chromium.org/1471933003

Cr-Commit-Position: refs/heads/master@{#361293}
parent 1b59e494
...@@ -42,6 +42,7 @@ CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, const CSSPar ...@@ -42,6 +42,7 @@ CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, const CSSPar
, m_currentShorthand(CSSPropertyInvalid) , m_currentShorthand(CSSPropertyInvalid)
, m_implicitShorthand(false) , m_implicitShorthand(false)
{ {
m_range.consumeWhitespace();
} }
bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool important, bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool important,
...@@ -1874,7 +1875,6 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeStrokeDasharray(CSSParserTokenRan ...@@ -1874,7 +1875,6 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeStrokeDasharray(CSSParserTokenRan
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty) PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{ {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
m_range.consumeWhitespace();
switch (property) { switch (property) {
case CSSPropertyWillChange: case CSSPropertyWillChange:
return consumeWillChange(m_range); return consumeWillChange(m_range);
...@@ -2134,8 +2134,6 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::consumeFontFaceSrc() ...@@ -2134,8 +2134,6 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::consumeFontFaceSrc()
bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId) bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
{ {
RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
m_range.consumeWhitespace();
switch (propId) { switch (propId) {
case CSSPropertyFontFamily: case CSSPropertyFontFamily:
if (consumeGenericFamily(m_range)) if (consumeGenericFamily(m_range))
...@@ -2330,8 +2328,6 @@ bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, bool impor ...@@ -2330,8 +2328,6 @@ bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, bool impor
{ {
ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_context.mode())); ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_context.mode()));
m_range.consumeWhitespace();
switch (propId) { switch (propId) {
case CSSPropertyWidth: { case CSSPropertyWidth: {
RefPtrWillBeRawPtr<CSSValue> minWidth = consumeSingleViewportDescriptor(m_range, CSSPropertyMinWidth, m_context.mode()); RefPtrWillBeRawPtr<CSSValue> minWidth = consumeSingleViewportDescriptor(m_range, CSSPropertyMinWidth, m_context.mode());
...@@ -2533,7 +2529,6 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im ...@@ -2533,7 +2529,6 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
{ {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
m_range.consumeWhitespace();
CSSPropertyID oldShorthand = m_currentShorthand; CSSPropertyID oldShorthand = m_currentShorthand;
// TODO(rob.buis): Remove this when the legacy property parser is gone // TODO(rob.buis): Remove this when the legacy property parser is gone
m_currentShorthand = property; m_currentShorthand = property;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment