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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/opentype/FontSettings.h

Issue 2581083003: Initial OpenType Font Variations Support (Closed)
Patch Set: Fix makeUnique syntax Created 4 years 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
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 FontSettings_h 5 #ifndef FontSettings_h
6 #define FontSettings_h 6 #define FontSettings_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/PassRefPtr.h" 10 #include "wtf/PassRefPtr.h"
11 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
12 #include "wtf/RefPtr.h" 12 #include "wtf/RefPtr.h"
13 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
14 #include "wtf/text/AtomicString.h" 14 #include "wtf/text/AtomicString.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 uint32_t atomicStringToFourByteTag(AtomicString tag);
19
18 template <typename T> 20 template <typename T>
19 class FontTagValuePair { 21 class FontTagValuePair {
20 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 22 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
21 23
22 public: 24 public:
23 FontTagValuePair(const AtomicString& tag, T value) 25 FontTagValuePair(const AtomicString& tag, T value)
24 : m_tag(tag), m_value(value){}; 26 : m_tag(tag), m_value(value){};
25 bool operator==(const FontTagValuePair& other) const { 27 bool operator==(const FontTagValuePair& other) const {
26 return m_tag == other.m_tag && m_value == other.m_value; 28 return m_tag == other.m_tag && m_value == other.m_value;
27 }; 29 };
(...skipping 16 matching lines...) Expand all
44 const T& operator[](int index) const { return m_list[index]; } 46 const T& operator[](int index) const { return m_list[index]; }
45 const T& at(size_t index) const { return m_list.at(index); } 47 const T& at(size_t index) const { return m_list.at(index); }
46 bool operator==(const FontSettings& other) const { 48 bool operator==(const FontSettings& other) const {
47 return m_list == other.m_list; 49 return m_list == other.m_list;
48 }; 50 };
49 51
50 protected: 52 protected:
51 FontSettings(){}; 53 FontSettings(){};
52 54
53 private: 55 private:
54 Vector<T> m_list; 56 Vector<T, 0> m_list;
55 }; 57 };
56 58
57 using FontFeature = FontTagValuePair<int>; 59 using FontFeature = FontTagValuePair<int>;
58 using FontVariationAxis = FontTagValuePair<float>; 60 using FontVariationAxis = FontTagValuePair<float>;
59 61
60 class PLATFORM_EXPORT FontFeatureSettings 62 class PLATFORM_EXPORT FontFeatureSettings
61 : public FontSettings<FontFeature>, 63 : public FontSettings<FontFeature>,
62 public RefCounted<FontFeatureSettings> { 64 public RefCounted<FontFeatureSettings> {
63 WTF_MAKE_NONCOPYABLE(FontFeatureSettings); 65 WTF_MAKE_NONCOPYABLE(FontFeatureSettings);
64 66
65 public: 67 public:
66 static PassRefPtr<FontFeatureSettings> create() { 68 static PassRefPtr<FontFeatureSettings> create() {
67 return adoptRef(new FontFeatureSettings()); 69 return adoptRef(new FontFeatureSettings());
68 } 70 }
69 71
70 private: 72 private:
71 FontFeatureSettings() = default; 73 FontFeatureSettings() = default;
72 }; 74 };
73 75
74 class PLATFORM_EXPORT FontVariationSettings 76 class PLATFORM_EXPORT FontVariationSettings
75 : public FontSettings<FontVariationAxis>, 77 : public FontSettings<FontVariationAxis>,
76 public RefCounted<FontVariationSettings> { 78 public RefCounted<FontVariationSettings> {
77 WTF_MAKE_NONCOPYABLE(FontVariationSettings); 79 WTF_MAKE_NONCOPYABLE(FontVariationSettings);
78 80
79 public: 81 public:
80 static PassRefPtr<FontVariationSettings> create() { 82 static PassRefPtr<FontVariationSettings> create() {
81 return adoptRef(new FontVariationSettings()); 83 return adoptRef(new FontVariationSettings());
82 } 84 }
83 85
86 unsigned hash() const;
87
84 private: 88 private:
85 FontVariationSettings() = default; 89 FontVariationSettings() = default;
86 }; 90 };
87 91
88 } // namespace blink 92 } // namespace blink
89 93
90 #endif // FontSettings_h 94 #endif // FontSettings_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698