| 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 28 matching lines...) Expand all Loading... |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 FontFallbackList::FontFallbackList() | 41 FontFallbackList::FontFallbackList() |
| 42 : m_pageZero(0) | 42 : m_pageZero(0) |
| 43 , m_cachedPrimarySimpleFontData(0) | 43 , m_cachedPrimarySimpleFontData(0) |
| 44 , m_fontSelector(nullptr) | 44 , m_fontSelector(nullptr) |
| 45 , m_fontSelectorVersion(0) | 45 , m_fontSelectorVersion(0) |
| 46 , m_familyIndex(0) | 46 , m_familyIndex(0) |
| 47 , m_generation(FontCache::fontCache()->generation()) | 47 , m_generation(FontCache::fontCache()->generation()) |
| 48 , m_hasLoadingFallback(false) | 48 , m_hasLoadingFallback(false) |
| 49 , m_hasCustomFont(false) |
| 49 { | 50 { |
| 50 } | 51 } |
| 51 | 52 |
| 52 void FontFallbackList::invalidate(PassRefPtrWillBeRawPtr<FontSelector> fontSelec
tor) | 53 void FontFallbackList::invalidate(PassRefPtrWillBeRawPtr<FontSelector> fontSelec
tor) |
| 53 { | 54 { |
| 54 releaseFontData(); | 55 releaseFontData(); |
| 55 m_fontList.clear(); | 56 m_fontList.clear(); |
| 56 m_pageZero = 0; | 57 m_pageZero = 0; |
| 57 m_pages.clear(); | 58 m_pages.clear(); |
| 58 m_cachedPrimarySimpleFontData = 0; | 59 m_cachedPrimarySimpleFontData = 0; |
| 59 m_familyIndex = 0; | 60 m_familyIndex = 0; |
| 60 m_hasLoadingFallback = false; | 61 m_hasLoadingFallback = false; |
| 62 m_hasCustomFont = false; |
| 61 if (m_fontSelector != fontSelector) | 63 if (m_fontSelector != fontSelector) |
| 62 m_fontSelector = fontSelector; | 64 m_fontSelector = fontSelector; |
| 63 m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0; | 65 m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0; |
| 64 m_generation = FontCache::fontCache()->generation(); | 66 m_generation = FontCache::fontCache()->generation(); |
| 65 m_cachingWordShaper.clear(); | 67 m_cachingWordShaper.clear(); |
| 66 } | 68 } |
| 67 | 69 |
| 68 void FontFallbackList::releaseFontData() | 70 void FontFallbackList::releaseFontData() |
| 69 { | 71 { |
| 70 unsigned numFonts = m_fontList.size(); | 72 unsigned numFonts = m_fontList.size(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Ask the font cache for the font data. | 206 // Ask the font cache for the font data. |
| 205 // We are obtaining this font for the first time. We keep track of the fami
lies we've looked at before | 207 // We are obtaining this font for the first time. We keep track of the fami
lies we've looked at before |
| 206 // in |m_familyIndex|, so that we never scan the same spot in the list twice
. getFontData will adjust our | 208 // in |m_familyIndex|, so that we never scan the same spot in the list twice
. getFontData will adjust our |
| 207 // |m_familyIndex| as it scans for the right font to make. | 209 // |m_familyIndex| as it scans for the right font to make. |
| 208 ASSERT(FontCache::fontCache()->generation() == m_generation); | 210 ASSERT(FontCache::fontCache()->generation() == m_generation); |
| 209 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); | 211 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); |
| 210 if (result) { | 212 if (result) { |
| 211 m_fontList.append(result); | 213 m_fontList.append(result); |
| 212 if (result->isLoadingFallback()) | 214 if (result->isLoadingFallback()) |
| 213 m_hasLoadingFallback = true; | 215 m_hasLoadingFallback = true; |
| 216 if (result->isCustomFont()) |
| 217 m_hasCustomFont = true; |
| 214 } | 218 } |
| 215 return result.get(); | 219 return result.get(); |
| 216 } | 220 } |
| 217 | 221 |
| 218 bool FontFallbackList::isValid() const | 222 bool FontFallbackList::isValid() const |
| 219 { | 223 { |
| 220 if (!m_fontSelector) | 224 if (!m_fontSelector) |
| 221 return m_fontSelectorVersion == 0; | 225 return m_fontSelectorVersion == 0; |
| 222 | 226 |
| 223 return m_fontSelector->version() == m_fontSelectorVersion; | 227 return m_fontSelector->version() == m_fontSelectorVersion; |
| 224 } | 228 } |
| 225 | 229 |
| 226 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |