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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp

Issue 2210643002: Consolidate consumeWhitespace calls to one line (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
index ae32ea630f2c688fa5a30d682654e83318e8cbac..d93c45432ed3dde65bbf0bcd93442e0d0ae61f57 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
@@ -358,7 +358,7 @@ bool CSSParserImpl::consumeRuleList(CSSParserTokenRange range, RuleListType rule
StyleRuleBase* CSSParserImpl::consumeAtRule(CSSParserTokenRange& range, AllowedRulesType allowedRules)
{
ASSERT(range.peek().type() == AtKeywordToken);
- const StringView name = range.consume().value();
+ const StringView name = range.consumeIncludingWhitespace().value();
const CSSParserToken* preludeStart = &range.peek();
while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type() != SemicolonToken)
range.consumeComponentValue();
@@ -453,7 +453,6 @@ static AtomicString consumeStringOrURI(CSSParserTokenRange& range)
StyleRuleCharset* CSSParserImpl::consumeCharsetRule(CSSParserTokenRange prelude)
{
- prelude.consumeWhitespace();
const CSSParserToken& string = prelude.consumeIncludingWhitespace();
if (string.type() != StringToken || !prelude.atEnd())
return nullptr; // Parse error, expected a single string
@@ -462,7 +461,6 @@ StyleRuleCharset* CSSParserImpl::consumeCharsetRule(CSSParserTokenRange prelude)
StyleRuleImport* CSSParserImpl::consumeImportRule(CSSParserTokenRange prelude)
{
- prelude.consumeWhitespace();
AtomicString uri(consumeStringOrURI(prelude));
if (uri.isNull())
return nullptr; // Parse error, expected string or URI
@@ -480,13 +478,11 @@ StyleRuleImport* CSSParserImpl::consumeImportRule(CSSParserTokenRange prelude)
StyleRuleNamespace* CSSParserImpl::consumeNamespaceRule(CSSParserTokenRange prelude)
{
- prelude.consumeWhitespace();
AtomicString namespacePrefix;
if (prelude.peek().type() == IdentToken)
namespacePrefix = prelude.consumeIncludingWhitespace().value().toAtomicString();
AtomicString uri(consumeStringOrURI(prelude));
- prelude.consumeWhitespace();
if (uri.isNull() || !prelude.atEnd())
return nullptr; // Parse error, expected string or URI
@@ -498,10 +494,8 @@ StyleRuleMedia* CSSParserImpl::consumeMediaRule(CSSParserTokenRange prelude, CSS
HeapVector<Member<StyleRuleBase>> rules;
if (m_observerWrapper) {
- CSSParserTokenRange preludeWithoutWhitespace = prelude;
- preludeWithoutWhitespace.consumeWhitespace();
- m_observerWrapper->observer().startRuleHeader(StyleRule::Media, m_observerWrapper->startOffset(preludeWithoutWhitespace));
- m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(preludeWithoutWhitespace));
+ m_observerWrapper->observer().startRuleHeader(StyleRule::Media, m_observerWrapper->startOffset(prelude));
+ m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(block));
}
@@ -547,7 +541,6 @@ StyleRuleViewport* CSSParserImpl::consumeViewportRule(CSSParserTokenRange prelud
if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(m_context.mode()))
return nullptr;
- prelude.consumeWhitespace();
if (!prelude.atEnd())
return nullptr; // Parser error; @viewport prelude should be empty
@@ -565,7 +558,6 @@ StyleRuleViewport* CSSParserImpl::consumeViewportRule(CSSParserTokenRange prelud
StyleRuleFontFace* CSSParserImpl::consumeFontFaceRule(CSSParserTokenRange prelude, CSSParserTokenRange block)
{
- prelude.consumeWhitespace();
if (!prelude.atEnd())
return nullptr; // Parse error; @font-face prelude should be empty
@@ -586,7 +578,6 @@ StyleRuleFontFace* CSSParserImpl::consumeFontFaceRule(CSSParserTokenRange prelud
StyleRuleKeyframes* CSSParserImpl::consumeKeyframesRule(bool webkitPrefixed, CSSParserTokenRange prelude, CSSParserTokenRange block)
{
- prelude.consumeWhitespace();
CSSParserTokenRange rangeCopy = prelude; // For inspector callbacks
const CSSParserToken& nameToken = prelude.consumeIncludingWhitespace();
if (!prelude.atEnd())
@@ -640,7 +631,6 @@ void CSSParserImpl::consumeApplyRule(CSSParserTokenRange prelude)
{
ASSERT(RuntimeEnabledFeatures::cssApplyAtRulesEnabled());
- prelude.consumeWhitespace();
const CSSParserToken& ident = prelude.consumeIncludingWhitespace();
if (!prelude.atEnd() || !CSSVariableParser::isValidVariableName(ident))
return; // Parse error, expected a single custom property name
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698