| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (m_font) | 65 if (m_font) |
| 66 m_font->removeClient(this); | 66 m_font->removeClient(this); |
| 67 pruneTable(); | 67 pruneTable(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CSSFontFaceSource::pruneTable() | 70 void CSSFontFaceSource::pruneTable() |
| 71 { | 71 { |
| 72 if (m_fontDataTable.isEmpty()) | 72 if (m_fontDataTable.isEmpty()) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 HashMap<unsigned, SimpleFontData*>::iterator end = m_fontDataTable.end(); | |
| 76 for (HashMap<unsigned, SimpleFontData*>::iterator it = m_fontDataTable.begin
(); it != end; ++it) | |
| 77 m_face->retireCustomFont(it->second); | |
| 78 | |
| 79 m_fontDataTable.clear(); | 75 m_fontDataTable.clear(); |
| 80 } | 76 } |
| 81 | 77 |
| 82 bool CSSFontFaceSource::isLoaded() const | 78 bool CSSFontFaceSource::isLoaded() const |
| 83 { | 79 { |
| 84 if (m_font) | 80 if (m_font) |
| 85 return m_font->isLoaded(); | 81 return m_font->isLoaded(); |
| 86 return true; | 82 return true; |
| 87 } | 83 } |
| 88 | 84 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 m_loadStartTimer.startOneShot(0); | 183 m_loadStartTimer.startOneShot(0); |
| 188 | 184 |
| 189 // This temporary font is not retained and should not be returned. | 185 // This temporary font is not retained and should not be returned. |
| 190 FontCachePurgePreventer fontCachePurgePreventer; | 186 FontCachePurgePreventer fontCachePurgePreventer; |
| 191 SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFal
lbackFont(fontDescription); | 187 SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFal
lbackFont(fontDescription); |
| 192 fontData = adoptPtr(new SimpleFontData(temporaryFont->platformData(), tr
ue, true)); | 188 fontData = adoptPtr(new SimpleFontData(temporaryFont->platformData(), tr
ue, true)); |
| 193 } | 189 } |
| 194 | 190 |
| 195 SimpleFontData* fontDataRawPtr = fontData.leakPtr(); | 191 SimpleFontData* fontDataRawPtr = fontData.leakPtr(); |
| 196 m_fontDataTable.set(hashKey, fontDataRawPtr); | 192 m_fontDataTable.set(hashKey, fontDataRawPtr); |
| 193 ASSERT(fontSelector->document()); |
| 194 if (Document* doc = fontSelector->document()) |
| 195 doc->registerCustomFont(fontDataRawPtr); |
| 197 | 196 |
| 198 return fontDataRawPtr; | 197 return fontDataRawPtr; |
| 199 } | 198 } |
| 200 | 199 |
| 201 void CSSFontFaceSource::startLoadingTimerFired(Timer<WebCore::CSSFontFaceSource>
*) | 200 void CSSFontFaceSource::startLoadingTimerFired(Timer<WebCore::CSSFontFaceSource>
*) |
| 202 { | 201 { |
| 203 ASSERT(m_font); | 202 ASSERT(m_font); |
| 204 ASSERT(m_fontSelector); | 203 ASSERT(m_fontSelector); |
| 205 | 204 |
| 206 if (CachedResourceLoader* cachedResourceLoader = m_fontSelector->cachedResou
rceLoader()) | 205 if (CachedResourceLoader* cachedResourceLoader = m_fontSelector->cachedResou
rceLoader()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 220 m_svgFontFaceElement = element; | 219 m_svgFontFaceElement = element; |
| 221 } | 220 } |
| 222 | 221 |
| 223 bool CSSFontFaceSource::isSVGFontFaceSource() const | 222 bool CSSFontFaceSource::isSVGFontFaceSource() const |
| 224 { | 223 { |
| 225 return m_svgFontFaceElement || m_hasExternalSVGFont; | 224 return m_svgFontFaceElement || m_hasExternalSVGFont; |
| 226 } | 225 } |
| 227 #endif | 226 #endif |
| 228 | 227 |
| 229 } | 228 } |
| OLD | NEW |