| 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 PLATFORM_EXPORT Hyphenation : public RefCounted<Hyphenation> { | 17 class PLATFORM_EXPORT Hyphenation : public RefCounted<Hyphenation> { |
| 18 public: | 18 public: |
| 19 virtual ~Hyphenation() {} | 19 virtual ~Hyphenation() {} |
| 20 | 20 |
| 21 static Hyphenation* get(const AtomicString& locale); | 21 static Hyphenation* get(const AtomicString& locale); |
| 22 | 22 |
| 23 virtual size_t lastHyphenLocation(const StringView&, size_t beforeIndex) con
st = 0; | 23 virtual size_t lastHyphenLocation(const StringView&, size_t beforeIndex) con
st = 0; |
| 24 virtual Vector<size_t, 8> hyphenLocations(const StringView&, size_t minimumP
refixLength, size_t minimumSuffixLength) const; |
| 24 | 25 |
| 25 static void setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation
>); | 26 static void setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation
>); |
| 26 static void clearForTesting(); | 27 static void clearForTesting(); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 using HyphenationMap = HashMap<AtomicString, RefPtr<Hyphenation>, CaseFoldin
gHash>; | 30 using HyphenationMap = HashMap<AtomicString, RefPtr<Hyphenation>, CaseFoldin
gHash>; |
| 30 | 31 |
| 31 static HyphenationMap& getHyphenationMap(); | 32 static HyphenationMap& getHyphenationMap(); |
| 32 static PassRefPtr<Hyphenation> platformGetHyphenation(const AtomicString& lo
cale); | 33 static PassRefPtr<Hyphenation> platformGetHyphenation(const AtomicString& lo
cale); |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 } // namespace blink | 36 } // namespace blink |
| 36 | 37 |
| 37 #endif // Hyphenation_h | 38 #endif // Hyphenation_h |
| OLD | NEW |