Changeset 178940 in webkit for trunk/Source/WebCore/css/CSSFontFaceSource.cpp
- Timestamp:
- Jan 22, 2015, 1:57:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r178292 r178940 33 33 #include "Document.h" 34 34 #include "ElementIterator.h" 35 #include "Font.h" 35 36 #include "FontCache.h" 36 37 #include "FontDescription.h" 37 #include "SimpleFontData.h"38 38 39 39 #if ENABLE(SVG_OTF_CONVERTER) … … 75 75 void CSSFontFaceSource::pruneTable() 76 76 { 77 if (m_font DataTable.isEmpty())77 if (m_fontTable.isEmpty()) 78 78 return; 79 79 80 m_font DataTable.clear();80 m_fontTable.clear(); 81 81 } 82 82 … … 102 102 } 103 103 104 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)104 RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector) 105 105 { 106 106 // If the font hasn't loaded or an error occurred, then we've got nothing. … … 113 113 #endif 114 114 ) { 115 // We're local. Just return a SimpleFontDatafrom the normal cache.115 // We're local. Just return a Font from the normal cache. 116 116 // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter. 117 117 return fontCache().fontForFamily(fontDescription, m_string, true); 118 118 } 119 119 120 // See if we have a mapping in our FontData cache.121 120 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3 122 121 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); 123 122 124 RefPtr< SimpleFontData> fontData = m_fontDataTable.add(hashKey, nullptr).iterator->value;125 if (font Data)126 return font Data.release();123 RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value; 124 if (font) 125 return font.release(); 127 126 128 127 // If we are still loading, then we let the system pick a font. … … 137 136 return nullptr; 138 137 139 font Data = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);138 font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont); 140 139 } else { 141 140 #if ENABLE(SVG_FONTS) … … 153 152 return nullptr; 154 153 std::unique_ptr<FontCustomPlatformData> customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer); 155 font Data = SimpleFontData::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);154 font = Font::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false); 156 155 #else 157 font Data = SimpleFontData::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);156 font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); 158 157 #endif 159 158 } … … 165 164 fontSelector->beginLoadingFontSoon(m_font.get()); 166 165 167 Ref< SimpleFontData> placeholderFont = fontCache().lastResortFallbackFont(fontDescription);168 Ref< SimpleFontData> placeholderFontCopyInLoadingState = SimpleFontData::create(placeholderFont->platformData(), true, true);166 Ref<Font> placeholderFont = fontCache().lastResortFallbackFont(fontDescription); 167 Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true); 169 168 return WTF::move(placeholderFontCopyInLoadingState); 170 169 } 171 170 172 return font Data.release();171 return font.release(); 173 172 } 174 173
Note:
See TracChangeset
for help on using the changeset viewer.