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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) 4 * (C) 2001 Dirk Mueller ( mueller@kde.org )
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2269
2270 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) 2270 bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
2271 { 2271 {
2272 if (!a && b && !b->length()) 2272 if (!a && b && !b->length())
2273 return true; 2273 return true;
2274 if (!b && a && !a->length()) 2274 if (!b && a && !a->length())
2275 return true; 2275 return true;
2276 return equal(a, b); 2276 return equal(a, b);
2277 } 2277 }
2278 2278
2279 bool equalIgnoringASCIICase(const StringImpl* a, const StringImpl* b)
2280 {
2281 if (!a || !b)
2282 return !a == !b;
2283 unsigned length = b->length();
2284 if (a->length() != length)
2285 return false;
2286 if (a->is8Bit()) {
2287 if (b->is8Bit())
2288 return equalIgnoringASCIICase(a->characters8(), b->characters8(), le ngth);
2289 return equalIgnoringASCIICase(a->characters8(), b->characters16(), lengt h);
2290 }
2291 if (b->is8Bit())
2292 return equalIgnoringASCIICase(a->characters16(), b->characters8(), lengt h);
2293 return equalIgnoringASCIICase(a->characters16(), b->characters16(), length);
2294 }
2295
2296 bool equalIgnoringASCIICase(const StringImpl* a, const LChar* b)
2297 {
2298 if (!a || !b)
2299 return !a == !b;
2300 size_t length = strlen(reinterpret_cast<const char*>(b));
2301 RELEASE_ASSERT(length <= numeric_limits<unsigned>::max());
2302 if (length != a->length())
2303 return false;
2304 return equalSubstringIgnoringASCIICase(a, 0, b, length);
2305 }
2306
2279 size_t StringImpl::sizeInBytes() const 2307 size_t StringImpl::sizeInBytes() const
2280 { 2308 {
2281 size_t size = length(); 2309 size_t size = length();
2282 if (!is8Bit()) 2310 if (!is8Bit())
2283 size *= 2; 2311 size *= 2;
2284 return size + sizeof(*this); 2312 return size + sizeof(*this);
2285 } 2313 }
2286 2314
2287 UChar32 toUpper(UChar32 c, const AtomicString& localeIdentifier) 2315 UChar32 toUpper(UChar32 c, const AtomicString& localeIdentifier)
2288 { 2316 {
2289 if (!localeIdentifier.isNull()) { 2317 if (!localeIdentifier.isNull()) {
2290 if (localeIdMatchesLang(localeIdentifier, "tr") || localeIdMatchesLang(l ocaleIdentifier, "az")) { 2318 if (localeIdMatchesLang(localeIdentifier, "tr") || localeIdMatchesLang(l ocaleIdentifier, "az")) {
2291 if (c == 'i') 2319 if (c == 'i')
2292 return latinCapitalLetterIWithDotAbove; 2320 return latinCapitalLetterIWithDotAbove;
2293 if (c == latinSmallLetterDotlessI) 2321 if (c == latinSmallLetterDotlessI)
2294 return 'I'; 2322 return 'I';
2295 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { 2323 } else if (localeIdMatchesLang(localeIdentifier, "lt")) {
2296 // TODO(rob.buis) implement upper-casing rules for lt 2324 // TODO(rob.buis) implement upper-casing rules for lt
2297 // like in StringImpl::upper(locale). 2325 // like in StringImpl::upper(locale).
2298 } 2326 }
2299 } 2327 }
2300 2328
2301 return toUpper(c); 2329 return toUpper(c);
2302 } 2330 }
2303 2331
2304 } // namespace WTF 2332 } // namespace WTF
OLDNEW
« 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