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

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: Created 7 years, 4 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 0e45c5c3823153039f0374dbb2109765b02dd9b1..ed175b9a0451f479df268df6d86e8328e1b67308 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -531,7 +531,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();
@@ -1196,8 +1196,14 @@ bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
m_id = propertyID;
m_important = important;
+ if (declaration->cssParserMode() == ViewportMode)
+ markViewportRuleBodyStart();
eseidel 2013/09/10 16:33:58 Bleh. Do we need a helper function around cssyypa
rune 2013/09/12 13:05:01 Did an RAII.
+
cssyyparse(this);
+ if (declaration->cssParserMode() == ViewportMode)
+ markViewportRuleBodyEnd();
+
m_rule = 0;
m_id = CSSPropertyInvalid;
@@ -1311,7 +1317,15 @@ bool CSSParser::parseDeclaration(MutableStylePropertySet* declaration, const Str
m_sourceDataHandler->endRuleHeader(1);
m_sourceDataHandler->startRuleBody(0);
}
+
+ if (declaration->cssParserMode() == ViewportMode)
+ markViewportRuleBodyStart();
+
cssyyparse(this);
+
+ if (declaration->cssParserMode() == ViewportMode)
+ markViewportRuleBodyEnd();
+
m_rule = 0;
bool ok = false;
@@ -1378,7 +1392,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