Changeset 195567 in webkit for trunk/Source/WebCore/css/CSSFontFaceSource.cpp
- Timestamp:
- Jan 25, 2016, 4:35:17 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r195523 r195567 67 67 if (m_font) 68 68 m_font->removeClient(this); 69 pruneTable();70 }71 72 void CSSFontFaceSource::pruneTable()73 {74 if (m_fontTable.isEmpty())75 return;76 77 m_fontTable.clear();78 69 } 79 70 … … 87 78 void CSSFontFaceSource::fontLoaded(CachedFont*) 88 79 { 89 pruneTable();90 80 if (m_face) 91 81 m_face->fontLoaded(this); … … 108 98 } 109 99 110 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3111 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);112 113 RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value;114 if (font)115 return font.release();116 117 100 if (!m_font || m_font->isLoaded()) { 118 101 if (m_font) { … … 120 103 return nullptr; 121 104 122 font =m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);105 return m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings); 123 106 } else { 124 107 #if ENABLE(SVG_FONTS) … … 138 121 if (!customPlatformData) 139 122 return nullptr; 140 font =Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);123 return Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false); 141 124 #else 142 font =Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);125 return Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); 143 126 #endif 144 127 } 145 128 #endif 129 return nullptr; 146 130 } 147 131 } else { … … 150 134 fontSelector->beginLoadingFontSoon(m_font.get()); 151 135 152 Ref<Font> placeholderFont = FontCache::singleton().lastResortFallbackFont(fontDescription); 153 Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true); 154 return WTFMove(placeholderFontCopyInLoadingState); 136 return Font::create(FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), true, true); 155 137 } 156 157 return font.release();158 138 } 159 139
Note:
See TracChangeset
for help on using the changeset viewer.