summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSFontFaceSource.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/css/CSSFontFaceSource.cpp
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/css/CSSFontFaceSource.cpp')
-rw-r--r--Source/WebCore/css/CSSFontFaceSource.cpp28
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)