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

Side by Side Diff: third_party/WebKit/Source/platform/LayoutLocale.cpp

Issue 2753493002: Merge 3029: Avoid uloc_setKeywordValue if the locale contains "@" (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/LayoutLocaleTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/LayoutLocale.h" 5 #include "platform/LayoutLocale.h"
6 6
7 #include "platform/Language.h" 7 #include "platform/Language.h"
8 #include "platform/fonts/AcceptLanguagesResolver.h" 8 #include "platform/fonts/AcceptLanguagesResolver.h"
9 #include "platform/text/ICUError.h" 9 #include "platform/text/ICUError.h"
10 #include "platform/text/LocaleToScriptMapping.h" 10 #include "platform/text/LocaleToScriptMapping.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const LayoutLocale& locale = valueOrDefault(get(localeString)); 182 const LayoutLocale& locale = valueOrDefault(get(localeString));
183 locale.m_hyphenationComputed = true; 183 locale.m_hyphenationComputed = true;
184 locale.m_hyphenation = hyphenation; 184 locale.m_hyphenation = hyphenation;
185 } 185 }
186 186
187 AtomicString LayoutLocale::localeWithBreakKeyword( 187 AtomicString LayoutLocale::localeWithBreakKeyword(
188 LineBreakIteratorMode mode) const { 188 LineBreakIteratorMode mode) const {
189 if (m_string.isEmpty()) 189 if (m_string.isEmpty())
190 return m_string; 190 return m_string;
191 191
192 // uloc_setKeywordValue_58 has a problem to handle "@" in the original
193 // string. crbug.com/697859
194 if (m_string.contains('@'))
195 return m_string;
196
192 CString utf8Locale = m_string.utf8(); 197 CString utf8Locale = m_string.utf8();
193 Vector<char> buffer(utf8Locale.length() + 11, 0); 198 Vector<char> buffer(utf8Locale.length() + 11, 0);
194 memcpy(buffer.data(), utf8Locale.data(), utf8Locale.length()); 199 memcpy(buffer.data(), utf8Locale.data(), utf8Locale.length());
195 200
196 const char* keywordValue = nullptr; 201 const char* keywordValue = nullptr;
197 switch (mode) { 202 switch (mode) {
198 default: 203 default:
199 NOTREACHED(); 204 NOTREACHED();
200 // Fall through. 205 // Fall through.
201 case LineBreakIteratorMode::Default: 206 case LineBreakIteratorMode::Default:
(...skipping 26 matching lines...) Expand all
228 DCHECK_EQ(lengthNeeded, lengthNeeded2); 233 DCHECK_EQ(lengthNeeded, lengthNeeded2);
229 if (U_SUCCESS(status) && lengthNeeded == lengthNeeded2) 234 if (U_SUCCESS(status) && lengthNeeded == lengthNeeded2)
230 return AtomicString::fromUTF8(buffer.data(), lengthNeeded); 235 return AtomicString::fromUTF8(buffer.data(), lengthNeeded);
231 } 236 }
232 237
233 NOTREACHED(); 238 NOTREACHED();
234 return m_string; 239 return m_string;
235 } 240 }
236 241
237 } // namespace blink 242 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/LayoutLocaleTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698