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

Unified Diff: third_party/WebKit/Source/wtf/text/StringBuilder.h

Issue 2508953003: WTF: Add comments and tests for Unicode aware case-insensitive string operations. (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/StringBuilder.h
diff --git a/third_party/WebKit/Source/wtf/text/StringBuilder.h b/third_party/WebKit/Source/wtf/text/StringBuilder.h
index 47814f8779df081a6bb75d79aa24d46c3b5cc230..1e44b978445b102c27782ae4346e835bc037e09d 100644
--- a/third_party/WebKit/Source/wtf/text/StringBuilder.h
+++ b/third_party/WebKit/Source/wtf/text/StringBuilder.h
@@ -247,6 +247,9 @@ bool equalIgnoringCase(const StringBuilder& s,
return equalIgnoringCase(s.characters16(), buffer, length);
}
+// Unicode aware case insensitive string matching. Non-ASCII characters might
+// match to ASCII characters. This function is rarely used to implement web
+// platform features.
inline bool equalIgnoringCase(const StringBuilder& s, const char* string) {
return equalIgnoringCase(s, reinterpret_cast<const LChar*>(string),
strlen(string));
@@ -271,25 +274,6 @@ bool equal(const StringBuilder& a, const StringType& b) {
return equal(a.characters16(), b.characters16(), a.length());
}
-template <typename StringType>
-bool equalIgnoringCase(const StringBuilder& a, const StringType& b) {
- if (a.length() != b.length())
- return false;
-
- if (!a.length())
- return true;
-
- if (a.is8Bit()) {
- if (b.is8Bit())
- return equalIgnoringCase(a.characters8(), b.characters8(), a.length());
- return equalIgnoringCase(a.characters8(), b.characters16(), a.length());
- }
-
- if (b.is8Bit())
- return equalIgnoringCase(a.characters16(), b.characters8(), a.length());
- return equalIgnoringCase(a.characters16(), b.characters16(), a.length());
-}
-
inline bool operator==(const StringBuilder& a, const StringBuilder& b) {
return equal(a, b);
}
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698