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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "CachedFont.h" | 27 #include "CachedFont.h" |
28 | 28 |
29 #include "Cache.h" | 29 #include "Cache.h" |
30 #include "CachedResourceClient.h" | 30 #include "CachedResourceClient.h" |
31 #include "CachedResourceClientWalker.h" | 31 #include "CachedResourceClientWalker.h" |
32 #include "DOMImplementation.h" | 32 #include "DOMImplementation.h" |
33 #include "FontPlatformData.h" | 33 #include "FontPlatformData.h" |
34 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) | 34 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && PLAT
FORM(WIN_OS)) |
35 #include "FontCustomPlatformData.h" | 35 #include "FontCustomPlatformData.h" |
36 #endif | 36 #endif |
37 #include "TextResourceDecoder.h" | 37 #include "TextResourceDecoder.h" |
38 #include "loader.h" | 38 #include "loader.h" |
39 #include <wtf/Vector.h> | 39 #include <wtf/Vector.h> |
40 | 40 |
41 #if ENABLE(SVG_FONTS) | 41 #if ENABLE(SVG_FONTS) |
42 #include "HTMLNames.h" | 42 #include "HTMLNames.h" |
43 #include "NodeList.h" | 43 #include "NodeList.h" |
44 #include "SVGElement.h" | 44 #include "SVGElement.h" |
45 #include "SVGFontElement.h" | 45 #include "SVGFontElement.h" |
46 #include "SVGGElement.h" | 46 #include "SVGGElement.h" |
47 #endif | 47 #endif |
48 | 48 |
49 namespace WebCore { | 49 namespace WebCore { |
50 | 50 |
51 CachedFont::CachedFont(const String &url) | 51 CachedFont::CachedFont(const String &url) |
52 : CachedResource(url, FontResource) | 52 : CachedResource(url, FontResource) |
53 , m_fontData(0) | 53 , m_fontData(0) |
54 , m_loadInitiated(false) | 54 , m_loadInitiated(false) |
55 #if ENABLE(SVG_FONTS) | 55 #if ENABLE(SVG_FONTS) |
56 , m_isSVGFont(false) | 56 , m_isSVGFont(false) |
57 #endif | 57 #endif |
58 { | 58 { |
59 } | 59 } |
60 | 60 |
61 CachedFont::~CachedFont() | 61 CachedFont::~CachedFont() |
62 { | 62 { |
63 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) | 63 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && PLAT
FORM(WIN_OS)) |
64 delete m_fontData; | 64 delete m_fontData; |
65 #endif | 65 #endif |
66 } | 66 } |
67 | 67 |
68 void CachedFont::load(DocLoader* docLoader) | 68 void CachedFont::load(DocLoader* docLoader) |
69 { | 69 { |
70 // Don't load the file yet. Wait for an access before triggering the load. | 70 // Don't load the file yet. Wait for an access before triggering the load. |
71 m_loading = true; | 71 m_loading = true; |
72 } | 72 } |
73 | 73 |
(...skipping 19 matching lines...) Expand all Loading... |
93 void CachedFont::beginLoadIfNeeded(DocLoader* dl) | 93 void CachedFont::beginLoadIfNeeded(DocLoader* dl) |
94 { | 94 { |
95 if (!m_loadInitiated) { | 95 if (!m_loadInitiated) { |
96 m_loadInitiated = true; | 96 m_loadInitiated = true; |
97 cache()->loader()->load(dl, this, false); | 97 cache()->loader()->load(dl, this, false); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 bool CachedFont::ensureCustomFontData() | 101 bool CachedFont::ensureCustomFontData() |
102 { | 102 { |
103 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) | 103 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && PLAT
FORM(WIN_OS)) |
104 #if ENABLE(SVG_FONTS) | 104 #if ENABLE(SVG_FONTS) |
105 ASSERT(!m_isSVGFont); | 105 ASSERT(!m_isSVGFont); |
106 #endif | 106 #endif |
107 if (!m_fontData && !m_errorOccurred && !m_loading && m_data) { | 107 if (!m_fontData && !m_errorOccurred && !m_loading && m_data) { |
108 m_fontData = createFontCustomPlatformData(m_data.get()); | 108 m_fontData = createFontCustomPlatformData(m_data.get()); |
109 if (!m_fontData) | 109 if (!m_fontData) |
110 m_errorOccurred = true; | 110 m_errorOccurred = true; |
111 } | 111 } |
112 #endif | 112 #endif |
113 return m_fontData; | 113 return m_fontData; |
114 } | 114 } |
115 | 115 |
116 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b
ool italic, FontRenderingMode renderingMode) | 116 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b
ool italic, FontRenderingMode renderingMode) |
117 { | 117 { |
118 #if ENABLE(SVG_FONTS) | 118 #if ENABLE(SVG_FONTS) |
119 if (m_externalSVGDocument) | 119 if (m_externalSVGDocument) |
120 return FontPlatformData(size, bold, italic); | 120 return FontPlatformData(size, bold, italic); |
121 #endif | 121 #endif |
122 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) | 122 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && PLAT
FORM(WIN_OS)) |
123 ASSERT(m_fontData); | 123 ASSERT(m_fontData); |
124 return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, re
nderingMode); | 124 return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, re
nderingMode); |
125 #else | 125 #else |
126 return FontPlatformData(); | 126 return FontPlatformData(); |
127 #endif | 127 #endif |
128 } | 128 } |
129 | 129 |
130 #if ENABLE(SVG_FONTS) | 130 #if ENABLE(SVG_FONTS) |
131 bool CachedFont::ensureSVGFontData() | 131 bool CachedFont::ensureSVGFontData() |
132 { | 132 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 | 195 |
196 void CachedFont::error() | 196 void CachedFont::error() |
197 { | 197 { |
198 m_loading = false; | 198 m_loading = false; |
199 m_errorOccurred = true; | 199 m_errorOccurred = true; |
200 checkNotify(); | 200 checkNotify(); |
201 } | 201 } |
202 | 202 |
203 } | 203 } |
OLD | NEW |