| 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 #ifndef LayoutLocale_h | 5 #ifndef LayoutLocale_h |
| 6 #define LayoutLocale_h | 6 #define LayoutLocale_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/text/Hyphenation.h" | 9 #include "platform/text/Hyphenation.h" |
| 10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
| 11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
| 12 #include "wtf/text/AtomicString.h" | 12 #include "wtf/text/AtomicString.h" |
| 13 | 13 |
| 14 #include <unicode/uscript.h> | 14 #include <unicode/uscript.h> |
| 15 | 15 |
| 16 struct hb_language_impl_t; | 16 struct hb_language_impl_t; |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class Hyphenation; | 20 class Hyphenation; |
| 21 | 21 |
| 22 enum class LineBreakIteratorMode { Default, Normal, Strict, Loose }; |
| 23 |
| 22 class PLATFORM_EXPORT LayoutLocale : public RefCounted<LayoutLocale> { | 24 class PLATFORM_EXPORT LayoutLocale : public RefCounted<LayoutLocale> { |
| 23 public: | 25 public: |
| 24 static const LayoutLocale* get(const AtomicString& locale); | 26 static const LayoutLocale* get(const AtomicString& locale); |
| 25 static const LayoutLocale& getDefault(); | 27 static const LayoutLocale& getDefault(); |
| 26 static const LayoutLocale& getSystem(); | 28 static const LayoutLocale& getSystem(); |
| 27 static const LayoutLocale& valueOrDefault(const LayoutLocale* locale) { | 29 static const LayoutLocale& valueOrDefault(const LayoutLocale* locale) { |
| 28 return locale ? *locale : getDefault(); | 30 return locale ? *locale : getDefault(); |
| 29 } | 31 } |
| 30 | 32 |
| 31 bool operator==(const LayoutLocale& other) const { | 33 bool operator==(const LayoutLocale& other) const { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 | 52 |
| 51 // Disambiguation of the Unified Han Ideographs. | 53 // Disambiguation of the Unified Han Ideographs. |
| 52 UScriptCode scriptForHan() const; | 54 UScriptCode scriptForHan() const; |
| 53 bool hasScriptForHan() const; | 55 bool hasScriptForHan() const; |
| 54 static const LayoutLocale* localeForHan(const LayoutLocale*); | 56 static const LayoutLocale* localeForHan(const LayoutLocale*); |
| 55 static void invalidateLocaleForHan() { s_defaultForHanComputed = false; } | 57 static void invalidateLocaleForHan() { s_defaultForHanComputed = false; } |
| 56 const char* localeForHanForSkFontMgr() const; | 58 const char* localeForHanForSkFontMgr() const; |
| 57 | 59 |
| 58 Hyphenation* getHyphenation() const; | 60 Hyphenation* getHyphenation() const; |
| 59 | 61 |
| 62 AtomicString localeWithBreakKeyword(LineBreakIteratorMode) const; |
| 63 |
| 60 static PassRefPtr<LayoutLocale> createForTesting(const AtomicString&); | 64 static PassRefPtr<LayoutLocale> createForTesting(const AtomicString&); |
| 61 static void clearForTesting(); | 65 static void clearForTesting(); |
| 62 static void setHyphenationForTesting(const AtomicString&, | 66 static void setHyphenationForTesting(const AtomicString&, |
| 63 PassRefPtr<Hyphenation>); | 67 PassRefPtr<Hyphenation>); |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 explicit LayoutLocale(const AtomicString&); | 70 explicit LayoutLocale(const AtomicString&); |
| 67 | 71 |
| 68 void computeScriptForHan() const; | 72 void computeScriptForHan() const; |
| 69 static void computeLocaleForHan(); | 73 static void computeLocaleForHan(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 83 | 87 |
| 84 static const LayoutLocale* s_default; | 88 static const LayoutLocale* s_default; |
| 85 static const LayoutLocale* s_system; | 89 static const LayoutLocale* s_system; |
| 86 static const LayoutLocale* s_defaultForHan; | 90 static const LayoutLocale* s_defaultForHan; |
| 87 static bool s_defaultForHanComputed; | 91 static bool s_defaultForHanComputed; |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 } // namespace blink | 94 } // namespace blink |
| 91 | 95 |
| 92 #endif // LayoutLocale_h | 96 #endif // LayoutLocale_h |
| OLD | NEW |