 Chromium Code Reviews
 Chromium Code Reviews Issue 22917005:
  New parser mode for CSSOM @viewport descriptors.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 22917005:
  New parser mode for CSSOM @viewport descriptors.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/css/CSSParser-in.cpp | 
| diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp | 
| index 873c3471a8f9cd410d435620101cc53e3869a61f..ed0d2c63c1686a7b2818e38cd25c3463d58f0946 100644 | 
| --- a/Source/core/css/CSSParser-in.cpp | 
| +++ b/Source/core/css/CSSParser-in.cpp | 
| @@ -543,7 +543,7 @@ static bool parseSimpleLengthValue(MutableStylePropertySet* declaration, CSSProp | 
| { | 
| ASSERT(!string.isEmpty()); | 
| bool acceptsNegativeNumbers; | 
| - if (!isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers)) | 
| + if (cssParserMode == ViewportMode || !isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers)) | 
| 
eseidel
2013/09/17 16:28:55
So this whole change is to disallow negative numbe
 
rune
2013/09/17 20:17:03
No. This is to avoid the simple-length-fast-path f
 | 
| return false; | 
| unsigned length = string.length(); | 
| @@ -1218,6 +1218,7 @@ bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p | 
| m_id = propertyID; | 
| m_important = important; | 
| + StyleDeclarationScope scope(this, declaration); | 
| cssyyparse(this); | 
| 
eseidel
2013/09/17 16:28:55
I might have wrapped this in a block, depending on
 
rune
2013/09/17 20:17:03
Will do.
 
rune
2013/09/17 20:40:41
Done.
 | 
| m_rule = 0; | 
| @@ -1333,7 +1334,10 @@ bool CSSParser::parseDeclaration(MutableStylePropertySet* declaration, const Str | 
| m_sourceDataHandler->endRuleHeader(1); | 
| m_sourceDataHandler->startRuleBody(0); | 
| } | 
| + | 
| + StyleDeclarationScope scope(this, declaration); | 
| cssyyparse(this); | 
| + | 
| m_rule = 0; | 
| bool ok = false; | 
| @@ -1400,7 +1404,9 @@ PassRefPtr<ImmutableStylePropertySet> CSSParser::createStylePropertySet() | 
| if (unusedEntries) | 
| results.remove(0, unusedEntries); | 
| - return ImmutableStylePropertySet::create(results.data(), results.size(), m_context.mode); | 
| + CSSParserMode mode = inViewport() ? ViewportMode : m_context.mode; | 
| + | 
| + return ImmutableStylePropertySet::create(results.data(), results.size(), mode); | 
| } | 
| void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit) |