| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |