Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 m_generation = FontCache::fontCache()->generation(); | 64 m_generation = FontCache::fontCache()->generation(); |
| 65 m_widthCache.clear(); | 65 m_widthCache.clear(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void FontFallbackList::releaseFontData() | 68 void FontFallbackList::releaseFontData() |
| 69 { | 69 { |
| 70 unsigned numFonts = m_fontList.size(); | 70 unsigned numFonts = m_fontList.size(); |
| 71 for (unsigned i = 0; i < numFonts; ++i) { | 71 for (unsigned i = 0; i < numFonts; ++i) { |
| 72 if (!m_fontList[i]->isCustomFont()) { | 72 if (!m_fontList[i]->isCustomFont()) { |
| 73 ASSERT(!m_fontList[i]->isSegmented()); | 73 ASSERT(!m_fontList[i]->isSegmented()); |
| 74 FontCache::fontCache()->releaseFontData(static_cast<const SimpleFont Data*>(m_fontList[i].get())); | 74 FontCache::fontCache()->releaseFontData(toSimpleFontData(m_fontList[ i].get())); |
|
tkent
2014/07/17 02:29:16
DEFINE_FONT_DATA_TYPE_CASTS should take care of Re
gyuyoung-inactive
2014/07/17 04:04:14
ok, fixed.
| |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FontFallbackList::determinePitch(const FontDescription& fontDescription) co nst | 79 void FontFallbackList::determinePitch(const FontDescription& fontDescription) co nst |
| 80 { | 80 { |
| 81 for (unsigned fontIndex = 0; ; ++fontIndex) { | 81 for (unsigned fontIndex = 0; ; ++fontIndex) { |
| 82 const FontData* fontData = fontDataAt(fontDescription, fontIndex); | 82 const FontData* fontData = fontDataAt(fontDescription, fontIndex); |
| 83 if (!fontData) { | 83 if (!fontData) { |
| 84 // All fonts are custom fonts and are loading. Fallback should be va riable pitch. | 84 // All fonts are custom fonts and are loading. Fallback should be va riable pitch. |
| 85 m_pitch = VariablePitch; | 85 m_pitch = VariablePitch; |
| 86 break; | 86 break; |
| 87 } | 87 } |
| 88 | 88 |
| 89 const SimpleFontData* simpleFontData; | 89 const SimpleFontData* simpleFontData; |
| 90 if (fontData->isSegmented()) { | 90 if (fontData->isSegmented()) { |
| 91 const SegmentedFontData* segmentedFontData = toSegmentedFontData(fon tData); | 91 const SegmentedFontData* segmentedFontData = toSegmentedFontData(fon tData); |
| 92 if (segmentedFontData->numRanges() != 1 || !segmentedFontData->range At(0).isEntireRange()) { | 92 if (segmentedFontData->numRanges() != 1 || !segmentedFontData->range At(0).isEntireRange()) { |
| 93 m_pitch = VariablePitch; | 93 m_pitch = VariablePitch; |
| 94 break; | 94 break; |
| 95 } | 95 } |
| 96 simpleFontData = segmentedFontData->rangeAt(0).fontData().get(); | 96 simpleFontData = segmentedFontData->rangeAt(0).fontData().get(); |
| 97 } else { | 97 } else { |
| 98 simpleFontData = static_cast<const SimpleFontData*>(fontData); | 98 simpleFontData = toSimpleFontData(fontData); |
| 99 } | 99 } |
| 100 if (!fontData->isLoadingFallback()) { | 100 if (!fontData->isLoadingFallback()) { |
| 101 m_pitch = simpleFontData->pitch(); | 101 m_pitch = simpleFontData->pitch(); |
| 102 break; | 102 break; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool FontFallbackList::loadingCustomFonts() const | 107 bool FontFallbackList::loadingCustomFonts() const |
| 108 { | 108 { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); | 235 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); |
| 236 if (result) { | 236 if (result) { |
| 237 m_fontList.append(result); | 237 m_fontList.append(result); |
| 238 if (result->isLoadingFallback()) | 238 if (result->isLoadingFallback()) |
| 239 m_hasLoadingFallback = true; | 239 m_hasLoadingFallback = true; |
| 240 } | 240 } |
| 241 return result.get(); | 241 return result.get(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } | 244 } |
| OLD | NEW |