| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, 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 21 matching lines...) Expand all Loading... |
| 32 #include "Font.h" | 32 #include "Font.h" |
| 33 #include "FontCache.h" | 33 #include "FontCache.h" |
| 34 #include "SegmentedFontData.h" | 34 #include "SegmentedFontData.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 FontFallbackList::FontFallbackList() | 38 FontFallbackList::FontFallbackList() |
| 39 : m_pageZero(0) | 39 : m_pageZero(0) |
| 40 , m_cachedPrimarySimpleFontData(0) | 40 , m_cachedPrimarySimpleFontData(0) |
| 41 , m_fontSelector(0) | 41 , m_fontSelector(0) |
| 42 , m_fontSelectorVersion(0) |
| 42 , m_familyIndex(0) | 43 , m_familyIndex(0) |
| 43 , m_generation(fontCache()->generation()) | 44 , m_generation(fontCache()->generation()) |
| 44 , m_pitch(UnknownPitch) | 45 , m_pitch(UnknownPitch) |
| 45 , m_loadingCustomFonts(false) | 46 , m_loadingCustomFonts(false) |
| 46 { | 47 { |
| 47 } | 48 } |
| 48 | 49 |
| 49 void FontFallbackList::invalidate(PassRefPtr<FontSelector> fontSelector) | 50 void FontFallbackList::invalidate(PassRefPtr<FontSelector> fontSelector) |
| 50 { | 51 { |
| 51 releaseFontData(); | 52 releaseFontData(); |
| 52 m_fontList.clear(); | 53 m_fontList.clear(); |
| 53 m_pageZero = 0; | 54 m_pageZero = 0; |
| 54 m_pages.clear(); | 55 m_pages.clear(); |
| 55 m_cachedPrimarySimpleFontData = 0; | 56 m_cachedPrimarySimpleFontData = 0; |
| 56 m_familyIndex = 0; | 57 m_familyIndex = 0; |
| 57 m_pitch = UnknownPitch; | 58 m_pitch = UnknownPitch; |
| 58 m_loadingCustomFonts = false; | 59 m_loadingCustomFonts = false; |
| 59 m_fontSelector = fontSelector; | 60 m_fontSelector = fontSelector; |
| 61 m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0; |
| 60 m_generation = fontCache()->generation(); | 62 m_generation = fontCache()->generation(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void FontFallbackList::releaseFontData() | 65 void FontFallbackList::releaseFontData() |
| 64 { | 66 { |
| 65 unsigned numFonts = m_fontList.size(); | 67 unsigned numFonts = m_fontList.size(); |
| 66 for (unsigned i = 0; i < numFonts; ++i) { | 68 for (unsigned i = 0; i < numFonts; ++i) { |
| 67 if (!m_fontList[i].second) { | 69 if (!m_fontList[i].second) { |
| 68 ASSERT(!m_fontList[i].first->isSegmented()); | 70 ASSERT(!m_fontList[i].first->isSegmented()); |
| 69 fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_fo
ntList[i].first)); | 71 fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_fo
ntList[i].first)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 115 |
| 114 void FontFallbackList::setPlatformFont(const FontPlatformData& platformData) | 116 void FontFallbackList::setPlatformFont(const FontPlatformData& platformData) |
| 115 { | 117 { |
| 116 m_familyIndex = cAllFamiliesScanned; | 118 m_familyIndex = cAllFamiliesScanned; |
| 117 ASSERT(fontCache()->generation() == m_generation); | 119 ASSERT(fontCache()->generation() == m_generation); |
| 118 const FontData* fontData = fontCache()->getCachedFontData(&platformData); | 120 const FontData* fontData = fontCache()->getCachedFontData(&platformData); |
| 119 m_fontList.append(pair<const FontData*, bool>(fontData, fontData->isCustomFo
nt())); | 121 m_fontList.append(pair<const FontData*, bool>(fontData, fontData->isCustomFo
nt())); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } | 124 } |
| OLD | NEW |