Chromium Code Reviews| 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 |