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

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.h

Issue 2006413002: Avoid calling lower() on inline styles in parseKeywordValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return false; 481 return false;
482 } 482 }
483 return true; 483 return true;
484 } 484 }
485 485
486 ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { retu rn equal(b, a, length); } 486 ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { retu rn equal(b, a, length); }
487 487
488 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const StringImpl*); 488 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const StringImpl*);
489 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const LChar*); 489 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const LChar*);
490 inline bool equalIgnoringCase(const LChar* a, const StringImpl* b) { return equa lIgnoringCase(b, a); } 490 inline bool equalIgnoringCase(const LChar* a, const StringImpl* b) { return equa lIgnoringCase(b, a); }
491 WTF_EXPORT bool equalIgnoringCase(const LChar*, const LChar*, unsigned); 491 WTF_EXPORT bool equalIgnoringCase(const LChar*, const LChar*, unsigned length);
492 WTF_EXPORT bool equalIgnoringCase(const UChar*, const LChar*, unsigned); 492 WTF_EXPORT bool equalIgnoringCase(const UChar*, const LChar*, unsigned length);
493 inline bool equalIgnoringCase(const UChar* a, const char* b, unsigned length) { return equalIgnoringCase(a, reinterpret_cast<const LChar*>(b), length); } 493 inline bool equalIgnoringCase(const UChar* a, const char* b, unsigned length) { return equalIgnoringCase(a, reinterpret_cast<const LChar*>(b), length); }
494 inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); } 494 inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); }
495 inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); } 495 inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
496 inline bool equalIgnoringCase(const char* a, const LChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); } 496 inline bool equalIgnoringCase(const char* a, const LChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
497 inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length) 497 inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
498 { 498 {
499 ASSERT(length >= 0); 499 ASSERT(length >= 0);
500 return !Unicode::umemcasecmp(a, b, length); 500 return !Unicode::umemcasecmp(a, b, length);
501 } 501 }
502 WTF_EXPORT bool equalIgnoringCaseNonNull(const StringImpl*, const StringImpl*); 502 WTF_EXPORT bool equalIgnoringCaseNonNull(const StringImpl*, const StringImpl*);
503 503
504 WTF_EXPORT bool equalIgnoringNullity(StringImpl*, StringImpl*); 504 WTF_EXPORT bool equalIgnoringNullity(StringImpl*, StringImpl*);
505 505
506 template<typename CharacterTypeA, typename CharacterTypeB> 506 template<typename CharacterTypeA, typename CharacterTypeB>
507 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB * b, unsigned length) 507 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB * b, unsigned length)
508 { 508 {
509 for (unsigned i = 0; i < length; ++i) { 509 for (unsigned i = 0; i < length; ++i) {
510 if (toASCIILower(a[i]) != toASCIILower(b[i])) 510 if (toASCIILower(a[i]) != toASCIILower(b[i]))
511 return false; 511 return false;
512 } 512 }
513 return true; 513 return true;
514 } 514 }
515 515
516 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const StringImpl*); 516 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const StringImpl*);
517 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const LChar*); 517 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const LChar*, unsigned length);
518 inline bool equalIgnoringASCIICase(const StringImpl* a, const char* b, unsigned length) { return equalIgnoringASCIICase(a, reinterpret_cast<const LChar*>(b), le ngth); }
519 inline bool equalIgnoringASCIICase(const StringImpl* a, const LChar* b)
520 {
521 size_t length = b ? strlen(reinterpret_cast<const char*>(b)) : 0;
522 return equalIgnoringASCIICase(a, b, length);
523 }
524 inline bool equalIgnoringASCIICase(const StringImpl* a, const char* b) { return equalIgnoringASCIICase(a, reinterpret_cast<const LChar*>(b)); }
518 525
519 WTF_EXPORT int codePointCompareIgnoringASCIICase(const StringImpl*, const LChar* ); 526 WTF_EXPORT int codePointCompareIgnoringASCIICase(const StringImpl*, const LChar* );
520 527
521 template<typename CharacterType> 528 template<typename CharacterType>
522 inline size_t find(const CharacterType* characters, unsigned length, CharacterTy pe matchCharacter, unsigned index = 0) 529 inline size_t find(const CharacterType* characters, unsigned length, CharacterTy pe matchCharacter, unsigned index = 0)
523 { 530 {
524 while (index < length) { 531 while (index < length) {
525 if (characters[index] == matchCharacter) 532 if (characters[index] == matchCharacter)
526 return index; 533 return index;
527 ++index; 534 ++index;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 769
763 using WTF::StringImpl; 770 using WTF::StringImpl;
764 using WTF::equal; 771 using WTF::equal;
765 using WTF::equalNonNull; 772 using WTF::equalNonNull;
766 using WTF::TextCaseSensitivity; 773 using WTF::TextCaseSensitivity;
767 using WTF::TextCaseSensitive; 774 using WTF::TextCaseSensitive;
768 using WTF::TextCaseASCIIInsensitive; 775 using WTF::TextCaseASCIIInsensitive;
769 using WTF::TextCaseInsensitive; 776 using WTF::TextCaseInsensitive;
770 777
771 #endif 778 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698