OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef GlyphPageTreeNode_h | 29 #ifndef GlyphPageTreeNode_h |
30 #define GlyphPageTreeNode_h | 30 #define GlyphPageTreeNode_h |
31 | 31 |
32 #include "platform/fonts/GlyphPage.h" | 32 #include "platform/fonts/GlyphPage.h" |
33 #include "wtf/Allocator.h" | 33 #include "wtf/Allocator.h" |
34 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
35 #include "wtf/OwnPtr.h" | |
36 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
37 #include "wtf/text/Unicode.h" | 36 #include "wtf/text/Unicode.h" |
| 37 #include <memory> |
38 #include <string.h> | 38 #include <string.h> |
39 | |
40 #include <unicode/uscript.h> | 39 #include <unicode/uscript.h> |
41 | 40 |
42 namespace blink { | 41 namespace blink { |
43 | 42 |
44 class FontData; | 43 class FontData; |
45 class SimpleFontData; | 44 class SimpleFontData; |
46 | 45 |
47 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) | 46 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) |
48 // to a GlyphPage. Level 0 (the "root") is special. There is one root | 47 // to a GlyphPage. Level 0 (the "root") is special. There is one root |
49 // GlyphPageTreeNode for each glyph page number. The roots do not have a | 48 // GlyphPageTreeNode for each glyph page number. The roots do not have a |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void initializeOverridePage(const FontData*, unsigned pageNumber); | 126 void initializeOverridePage(const FontData*, unsigned pageNumber); |
128 | 127 |
129 #ifndef NDEBUG | 128 #ifndef NDEBUG |
130 void showSubtree(); | 129 void showSubtree(); |
131 #endif | 130 #endif |
132 | 131 |
133 static HashMap<int, GlyphPageTreeNode*>* roots; | 132 static HashMap<int, GlyphPageTreeNode*>* roots; |
134 static GlyphPageTreeNode* pageZeroRoot; | 133 static GlyphPageTreeNode* pageZeroRoot; |
135 | 134 |
136 RefPtr<GlyphPage> m_page; | 135 RefPtr<GlyphPage> m_page; |
137 typedef HashMap<const FontData*, OwnPtr<GlyphPageTreeNode>> GlyphPageTreeNod
eMap; | 136 typedef HashMap<const FontData*, std::unique_ptr<GlyphPageTreeNode>> GlyphPa
geTreeNodeMap; |
138 GlyphPageTreeNodeMap m_children; | 137 GlyphPageTreeNodeMap m_children; |
139 OwnPtr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; | 138 std::unique_ptr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; |
140 }; | 139 }; |
141 | 140 |
142 class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNode
Base { | 141 class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNode
Base { |
143 public: | 142 public: |
144 GlyphPage* page(UScriptCode = USCRIPT_COMMON) final; | 143 GlyphPage* page(UScriptCode = USCRIPT_COMMON) final; |
145 | 144 |
146 private: | 145 private: |
147 friend class GlyphPageTreeNode; | 146 friend class GlyphPageTreeNode; |
148 | 147 |
149 SystemFallbackGlyphPageTreeNode(GlyphPageTreeNode* parent) : GlyphPageTreeNo
deBase(parent, true) { } | 148 SystemFallbackGlyphPageTreeNode(GlyphPageTreeNode* parent) : GlyphPageTreeNo
deBase(parent, true) { } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 inline GlyphPageTreeNodeBase* GlyphPageTreeNode::getChild(const FontData* fontDa
ta, unsigned pageNumber) | 186 inline GlyphPageTreeNodeBase* GlyphPageTreeNode::getChild(const FontData* fontDa
ta, unsigned pageNumber) |
188 { | 187 { |
189 if (fontData) | 188 if (fontData) |
190 return getNormalChild(fontData, pageNumber); | 189 return getNormalChild(fontData, pageNumber); |
191 return getSystemFallbackChild(pageNumber); | 190 return getSystemFallbackChild(pageNumber); |
192 } | 191 } |
193 | 192 |
194 } // namespace blink | 193 } // namespace blink |
195 | 194 |
196 #endif // GlyphPageTreeNode_h | 195 #endif // GlyphPageTreeNode_h |
OLD | NEW |