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

Side by Side Diff: third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp

Issue 2161683002: Add LayoutLocale class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test stability 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
« no previous file with comments | « third_party/WebKit/Source/platform/text/HyphenationTest.cpp ('k') | no next file » | 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/text/Hyphenation.h" 5 #include "platform/text/Hyphenation.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/memory_mapped_file.h" 8 #include "base/files/memory_mapped_file.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/timer/elapsed_timer.h" 10 #include "base/timer/elapsed_timer.h"
11 #include "mojo/public/cpp/system/platform_handle.h" 11 #include "mojo/public/cpp/system/platform_handle.h"
12 #include "platform/LayoutLocale.h"
12 #include "platform/text/hyphenation/HyphenatorAOSP.h" 13 #include "platform/text/hyphenation/HyphenatorAOSP.h"
13 #include "public/platform/Platform.h" 14 #include "public/platform/Platform.h"
14 #include "public/platform/ServiceRegistry.h" 15 #include "public/platform/ServiceRegistry.h"
15 #include "public/platform/modules/hyphenation/hyphenation.mojom-blink.h" 16 #include "public/platform/modules/hyphenation/hyphenation.mojom-blink.h"
16 17
17 namespace blink { 18 namespace blink {
18 19
19 using Hyphenator = android::Hyphenator; 20 using Hyphenator = android::Hyphenator;
20 21
21 class HyphenationMinikin : public Hyphenation { 22 class HyphenationMinikin : public Hyphenation {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 PassRefPtr<Hyphenation> Hyphenation::platformGetHyphenation(const AtomicString& locale) 167 PassRefPtr<Hyphenation> Hyphenation::platformGetHyphenation(const AtomicString& locale)
167 { 168 {
168 RefPtr<HyphenationMinikin> hyphenation(adoptRef(new HyphenationMinikin)); 169 RefPtr<HyphenationMinikin> hyphenation(adoptRef(new HyphenationMinikin));
169 if (hyphenation->openDictionary(locale.lowerASCII())) 170 if (hyphenation->openDictionary(locale.lowerASCII()))
170 return hyphenation.release(); 171 return hyphenation.release();
171 hyphenation.clear(); 172 hyphenation.clear();
172 173
173 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); 174 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap()));
174 const auto& it = localeFallback.find(locale); 175 const auto& it = localeFallback.find(locale);
175 if (it != localeFallback.end()) 176 if (it != localeFallback.end())
176 return get(it->value); 177 return LayoutLocale::get(it->value)->getHyphenation();
177 178
178 return nullptr; 179 return nullptr;
179 } 180 }
180 181
181 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/HyphenationTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698