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

Side by Side Diff: third_party/WebKit/Source/platform/LayoutLocale.h

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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef LayoutLocale_h
6 #define LayoutLocale_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/text/Hyphenation.h"
10 #include "wtf/Forward.h"
11 #include "wtf/RefCounted.h"
12 #include "wtf/text/AtomicString.h"
13
14 #include <unicode/uscript.h>
15
16 struct hb_language_impl_t;
17
18 namespace blink {
19
20 class Hyphenation;
21
22 class PLATFORM_EXPORT LayoutLocale : public RefCounted<LayoutLocale> {
23 public:
24 static const LayoutLocale* get(const AtomicString& locale);
25 static const LayoutLocale& getDefault();
26 static const LayoutLocale& valueOrDefault(const LayoutLocale* locale) { retu rn locale ? *locale : getDefault(); }
27
28 const AtomicString& localeString() const { return m_string; }
29 static const AtomicString& localeString(const LayoutLocale* locale) { return locale ? locale->m_string : nullAtom; }
30 operator const AtomicString&() const { return m_string; }
31 CString ascii() const { return m_string.ascii(); }
32
33 const hb_language_impl_t* harfbuzzLanguage() const { return m_harfbuzzLangua ge; }
34 const CString& localeForSkFontMgr() const;
35 UScriptCode script() const { return m_script; }
36 UScriptCode scriptForHan() const;
37
38 Hyphenation* getHyphenation() const;
39
40 static void clearForTesting();
41 static void setHyphenationForTesting(const AtomicString&, PassRefPtr<Hyphena tion>);
42
43 private:
44 explicit LayoutLocale(const AtomicString&);
45
46 AtomicString m_string;
47 mutable CString m_stringForSkFontMgr;
48 mutable RefPtr<Hyphenation> m_hyphenation;
49
50 // hb_language_t is defined in hb.h, which not all files can include.
51 const hb_language_impl_t* m_harfbuzzLanguage;
52
53 UScriptCode m_script;
54 mutable UScriptCode m_scriptForHan;
55
56 mutable unsigned m_hyphenationComputed : 1;
57
58 static const LayoutLocale* s_default;
59 };
60
61 } // namespace blink
62
63 #endif // LayoutLocale_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | third_party/WebKit/Source/platform/LayoutLocale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698