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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserString.h

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/CSSParserString.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserString.h b/third_party/WebKit/Source/core/css/parser/CSSParserString.h
index f3434ab6c590dd4263beae72eeb018389f09ae9e..e675cd20e3371b44bfc99813383b0f0724edceb2 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserString.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserString.h
@@ -81,13 +81,12 @@ struct CSSParserString {
return m_data.characters16[i];
}
- bool equalIgnoringCase(const char* str) const
+ template<unsigned matchLength>
+ bool equalIgnoringASCIICase(const char (&match)[matchLength]) const
{
- bool match = is8Bit() ? WTF::equalIgnoringCase(str, characters8(), length()) : WTF::equalIgnoringCase(str, characters16(), length());
- if (!match)
+ if (matchLength - 1 != length())
return false;
- ASSERT(strlen(str) >= length());
- return str[length()] == '\0';
+ return is8Bit() ? WTF::equalIgnoringASCIICase(characters8(), match, length()) : WTF::equalIgnoringASCIICase(characters16(), match, length());
}
operator String() const { return is8Bit() ? String(m_data.characters8, m_length) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); }

Powered by Google App Engine
This is Rietveld 408576698