[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mrobinson at webkit.org
mrobinson at webkit.org
Wed Dec 22 13:30:35 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e3e53cb0c2aaea312dfb18282f0aecd27ea76fc9
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 17 17:42:17 2010 +0000
2010-09-17 Martin Robinson <mrobinson at igalia.com>
Reviewed by Oliver Hunt.
[GTK] FontPlatformDataFreeType should use smart pointers to hold its members
https://bugs.webkit.org/show_bug.cgi?id=45917
Added support to PlatformRefPtr for handling HashTableDeletedValue.
* wtf/PlatformRefPtr.h:
(WTF::PlatformRefPtr::PlatformRefPtr): Added a constructor that takes HashTableDeletedValue.
(WTF::PlatformRefPtr::isHashTableDeletedValue): Added.
2010-09-17 Martin Robinson <mrobinson at igalia.com>
Reviewed by Oliver Hunt.
[GTK] FontPlatformDataFreeType should use smart pointers to hold its members
https://bugs.webkit.org/show_bug.cgi?id=45917
Have FontPlatformDataFreeType use smart pointers to hold its reference-counted
members. Also move the FcPattern specialization from OwnPtrCairo to PlatformRefPtrCairo
as this type is reference-counted.
No new tests as this should not introduce any functionality changes.
* platform/graphics/cairo/FontCacheFreeType.cpp:
(WebCore::FontCache::getFontDataForCharacters): Updated to reflect smart pointer changes.
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/graphics/cairo/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::FontPlatformData): Ditto.
(WebCore::FontPlatformData::operator=): Ditto.
(WebCore::FontPlatformData::~FontPlatformData): Ditto.
(WebCore::FontPlatformData::isFixedPitch): Ditto.
(WebCore::FontPlatformData::operator==): Ditto.
* platform/graphics/cairo/FontPlatformDataFreeType.h:
(WebCore::FontPlatformData::FontPlatformData): Ditto.
(WebCore::FontPlatformData::scaledFont): Ditto.
(WebCore::FontPlatformData::hash): Ditto.
(WebCore::FontPlatformData::isHashTableDeletedValue): Ditto.
* platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp:
(WebCore::GlyphPage::fill): Ditto.
* platform/graphics/cairo/OwnPtrCairo.cpp: Removed FcPattern specialization.
* platform/graphics/cairo/OwnPtrCairo.h: Ditto.
* platform/graphics/cairo/PlatformRefPtrCairo.cpp: Added FcPattern and cairo_scaled_font_t specializations.
(WTF::refPlatformPtr): Ditto.
(WTF::derefPlatformPtr): Ditto.
* platform/graphics/cairo/PlatformRefPtrCairo.h: Ditto.
* platform/graphics/cairo/SimpleFontDataCairo.cpp:
(WebCore::SimpleFontData::platformInit): Updated to reflect smart pointer changes.
(WebCore::SimpleFontData::containsCharacters): Ditto.
(WebCore::SimpleFontData::platformWidthForGlyph): Ditto.
* platform/graphics/gtk/FontGtk.cpp:
(WebCore::setPangoAttributes): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1b55290..468201a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-17 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] FontPlatformDataFreeType should use smart pointers to hold its members
+ https://bugs.webkit.org/show_bug.cgi?id=45917
+
+ Added support to PlatformRefPtr for handling HashTableDeletedValue.
+
+ * wtf/PlatformRefPtr.h:
+ (WTF::PlatformRefPtr::PlatformRefPtr): Added a constructor that takes HashTableDeletedValue.
+ (WTF::PlatformRefPtr::isHashTableDeletedValue): Added.
+
2010-09-16 Oliver Hunt <oliver at apple.com>
Reviewed by Geoffrey Garen.
diff --git a/JavaScriptCore/wtf/PlatformRefPtr.h b/JavaScriptCore/wtf/PlatformRefPtr.h
index 2d05ac9..8ac16cb 100644
--- a/JavaScriptCore/wtf/PlatformRefPtr.h
+++ b/JavaScriptCore/wtf/PlatformRefPtr.h
@@ -24,6 +24,7 @@
#define PlatformRefPtr_h
#include "AlwaysInline.h"
+#include "RefPtr.h"
#include <algorithm>
namespace WTF {
@@ -73,6 +74,10 @@ public:
derefPlatformPtr(ptr);
}
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ PlatformRefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
T* get() const { return m_ptr; }
T& operator*() const { return *m_ptr; }
ALWAYS_INLINE T* operator->() const { return m_ptr; }
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d0fe71..021dd9c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2010-09-17 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] FontPlatformDataFreeType should use smart pointers to hold its members
+ https://bugs.webkit.org/show_bug.cgi?id=45917
+
+ Have FontPlatformDataFreeType use smart pointers to hold its reference-counted
+ members. Also move the FcPattern specialization from OwnPtrCairo to PlatformRefPtrCairo
+ as this type is reference-counted.
+
+ No new tests as this should not introduce any functionality changes.
+
+ * platform/graphics/cairo/FontCacheFreeType.cpp:
+ (WebCore::FontCache::getFontDataForCharacters): Updated to reflect smart pointer changes.
+ (WebCore::FontCache::createFontPlatformData): Ditto.
+ * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
+ (WebCore::FontPlatformData::FontPlatformData): Ditto.
+ (WebCore::FontPlatformData::operator=): Ditto.
+ (WebCore::FontPlatformData::~FontPlatformData): Ditto.
+ (WebCore::FontPlatformData::isFixedPitch): Ditto.
+ (WebCore::FontPlatformData::operator==): Ditto.
+ * platform/graphics/cairo/FontPlatformDataFreeType.h:
+ (WebCore::FontPlatformData::FontPlatformData): Ditto.
+ (WebCore::FontPlatformData::scaledFont): Ditto.
+ (WebCore::FontPlatformData::hash): Ditto.
+ (WebCore::FontPlatformData::isHashTableDeletedValue): Ditto.
+ * platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp:
+ (WebCore::GlyphPage::fill): Ditto.
+ * platform/graphics/cairo/OwnPtrCairo.cpp: Removed FcPattern specialization.
+ * platform/graphics/cairo/OwnPtrCairo.h: Ditto.
+ * platform/graphics/cairo/PlatformRefPtrCairo.cpp: Added FcPattern and cairo_scaled_font_t specializations.
+ (WTF::refPlatformPtr): Ditto.
+ (WTF::derefPlatformPtr): Ditto.
+ * platform/graphics/cairo/PlatformRefPtrCairo.h: Ditto.
+ * platform/graphics/cairo/SimpleFontDataCairo.cpp:
+ (WebCore::SimpleFontData::platformInit): Updated to reflect smart pointer changes.
+ (WebCore::SimpleFontData::containsCharacters): Ditto.
+ (WebCore::SimpleFontData::platformWidthForGlyph): Ditto.
+ * platform/graphics/gtk/FontGtk.cpp:
+ (WebCore::setPangoAttributes): Ditto.
+
2010-09-14 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
index f507ad3..c09dd49 100644
--- a/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontCacheFreeType.cpp
@@ -24,6 +24,7 @@
#include "CString.h"
#include "Font.h"
#include "OwnPtrCairo.h"
+#include "PlatformRefPtrCairo.h"
#include "SimpleFontData.h"
#include <wtf/Assertions.h>
@@ -46,13 +47,13 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return 0;
if (!prim->m_fallbacks)
- prim->m_fallbacks = FcFontSort(NULL, prim->m_pattern, FcTrue, NULL, &fresult);
+ prim->m_fallbacks = FcFontSort(0, prim->m_pattern.get(), FcTrue, 0, &fresult);
FcFontSet* fs = prim->m_fallbacks;
for (int i = 0; i < fs->nfont; i++) {
- FcPattern* fin = FcFontRenderPrepare(NULL, prim->m_pattern, fs->fonts[i]);
- cairo_font_face_t* fontFace = cairo_ft_font_face_create_for_pattern(fin);
+ PlatformRefPtr<FcPattern> fin = adoptPlatformRef(FcFontRenderPrepare(0, prim->m_pattern.get(), fs->fonts[i]));
+ cairo_font_face_t* fontFace = cairo_ft_font_face_create_for_pattern(fin.get());
FontPlatformData alternateFont(fontFace, font.fontDescription().computedPixelSize(), false, false);
cairo_font_face_destroy(fontFace);
alternateFont.m_pattern = fin;
@@ -112,7 +113,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
CString familyNameString = family.string().utf8();
const char* fcfamily = familyNameString.data();
- OwnPtr<FcPattern> pattern(FcPatternCreate());
+ PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(FcPatternCreate());
if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
return 0;
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
index 1f94f5a..7968966 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
@@ -39,12 +39,10 @@
namespace WebCore {
FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName)
- : m_pattern(0)
- , m_fallbacks(0)
+ : m_fallbacks(0)
, m_size(fontDescription.computedPixelSize())
, m_syntheticBold(false)
, m_syntheticOblique(false)
- , m_scaledFont(0)
{
FontPlatformData::init();
@@ -61,14 +59,14 @@ FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const
int type = fontDescription.genericFamily();
- FcPattern* pattern = FcPatternCreate();
+ PlatformRefPtr<FcPattern> pattern = adoptPlatformRef(FcPatternCreate());
cairo_font_face_t* fontFace;
static const cairo_font_options_t* defaultOptions = cairo_font_options_create();
const cairo_font_options_t* options = NULL;
cairo_matrix_t fontMatrix;
- if (!FcPatternAddString(pattern, FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
- goto freePattern;
+ if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
+ return;
switch (type) {
case FontDescription::SerifFamily:
@@ -89,31 +87,31 @@ FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const
break;
}
- if (fcfamily && !FcPatternAddString(pattern, FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
- goto freePattern;
- if (!FcPatternAddInteger(pattern, FC_WEIGHT, fcweight))
- goto freePattern;
- if (!FcPatternAddInteger(pattern, FC_SLANT, fcslant))
- goto freePattern;
- if (!FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fcsize))
- goto freePattern;
+ if (fcfamily && !FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily)))
+ return;
+ if (!FcPatternAddInteger(pattern.get(), FC_WEIGHT, fcweight))
+ return;
+ if (!FcPatternAddInteger(pattern.get(), FC_SLANT, fcslant))
+ return;
+ if (!FcPatternAddDouble(pattern.get(), FC_PIXEL_SIZE, fcsize))
+ return;
- FcConfigSubstitute(NULL, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
+ FcConfigSubstitute(0, pattern.get(), FcMatchPattern);
+ FcDefaultSubstitute(pattern.get());
FcResult fcresult;
- m_pattern = FcFontMatch(NULL, pattern, &fcresult);
+ m_pattern = adoptPlatformRef(FcFontMatch(0, pattern.get(), &fcresult));
// FIXME: should we set some default font?
if (!m_pattern)
- goto freePattern;
- fontFace = cairo_ft_font_face_create_for_pattern(m_pattern);
+ return;
+ fontFace = cairo_ft_font_face_create_for_pattern(m_pattern.get());
cairo_matrix_t ctm;
cairo_matrix_init_scale(&fontMatrix, fontDescription.computedPixelSize(), fontDescription.computedPixelSize());
cairo_matrix_init_identity(&ctm);
#if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT)
if (GdkScreen* screen = gdk_screen_get_default())
- options = gdk_screen_get_font_options(screen);
+gdk_screen_get_font_options(screen);
#endif
// gdk_screen_get_font_options() returns NULL if no default options are
@@ -121,30 +119,23 @@ FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const
if (!options)
options = defaultOptions;
- m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
+ m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
cairo_font_face_destroy(fontFace);
-
-freePattern:
- FcPatternDestroy(pattern);
}
FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
- : m_pattern(0)
- , m_fallbacks(0)
+ : m_fallbacks(0)
, m_size(size)
, m_syntheticBold(bold)
, m_syntheticOblique(italic)
- , m_scaledFont(0)
{
}
FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic)
- : m_pattern(0)
- , m_fallbacks(0)
+ : m_fallbacks(0)
, m_size(size)
, m_syntheticBold(bold)
, m_syntheticOblique(italic)
- , m_scaledFont(0)
{
cairo_matrix_t fontMatrix;
cairo_matrix_init_scale(&fontMatrix, size, size);
@@ -163,7 +154,7 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
if (!options)
options = defaultOptions;
- m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
+ m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
}
FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
@@ -175,17 +166,7 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
m_size = other.m_size;
m_syntheticBold = other.m_syntheticBold;
m_syntheticOblique = other.m_syntheticOblique;
-
- if (other.m_scaledFont)
- cairo_scaled_font_reference(other.m_scaledFont);
- if (m_scaledFont)
- cairo_scaled_font_destroy(m_scaledFont);
m_scaledFont = other.m_scaledFont;
-
- if (other.m_pattern)
- FcPatternReference(other.m_pattern);
- if (m_pattern)
- FcPatternDestroy(m_pattern);
m_pattern = other.m_pattern;
if (m_fallbacks) {
@@ -198,9 +179,7 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
}
FontPlatformData::FontPlatformData(const FontPlatformData& other)
- : m_pattern(0)
- , m_fallbacks(0)
- , m_scaledFont(0)
+ : m_fallbacks(0)
{
*this = other;
}
@@ -220,18 +199,10 @@ bool FontPlatformData::init()
FontPlatformData::~FontPlatformData()
{
- if (m_pattern && ((FcPattern*)-1 != m_pattern)) {
- FcPatternDestroy(m_pattern);
- m_pattern = 0;
- }
-
if (m_fallbacks) {
FcFontSetDestroy(m_fallbacks);
m_fallbacks = 0;
}
-
- if (m_scaledFont)
- cairo_scaled_font_destroy(m_scaledFont);
}
bool FontPlatformData::isFixedPitch()
@@ -241,7 +212,7 @@ bool FontPlatformData::isFixedPitch()
return false;
int spacing;
- if (FcPatternGetInteger(m_pattern, FC_SPACING, 0, &spacing) == FcResultMatch)
+ if (FcPatternGetInteger(m_pattern.get(), FC_SPACING, 0, &spacing) == FcResultMatch)
return spacing == FC_MONO;
return false;
}
@@ -250,10 +221,9 @@ bool FontPlatformData::operator==(const FontPlatformData& other) const
{
if (m_pattern == other.m_pattern)
return true;
- if (m_pattern == 0 || m_pattern == reinterpret_cast<FcPattern*>(-1)
- || other.m_pattern == 0 || other.m_pattern == reinterpret_cast<FcPattern*>(-1))
+ if (!m_pattern || m_pattern.isHashTableDeletedValue() || !other.m_pattern || other.m_pattern.isHashTableDeletedValue())
return false;
- return FcPatternEqual(m_pattern, other.m_pattern);
+ return FcPatternEqual(m_pattern.get(), other.m_pattern.get());
}
#ifndef NDEBUG
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
index 20cf9cd..987a684 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
@@ -27,6 +27,8 @@
#include "FontDescription.h"
#include "GlyphBuffer.h"
+#include "HashFunctions.h"
+#include "PlatformRefPtrCairo.h"
#include <cairo-ft.h>
#include <cairo.h>
#include <fontconfig/fcfreetype.h>
@@ -37,21 +39,18 @@ namespace WebCore {
class FontPlatformData {
public:
FontPlatformData(WTF::HashTableDeletedValueType)
- : m_pattern(hashTableDeletedFontValue())
- , m_fallbacks(0)
+ : m_fallbacks(0)
, m_size(0)
, m_syntheticBold(false)
, m_syntheticOblique(false)
- , m_scaledFont(0)
+ , m_scaledFont(WTF::HashTableDeletedValue)
{ }
FontPlatformData()
- : m_pattern(0)
- , m_fallbacks(0)
+ : m_fallbacks(0)
, m_size(0)
, m_syntheticBold(false)
, m_syntheticOblique(false)
- , m_scaledFont(0)
{ }
FontPlatformData(const FontDescription&, const AtomicString& family);
@@ -68,34 +67,30 @@ public:
bool syntheticBold() const { return m_syntheticBold; }
bool syntheticOblique() const { return m_syntheticOblique; }
- cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
+ cairo_scaled_font_t* scaledFont() const { return m_scaledFont.get(); }
unsigned hash() const
{
- if (m_pattern)
- return FcPatternHash(m_pattern);
+ return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont.get());
}
bool operator==(const FontPlatformData&) const;
FontPlatformData& operator=(const FontPlatformData&);
bool isHashTableDeletedValue() const
{
- return m_pattern == hashTableDeletedFontValue();
+ return m_scaledFont.isHashTableDeletedValue();
}
#ifndef NDEBUG
String description() const;
#endif
- FcPattern* m_pattern;
+ PlatformRefPtr<FcPattern> m_pattern;
FcFontSet* m_fallbacks;
float m_size;
bool m_syntheticBold;
bool m_syntheticOblique;
- cairo_scaled_font_t* m_scaledFont;
-
-private:
- static FcPattern *hashTableDeletedFontValue() { return reinterpret_cast<FcPattern*>(-1); }
+ PlatformRefPtr<cairo_scaled_font_t> m_scaledFont;
};
}
diff --git a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
index 7c9ffe6..26da68d 100644
--- a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
@@ -42,7 +42,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
if (bufferLength > GlyphPage::size)
return false;
- FT_Face face = cairo_ft_scaled_font_lock_face(fontData->platformData().m_scaledFont);
+ FT_Face face = cairo_ft_scaled_font_lock_face(fontData->platformData().m_scaledFont.get());
if (!face)
return false;
@@ -57,7 +57,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
}
}
- cairo_ft_scaled_font_unlock_face(fontData->platformData().m_scaledFont);
+ cairo_ft_scaled_font_unlock_face(fontData->platformData().m_scaledFont.get());
return haveGlyphs;
}
diff --git a/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp b/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp
index a62c1ae..94f6809 100644
--- a/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp
+++ b/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp
@@ -30,12 +30,6 @@
namespace WTF {
#if defined(USE_FREETYPE)
-template <> void deleteOwnedPtr<FcPattern>(FcPattern* ptr)
-{
- if (ptr)
- FcPatternDestroy(ptr);
-}
-
template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet* ptr)
{
if (ptr)
diff --git a/WebCore/platform/graphics/cairo/OwnPtrCairo.h b/WebCore/platform/graphics/cairo/OwnPtrCairo.h
index 4426b97..035d80e 100644
--- a/WebCore/platform/graphics/cairo/OwnPtrCairo.h
+++ b/WebCore/platform/graphics/cairo/OwnPtrCairo.h
@@ -23,7 +23,6 @@
#include "OwnPtr.h"
#if defined(USE_FREETYPE)
-typedef struct _FcPattern FcPattern;
typedef struct _FcObjectSet FcObjectSet;
typedef struct _FcFontSet FcFontSet;
#endif
@@ -33,7 +32,6 @@ typedef struct cairo_path cairo_path_t;
namespace WTF {
#if defined(USE_FREETYPE)
-template <> void deleteOwnedPtr<FcPattern>(FcPattern*);
template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet*);
template <> void deleteOwnedPtr<FcFontSet>(FcFontSet*);
#endif
diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp
index 6870560..aa466f9 100644
--- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp
+++ b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.cpp
@@ -21,6 +21,11 @@
#include <cairo.h>
+#if defined(USE_FREETYPE)
+#include <cairo-ft.h>
+#include <fontconfig/fcfreetype.h>
+#endif
+
namespace WTF {
template <> cairo_t* refPlatformPtr(cairo_t* ptr)
@@ -49,4 +54,32 @@ template <> void derefPlatformPtr(cairo_surface_t* ptr)
cairo_surface_destroy(ptr);
}
+template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t* ptr)
+{
+ if (ptr)
+ cairo_scaled_font_reference(ptr);
+ return ptr;
+}
+
+template <> void derefPlatformPtr(cairo_scaled_font_t* ptr)
+{
+ if (ptr)
+ cairo_scaled_font_destroy(ptr);
+}
+
+#if defined(USE_FREETYPE)
+template <> FcPattern* refPlatformPtr(FcPattern* ptr)
+{
+ if (ptr)
+ FcPatternReference(ptr);
+ return ptr;
+}
+
+template <> void derefPlatformPtr(FcPattern* ptr)
+{
+ if (ptr)
+ FcPatternDestroy(ptr);
+}
+#endif
+
}
diff --git a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h
index 51d8fa9..4b45c1b 100644
--- a/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h
+++ b/WebCore/platform/graphics/cairo/PlatformRefPtrCairo.h
@@ -24,6 +24,11 @@
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
+typedef struct _cairo_scaled_font cairo_scaled_font_t;
+
+#if defined(USE_FREETYPE)
+typedef struct _FcPattern FcPattern;
+#endif
namespace WTF {
@@ -33,6 +38,14 @@ template <> void derefPlatformPtr(cairo_t* ptr);
template <> cairo_surface_t* refPlatformPtr(cairo_surface_t* ptr);
template <> void derefPlatformPtr(cairo_surface_t* ptr);
+template <> cairo_scaled_font_t* refPlatformPtr(cairo_scaled_font_t*);
+template <> void derefPlatformPtr(cairo_scaled_font_t*);
+
+#if defined(USE_FREETYPE)
+template <> FcPattern* refPlatformPtr(FcPattern*);
+template <> void derefPlatformPtr(FcPattern*);
+#endif
+
}
#endif
diff --git a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
index 0055078..fd85d6f 100644
--- a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
+++ b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
@@ -47,7 +47,7 @@ void SimpleFontData::platformInit()
{
cairo_font_extents_t font_extents;
cairo_text_extents_t text_extents;
- cairo_scaled_font_extents(m_platformData.m_scaledFont, &font_extents);
+ cairo_scaled_font_extents(m_platformData.m_scaledFont.get(), &font_extents);
m_ascent = static_cast<int>(lroundf(font_extents.ascent));
m_descent = static_cast<int>(lroundf(font_extents.descent));
m_lineSpacing = static_cast<int>(lroundf(font_extents.height));
@@ -58,9 +58,9 @@ void SimpleFontData::platformInit()
// while we figure out what's going on.
if (m_lineSpacing < m_ascent + m_descent)
m_lineSpacing = m_ascent + m_descent;
- cairo_scaled_font_text_extents(m_platformData.m_scaledFont, "x", &text_extents);
+ cairo_scaled_font_text_extents(m_platformData.m_scaledFont.get(), "x", &text_extents);
m_xHeight = text_extents.height;
- cairo_scaled_font_text_extents(m_platformData.m_scaledFont, " ", &text_extents);
+ cairo_scaled_font_text_extents(m_platformData.m_scaledFont.get(), " ", &text_extents);
m_spaceWidth = static_cast<float>(text_extents.x_advance);
m_lineGap = m_lineSpacing - m_ascent - m_descent;
m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
@@ -92,19 +92,19 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
{
- FT_Face face = cairo_ft_scaled_font_lock_face(m_platformData.m_scaledFont);
+ FT_Face face = cairo_ft_scaled_font_lock_face(m_platformData.m_scaledFont.get());
if (!face)
return false;
for (int i = 0; i < length; i++) {
if (FcFreeTypeCharIndex(face, characters[i]) == 0) {
- cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont);
+ cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont.get());
return false;
}
}
- cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont);
+ cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont.get());
return true;
}
@@ -125,10 +125,10 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
cairo_glyph_t cglyph = { glyph, 0, 0 };
cairo_text_extents_t extents;
- cairo_scaled_font_glyph_extents(m_platformData.m_scaledFont, &cglyph, 1, &extents);
+ cairo_scaled_font_glyph_extents(m_platformData.m_scaledFont.get(), &cglyph, 1, &extents);
float w = (float)m_spaceWidth;
- if (cairo_scaled_font_status(m_platformData.m_scaledFont) == CAIRO_STATUS_SUCCESS && extents.x_advance != 0)
+ if (cairo_scaled_font_status(m_platformData.m_scaledFont.get()) == CAIRO_STATUS_SUCCESS && extents.x_advance)
w = (float)extents.x_advance;
return w;
diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp
index 489bad7..27f48fc 100644
--- a/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -139,7 +139,7 @@ static void setPangoAttributes(const Font* font, const TextRun& run, PangoLayout
{
#if defined(USE_FREETYPE)
if (font->primaryFont()->platformData().m_pattern) {
- PangoFontDescription* desc = pango_fc_font_description_from_pattern(font->primaryFont()->platformData().m_pattern, FALSE);
+ PangoFontDescription* desc = pango_fc_font_description_from_pattern(font->primaryFont()->platformData().m_pattern.get(), FALSE);
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list