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" |
35 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
36 #include "wtf/text/Unicode.h" | 37 #include "wtf/text/Unicode.h" |
37 #include <memory> | |
38 #include <string.h> | 38 #include <string.h> |
| 39 |
39 #include <unicode/uscript.h> | 40 #include <unicode/uscript.h> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class FontData; | 44 class FontData; |
44 class SimpleFontData; | 45 class SimpleFontData; |
45 | 46 |
46 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) | 47 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) |
47 // to a GlyphPage. Level 0 (the "root") is special. There is one root | 48 // to a GlyphPage. Level 0 (the "root") is special. There is one root |
48 // GlyphPageTreeNode for each glyph page number. The roots do not have a | 49 // 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... |
126 void initializeOverridePage(const FontData*, unsigned pageNumber); | 127 void initializeOverridePage(const FontData*, unsigned pageNumber); |
127 | 128 |
128 #ifndef NDEBUG | 129 #ifndef NDEBUG |
129 void showSubtree(); | 130 void showSubtree(); |
130 #endif | 131 #endif |
131 | 132 |
132 static HashMap<int, GlyphPageTreeNode*>* roots; | 133 static HashMap<int, GlyphPageTreeNode*>* roots; |
133 static GlyphPageTreeNode* pageZeroRoot; | 134 static GlyphPageTreeNode* pageZeroRoot; |
134 | 135 |
135 RefPtr<GlyphPage> m_page; | 136 RefPtr<GlyphPage> m_page; |
136 typedef HashMap<const FontData*, std::unique_ptr<GlyphPageTreeNode>> GlyphPa
geTreeNodeMap; | 137 typedef HashMap<const FontData*, OwnPtr<GlyphPageTreeNode>> GlyphPageTreeNod
eMap; |
137 GlyphPageTreeNodeMap m_children; | 138 GlyphPageTreeNodeMap m_children; |
138 std::unique_ptr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; | 139 OwnPtr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; |
139 }; | 140 }; |
140 | 141 |
141 class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNode
Base { | 142 class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNode
Base { |
142 public: | 143 public: |
143 GlyphPage* page(UScriptCode = USCRIPT_COMMON) final; | 144 GlyphPage* page(UScriptCode = USCRIPT_COMMON) final; |
144 | 145 |
145 private: | 146 private: |
146 friend class GlyphPageTreeNode; | 147 friend class GlyphPageTreeNode; |
147 | 148 |
148 SystemFallbackGlyphPageTreeNode(GlyphPageTreeNode* parent) : GlyphPageTreeNo
deBase(parent, true) { } | 149 SystemFallbackGlyphPageTreeNode(GlyphPageTreeNode* parent) : GlyphPageTreeNo
deBase(parent, true) { } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 inline GlyphPageTreeNodeBase* GlyphPageTreeNode::getChild(const FontData* fontDa
ta, unsigned pageNumber) | 187 inline GlyphPageTreeNodeBase* GlyphPageTreeNode::getChild(const FontData* fontDa
ta, unsigned pageNumber) |
187 { | 188 { |
188 if (fontData) | 189 if (fontData) |
189 return getNormalChild(fontData, pageNumber); | 190 return getNormalChild(fontData, pageNumber); |
190 return getSystemFallbackChild(pageNumber); | 191 return getSystemFallbackChild(pageNumber); |
191 } | 192 } |
192 | 193 |
193 } // namespace blink | 194 } // namespace blink |
194 | 195 |
195 #endif // GlyphPageTreeNode_h | 196 #endif // GlyphPageTreeNode_h |
OLD | NEW |