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

Unified Diff: third_party/WebKit/Source/wtf/text/StringView.cpp

Issue 2024373002: Replace CSSParserString with StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/wtf/text/StringView.cpp
diff --git a/third_party/WebKit/Source/wtf/text/StringView.cpp b/third_party/WebKit/Source/wtf/text/StringView.cpp
index fea433c4225f1e65ed72158902949d58be54a75f..4df160186f49e6d51a750dd020854b5e838443f9 100644
--- a/third_party/WebKit/Source/wtf/text/StringView.cpp
+++ b/third_party/WebKit/Source/wtf/text/StringView.cpp
@@ -51,4 +51,20 @@ bool equalStringView(const StringView& a, const StringView& b)
return equal(a.characters16(), b.characters16(), a.length());
}
+bool equalIgnoringASCIICase(StringView a, StringView b)
+{
+ if (a.length() != b.length())
+ return false;
+ if (a.isEmpty() || b.isEmpty())
Timothy Loh 2016/06/01 05:51:32 How about: if (a.isEmpty()) return true; Or
esprehn 2016/06/01 06:19:04 I see that the method in StringImpl.h does accept
+ return a.isEmpty() == b.isEmpty();
+ if (a.is8Bit()) {
+ if (b.is8Bit())
+ return equalIgnoringASCIICase(a.characters8(), b.characters8(), a.length());
+ return equalIgnoringASCIICase(a.characters8(), b.characters16(), a.length());
+ }
+ if (b.is8Bit())
+ return equalIgnoringASCIICase(a.characters16(), b.characters8(), a.length());
+ return equalIgnoringASCIICase(a.characters16(), b.characters16(), a.length());
+}
+
} // namespace WTF

Powered by Google App Engine
This is Rietveld 408576698