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

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

Issue 22917005: New parser mode for CSSOM @viewport descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review issues. Created 7 years, 3 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
Index: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index 1ff2cfe8f1ab2355d990715a8dacce611992d08e..530d6b43f5cba7dd7b3d80c2e88a4724ed4bdedf 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))
return false;
unsigned length = string.length();
@@ -1219,7 +1219,10 @@ bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
m_id = propertyID;
m_important = important;
- cssyyparse(this);
+ {
+ StyleDeclarationScope scope(this, declaration);
+ cssyyparse(this);
+ }
m_rule = 0;
m_id = CSSPropertyInvalid;
@@ -1334,7 +1337,12 @@ bool CSSParser::parseDeclaration(MutableStylePropertySet* declaration, const Str
m_sourceDataHandler->endRuleHeader(1);
m_sourceDataHandler->startRuleBody(0);
}
- cssyyparse(this);
+
+ {
+ StyleDeclarationScope scope(this, declaration);
+ cssyyparse(this);
+ }
+
m_rule = 0;
bool ok = false;
@@ -1401,7 +1409,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)

Powered by Google App Engine
This is Rietveld 408576698