Chromium Code Reviews| Index: Source/wtf/text/StringImpl.cpp |
| diff --git a/Source/wtf/text/StringImpl.cpp b/Source/wtf/text/StringImpl.cpp |
| index 14fb36d6564cc40d8562c602b1b1fbdf9d4cea12..837e0d801e03d446f52e271040d153b439eb1ee7 100644 |
| --- a/Source/wtf/text/StringImpl.cpp |
| +++ b/Source/wtf/text/StringImpl.cpp |
| @@ -530,7 +530,7 @@ PassRefPtr<StringImpl> StringImpl::lower() |
| // Do a slower implementation for cases that include non-ASCII Latin-1 characters. |
| for (int32_t i = 0; i < length; ++i) |
| - data8[i] = static_cast<LChar>(Unicode::toLower(characters8()[i])); |
|
tkent
2015/05/28 00:38:26
I prefer keeping Unicode::. We have Unicode::toLo
rwlbuis
2015/05/28 23:03:07
Yes, I should not have included it. My idea was to
|
| + data8[i] = static_cast<LChar>(toLower(characters8()[i])); |
| return newImpl.release(); |
| } |
| @@ -564,12 +564,12 @@ PassRefPtr<StringImpl> StringImpl::lower() |
| RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16); |
| bool error; |
| - int32_t realLength = Unicode::toLower(data16, length, characters16(), m_length, &error); |
| + int32_t realLength = toLower(data16, length, characters16(), m_length, &error); |
| if (!error && realLength == length) |
| return newImpl.release(); |
| newImpl = createUninitialized(realLength, data16); |
| - Unicode::toLower(data16, realLength, characters16(), m_length, &error); |
| + toLower(data16, realLength, characters16(), m_length, &error); |
| if (error) |
| return this; |
| return newImpl.release(); |
| @@ -608,7 +608,7 @@ PassRefPtr<StringImpl> StringImpl::upper() |
| LChar c = characters8()[i]; |
| if (UNLIKELY(c == smallLetterSharpSCharacter)) |
| ++numberSharpSCharacters; |
| - UChar upper = static_cast<UChar>(Unicode::toUpper(c)); |
| + UChar upper = static_cast<UChar>(toUpper(c)); |
| if (UNLIKELY(upper > 0xff)) { |
| // Since this upper-cased character does not fit in an 8-bit string, we need to take the 16-bit path. |
| goto upconvert; |
| @@ -629,8 +629,9 @@ PassRefPtr<StringImpl> StringImpl::upper() |
| if (c == smallLetterSharpSCharacter) { |
| *dest++ = 'S'; |
| *dest++ = 'S'; |
| - } else |
| - *dest++ = static_cast<LChar>(Unicode::toUpper(c)); |
| + } else { |
| + *dest++ = static_cast<LChar>(toUpper(c)); |
| + } |
| } |
| return newImpl.release(); |
| @@ -655,11 +656,11 @@ upconvert: |
| // Do a slower implementation for cases that include non-ASCII characters. |
| bool error; |
| - int32_t realLength = Unicode::toUpper(data16, length, source16, m_length, &error); |
| + int32_t realLength = toUpper(data16, length, source16, m_length, &error); |
| if (!error && realLength == length) |
| return newImpl; |
| newImpl = createUninitialized(realLength, data16); |
| - Unicode::toUpper(data16, realLength, source16, m_length, &error); |
| + toUpper(data16, realLength, source16, m_length, &error); |
| if (error) |
| return this; |
| return newImpl.release(); |
| @@ -809,7 +810,7 @@ PassRefPtr<StringImpl> StringImpl::foldCase() |
| // Do a slower implementation for cases that include non-ASCII Latin-1 characters. |
| for (int32_t i = 0; i < length; ++i) |
| - data[i] = static_cast<LChar>(Unicode::toLower(characters8()[i])); |
| + data[i] = static_cast<LChar>(toLower(characters8()[i])); |
| return newImpl.release(); |
| } |
| @@ -2094,4 +2095,20 @@ size_t StringImpl::sizeInBytes() const |
| return size + sizeof(*this); |
| } |
| +UChar32 toUpper(UChar32 c, const AtomicString& localeIdentifier) |
| +{ |
| + if (!localeIdentifier.isNull()) { |
| + if (localeIdMatchesLang(localeIdentifier, "tr") || localeIdMatchesLang(localeIdentifier, "az")) { |
| + if (c == 'i') |
| + return 0x130; // Latin capital letter i with dot above |
|
tkent
2015/05/28 00:38:26
Please add latinCapitalLetterIWithDotAbove to wtf/
rwlbuis
2015/05/28 23:03:08
Done.
|
| + if (c == 0x131) // Latin small letter dotless i |
|
tkent
2015/05/28 00:38:26
Please add latinSmallLetterDotlessI to wtf/unicode
rwlbuis
2015/05/28 23:03:07
Done.
|
| + return 'I'; |
| + } else if (localeIdMatchesLang(localeIdentifier, "lt")) { |
| + // FIXME |
|
tkent
2015/05/28 00:38:26
FIXME -> TODO(rob.buis): blah blah
rwlbuis
2015/05/28 23:03:07
In this case, I don't think I want to put my name
tkent
2015/05/29 05:49:50
Please add TODO(rub.buis).
It doesn't mean you'll
|
| + } |
| + } |
| + |
| + return toUpper(c); |
| +} |
| + |
| } // namespace WTF |