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

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

Issue 1624383002: Match <area shape> ASCII case-insensitively (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.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/StringImpl.cpp
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/wtf/text/StringImpl.cpp
index 2a46f3bd482aa5d3d99a3b1a9e18955fae4d171e..a282e2a502e13827b293ba4d1381f53fd9f35607 100644
--- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp
+++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp
@@ -2276,6 +2276,34 @@ bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
return equal(a, b);
}
+bool equalIgnoringASCIICase(const StringImpl* a, const StringImpl* b)
+{
+ if (!a || !b)
+ return !a == !b;
+ unsigned length = b->length();
+ if (a->length() != length)
+ return false;
+ if (a->is8Bit()) {
+ if (b->is8Bit())
+ return equalIgnoringASCIICase(a->characters8(), b->characters8(), length);
+ return equalIgnoringASCIICase(a->characters8(), b->characters16(), length);
+ }
+ if (b->is8Bit())
+ return equalIgnoringASCIICase(a->characters16(), b->characters8(), length);
+ return equalIgnoringASCIICase(a->characters16(), b->characters16(), length);
+}
+
+bool equalIgnoringASCIICase(const StringImpl* a, const LChar* b)
+{
+ if (!a || !b)
+ return !a == !b;
+ size_t length = strlen(reinterpret_cast<const char*>(b));
+ RELEASE_ASSERT(length <= numeric_limits<unsigned>::max());
+ if (length != a->length())
+ return false;
+ return equalSubstringIgnoringASCIICase(a, 0, b, length);
+}
+
size_t StringImpl::sizeInBytes() const
{
size_t size = length();
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698