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 Hyphenation_h | 5 #ifndef Hyphenation_h |
6 #define Hyphenation_h | 6 #define Hyphenation_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Forward.h" | 9 #include "wtf/Forward.h" |
10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 #include "wtf/text/AtomicStringHash.h" | 12 #include "wtf/text/AtomicStringHash.h" |
13 #include "wtf/text/StringHash.h" | 13 #include "wtf/text/StringHash.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class StringView; | |
18 | |
19 class PLATFORM_EXPORT Hyphenation : public RefCounted<Hyphenation> { | 17 class PLATFORM_EXPORT Hyphenation : public RefCounted<Hyphenation> { |
20 public: | 18 public: |
21 virtual ~Hyphenation() {} | 19 virtual ~Hyphenation() {} |
22 | 20 |
23 static Hyphenation* get(const AtomicString& locale); | 21 static Hyphenation* get(const AtomicString& locale); |
24 | 22 |
25 virtual size_t lastHyphenLocation(const StringView&, size_t beforeIndex, con
st AtomicString& locale) const = 0; | 23 virtual size_t lastHyphenLocation(const StringView&, size_t beforeIndex) con
st = 0; |
26 | 24 |
27 static void setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation
>); | 25 static void setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation
>); |
28 static void clearForTesting(); | 26 static void clearForTesting(); |
29 | 27 |
30 private: | 28 private: |
31 using HyphenationMap = HashMap<AtomicString, RefPtr<Hyphenation>, CaseFoldin
gHash>; | 29 using HyphenationMap = HashMap<AtomicString, RefPtr<Hyphenation>, CaseFoldin
gHash>; |
32 | 30 |
33 static HyphenationMap& getHyphenationMap(); | 31 static HyphenationMap& getHyphenationMap(); |
34 static PassRefPtr<Hyphenation> platformGetHyphenation(const AtomicString& lo
cale); | 32 static PassRefPtr<Hyphenation> platformGetHyphenation(const AtomicString& lo
cale); |
35 }; | 33 }; |
36 | 34 |
37 } // namespace blink | 35 } // namespace blink |
38 | 36 |
39 #endif // Hyphenation_h | 37 #endif // Hyphenation_h |
OLD | NEW |