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