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

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

Issue 1636453002: Use ASCII case-insensitive matching for ident-likes in the CSS parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Consistent indentation in test. Created 4 years, 11 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: third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp b/third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp
index 8df06e3a233b12a35a740a4132367719b4c84b91..cfb23db101b7164092d71ca38ef46fb90ac6f4f4 100644
--- a/third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp
@@ -65,19 +65,19 @@ void MediaQueryParser::readRestrictor(CSSParserTokenType type, const CSSParserTo
void MediaQueryParser::readMediaNot(CSSParserTokenType type, const CSSParserToken& token)
{
- if (type == IdentToken && equalIgnoringCase(token.value(), "not"))
+ if (type == IdentToken && token.valueEqualsIgnoringASCIICase("not"))
setStateAndRestrict(ReadFeatureStart, MediaQuery::Not);
else
readFeatureStart(type, token);
}
-static bool isRestrictorOrLogicalOperator(const String& tokenValue)
+static bool isRestrictorOrLogicalOperator(const CSSParserToken& token)
{
// FIXME: it would be more efficient to use lower-case always for tokenValue.
- return equalIgnoringCase(tokenValue, "not")
- || equalIgnoringCase(tokenValue, "and")
- || equalIgnoringCase(tokenValue, "or")
- || equalIgnoringCase(tokenValue, "only");
+ return token.valueEqualsIgnoringASCIICase("not")
+ || token.valueEqualsIgnoringASCIICase("and")
+ || token.valueEqualsIgnoringASCIICase("or")
+ || token.valueEqualsIgnoringASCIICase("only");
}
void MediaQueryParser::readMediaType(CSSParserTokenType type, const CSSParserToken& token)
@@ -88,12 +88,12 @@ void MediaQueryParser::readMediaType(CSSParserTokenType type, const CSSParserTok
else
m_state = ReadFeature;
} else if (type == IdentToken) {
- if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "not")) {
+ if (m_state == ReadRestrictor && token.valueEqualsIgnoringASCIICase("not")) {
setStateAndRestrict(ReadMediaType, MediaQuery::Not);
- } else if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "only")) {
+ } else if (m_state == ReadRestrictor && token.valueEqualsIgnoringASCIICase("only")) {
setStateAndRestrict(ReadMediaType, MediaQuery::Only);
} else if (m_mediaQueryData.restrictor() != MediaQuery::None
- && isRestrictorOrLogicalOperator(token.value())) {
+ && isRestrictorOrLogicalOperator(token)) {
m_state = SkipUntilComma;
} else {
m_mediaQueryData.setMediaType(token.value());
@@ -110,7 +110,7 @@ void MediaQueryParser::readMediaType(CSSParserTokenType type, const CSSParserTok
void MediaQueryParser::readAnd(CSSParserTokenType type, const CSSParserToken& token)
{
- if (type == IdentToken && equalIgnoringCase(token.value(), "and")) {
+ if (type == IdentToken && token.valueEqualsIgnoringASCIICase("and")) {
m_state = ReadFeatureStart;
} else if (type == CommaToken && m_parserType != MediaConditionParser) {
m_querySet->addMediaQuery(m_mediaQueryData.takeMediaQuery());

Powered by Google App Engine
This is Rietveld 408576698