diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
commit | 5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch) | |
tree | 8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/WebCore/css/CSSFontFaceSource.cpp | |
parent | 33b26980cb24288b5a9f2590ccf32a949281bb79 (diff) | |
download | qtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz |
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1
widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're
working on completing the entire split as part of
https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/WebCore/css/CSSFontFaceSource.cpp')
-rw-r--r-- | Source/WebCore/css/CSSFontFaceSource.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/Source/WebCore/css/CSSFontFaceSource.cpp b/Source/WebCore/css/CSSFontFaceSource.cpp index dd904d37f..5e5289f6d 100644 --- a/Source/WebCore/css/CSSFontFaceSource.cpp +++ b/Source/WebCore/css/CSSFontFaceSource.cpp @@ -33,7 +33,6 @@ #include "Document.h" #include "FontCache.h" #include "FontDescription.h" -#include "GlyphPageTreeNode.h" #include "SimpleFontData.h" #if ENABLE(SVG_FONTS) @@ -95,7 +94,7 @@ void CSSFontFaceSource::fontLoaded(CachedFont*) m_face->fontLoaded(this); } -SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector) +PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector) { // If the font hasn't loaded or an error occurred, then we've got nothing. if (!isValid()) @@ -114,11 +113,9 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 6 | fontDescription.widthVariant() << 4 | (fontDescription.textOrientation() == TextOrientationUpright ? 8 : 0) | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); - SimpleFontData*& cachedData = m_fontDataTable.add(hashKey, 0).iterator->second; - if (cachedData) - return cachedData; - - OwnPtr<SimpleFontData> fontData; + RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(hashKey, 0).iterator->value; + if (fontData) + return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. // If we are still loading, then we let the system pick a font. if (isLoaded()) { @@ -157,7 +154,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri m_svgFontFaceElement = fontFaceElement; } - fontData = adoptPtr(new SimpleFontData(SVGFontData::create(fontFaceElement), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic)); + fontData = SimpleFontData::create(SVGFontData::create(fontFaceElement), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); } } else #endif @@ -166,14 +163,14 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri if (!m_font->ensureCustomFontData()) return 0; - fontData = adoptPtr(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), - fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); + fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, + fontDescription.orientation(), fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false); } } else { #if ENABLE(SVG_FONTS) // In-Document SVG Fonts if (m_svgFontFaceElement) - fontData = adoptPtr(new SimpleFontData(SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic)); + fontData = SimpleFontData::create(SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); #endif } } else { @@ -184,15 +181,10 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri // This temporary font is not retained and should not be returned. FontCachePurgePreventer fontCachePurgePreventer; SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription); - fontData = adoptPtr(new SimpleFontData(temporaryFont->platformData(), true, true)); - } - - if (Document* document = fontSelector->document()) { - cachedData = fontData.get(); - document->registerCustomFont(fontData.release()); + fontData = SimpleFontData::create(temporaryFont->platformData(), true, true); } - return cachedData; + return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. } #if ENABLE(SVG_FONTS) |