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(); |