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

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: More comments added. 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
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSParserMode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..51e3416faff2c9ffb9daa2b25d0d96d94a5f26ce 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -543,7 +543,8 @@ static bool parseSimpleLengthValue(MutableStylePropertySet* declaration, CSSProp
{
ASSERT(!string.isEmpty());
bool acceptsNegativeNumbers;
- if (!isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers))
+ // In ViewportMode, width and height are shorthands, not simple length values.
+ if (cssParserMode == ViewportMode || !isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers))
return false;
unsigned length = string.length();
@@ -1219,7 +1220,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 +1338,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 +1410,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)
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSParserMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698