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

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

Issue 2232083002: Fix incorrect usage of StringImpl::sizeInBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size_teeee Created 4 years, 4 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 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 return length2 > 0 ? -1 : 0; 1985 return length2 > 0 ? -1 : 0;
1986 1986
1987 if (!string2) 1987 if (!string2)
1988 return length1 > 0 ? 1 : 0; 1988 return length1 > 0 ? 1 : 0;
1989 1989
1990 if (string1->is8Bit()) 1990 if (string1->is8Bit())
1991 return codePointCompareIgnoringASCIICase(length1, length2, string1->char acters8(), string2); 1991 return codePointCompareIgnoringASCIICase(length1, length2, string1->char acters8(), string2);
1992 return codePointCompareIgnoringASCIICase(length1, length2, string1->characte rs16(), string2); 1992 return codePointCompareIgnoringASCIICase(length1, length2, string1->characte rs16(), string2);
1993 } 1993 }
1994 1994
1995 size_t StringImpl::sizeInBytes() const
1996 {
1997 size_t size = length();
1998 if (!is8Bit())
1999 size *= 2;
2000 return size + sizeof(*this);
2001 }
2002
2003 UChar32 toUpper(UChar32 c, const AtomicString& localeIdentifier) 1995 UChar32 toUpper(UChar32 c, const AtomicString& localeIdentifier)
2004 { 1996 {
2005 if (!localeIdentifier.isNull()) { 1997 if (!localeIdentifier.isNull()) {
2006 if (localeIdMatchesLang(localeIdentifier, "tr") || localeIdMatchesLang(l ocaleIdentifier, "az")) { 1998 if (localeIdMatchesLang(localeIdentifier, "tr") || localeIdMatchesLang(l ocaleIdentifier, "az")) {
2007 if (c == 'i') 1999 if (c == 'i')
2008 return latinCapitalLetterIWithDotAbove; 2000 return latinCapitalLetterIWithDotAbove;
2009 if (c == latinSmallLetterDotlessI) 2001 if (c == latinSmallLetterDotlessI)
2010 return 'I'; 2002 return 'I';
2011 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { 2003 } else if (localeIdMatchesLang(localeIdentifier, "lt")) {
2012 // TODO(rob.buis) implement upper-casing rules for lt 2004 // TODO(rob.buis) implement upper-casing rules for lt
2013 // like in StringImpl::upper(locale). 2005 // like in StringImpl::upper(locale).
2014 } 2006 }
2015 } 2007 }
2016 2008
2017 return toUpper(c); 2009 return toUpper(c);
2018 } 2010 }
2019 2011
2020 } // namespace WTF 2012 } // 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