Changeset 130105 in webkit for trunk/Source/WebCore/css/CSSFontFaceSource.cpp
- Timestamp:
- Oct 1, 2012, 5:28:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r130079 r130105 34 34 #include "FontCache.h" 35 35 #include "FontDescription.h" 36 #include "GlyphPageTreeNode.h" 36 37 #include "SimpleFontData.h" 37 38 … … 95 96 } 96 97 97 PassRefPtr<SimpleFontData>CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)98 SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector) 98 99 { 99 100 // If the font hasn't loaded or an error occurred, then we've got nothing. … … 114 115 | (fontDescription.textOrientation() == TextOrientationUpright ? 8 : 0) | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); 115 116 116 RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(hashKey, 0).iterator->second; 117 if (fontData) 118 return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. 117 SimpleFontData*& cachedData = m_fontDataTable.add(hashKey, 0).iterator->second; 118 if (cachedData) 119 return cachedData; 120 121 OwnPtr<SimpleFontData> fontData; 119 122 120 123 // If we are still loading, then we let the system pick a font. … … 155 158 } 156 159 157 fontData = SimpleFontData::create(SVGFontData::create(fontFaceElement), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);160 fontData = adoptPtr(new SimpleFontData(SVGFontData::create(fontFaceElement), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic)); 158 161 } 159 162 } else … … 164 167 return 0; 165 168 166 fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,167 fontDescription.orientation(), fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);169 fontData = adoptPtr(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), 170 fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); 168 171 } 169 172 } else { … … 171 174 // In-Document SVG Fonts 172 175 if (m_svgFontFaceElement) 173 fontData = SimpleFontData::create(SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);176 fontData = adoptPtr(new SimpleFontData(SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic)); 174 177 #endif 175 178 } … … 182 185 FontCachePurgePreventer fontCachePurgePreventer; 183 186 SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription); 184 fontData = SimpleFontData::create(temporaryFont->platformData(), true, true);187 fontData = adoptPtr(new SimpleFontData(temporaryFont->platformData(), true, true)); 185 188 } 186 189 187 if (Document* document = fontSelector->document()) 188 document->registerCustomFont(fontData);189 else190 fontData.clear();191 192 return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable.190 if (Document* document = fontSelector->document()) { 191 cachedData = fontData.get(); 192 document->registerCustomFont(fontData.release()); 193 } 194 195 return cachedData; 193 196 } 194 197
Note:
See TracChangeset
for help on using the changeset viewer.