2009-06-12 Brent Fulgham <bfulgham@webkit.org>
authorbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jun 2009 21:25:51 +0000 (21:25 +0000)
committerbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jun 2009 21:25:51 +0000 (21:25 +0000)
        Reviewed by Eric Seidel.

        https://bugs.webkit.org/show_bug.cgi?id=26353
        Corrects handling of Cairo fonts that were getting out of
        sync due to default copy construction.  Also refactors
        some incorrect platform font destruction code that belongs
        in the font object's destructor.

        * platform/graphics/win/FontPlatformData.h:
        * platform/graphics/win/FontPlatformDataCGWin.cpp:
        (WebCore::FontPlatformData::~FontPlatformData):
        * platform/graphics/win/FontPlatformDataCairoWin.cpp:
        (WebCore::FontPlatformData::platformDataInit):
        (WebCore::FontPlatformData::FontPlatformData):
        (WebCore::FontPlatformData::setFont):
        (WebCore::FontPlatformData::~FontPlatformData):
        * platform/graphics/win/FontPlatformDataWin.cpp:
        * platform/graphics/win/SimpleFontDataCGWin.cpp:
        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        * platform/graphics/win/SimpleFontDataWin.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@44628 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/config.h
WebCore/platform/graphics/win/FontPlatformData.h
WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
WebCore/platform/graphics/win/FontPlatformDataWin.cpp
WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
WebCore/platform/graphics/win/SimpleFontDataWin.cpp

index 26e77c9..9349685 100644 (file)
@@ -1,3 +1,28 @@
+2009-06-12  Brent Fulgham  <bfulgham@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26353
+        Corrects handling of Cairo fonts that were getting out of
+        sync due to default copy construction.  Also refactors
+        some incorrect platform font destruction code that belongs
+        in the font object's destructor.
+
+        * platform/graphics/win/FontPlatformData.h:
+        * platform/graphics/win/FontPlatformDataCGWin.cpp:
+        (WebCore::FontPlatformData::~FontPlatformData):
+        * platform/graphics/win/FontPlatformDataCairoWin.cpp:
+        (WebCore::FontPlatformData::platformDataInit):
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::setFont):
+        (WebCore::FontPlatformData::~FontPlatformData):
+        * platform/graphics/win/FontPlatformDataWin.cpp:
+        * platform/graphics/win/SimpleFontDataCGWin.cpp:
+        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        * platform/graphics/win/SimpleFontDataWin.cpp:
+
 2009-06-12  Peter Kasting  <pkasting@google.com>
 
         Reviewed by Eric Seidel.
index 9714643..af675aa 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <wtf/Platform.h>
 
-#if PLATFORM(WIN_OS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
+#if PLATFORM(WIN_OS) && !defined(BUILDING_WX__)
 #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
 #define JS_EXPORTDATA __declspec(dllexport)
 #else
 #endif
 
 // CURL needs winsock, so don't prevent inclusion of it
-#if !USE(CURL)
+//#if !USE(CURL)
 #ifndef _WINSOCKAPI_
 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
 #endif
-#endif
+//#endif
 
 #endif /* PLATFORM(WIN_OS) */
 
 #endif
 
 #if PLATFORM(WIN)
+#define WTF_PLATFORM_CF 1
+#if 0
 #define WTF_PLATFORM_CG 1
 #undef WTF_PLATFORM_CAIRO
 #define WTF_USE_CFNETWORK 1
+#undef WTF_USE_CURL
+#else
+#undef WTF_PLATFORM_CG
+#define WTF_PLATFORM_CAIRO 1
+#undef WTF_USE_CFNETWORK
+#define WTF_USE_CURL 1
+#endif
+#undef WTF_USE_PTHREADS
 #undef WTF_USE_WININET
-#define WTF_PLATFORM_CF 1
-#define WTF_USE_PTHREADS 0
 #endif
 
 #if PLATFORM(MAC)
index 09a8b55..f357523 100644 (file)
@@ -64,6 +64,7 @@ public:
     FontPlatformData(HFONT, CGFontRef, float size, bool bold, bool oblique, bool useGDI);
 #elif PLATFORM(CAIRO)
     FontPlatformData(cairo_font_face_t*, float size, bool bold, bool oblique);
+    FontPlatformData(const FontPlatformData&);
 #endif
     ~FontPlatformData();
 
index 59f7e5c..a92e367 100644 (file)
@@ -137,4 +137,8 @@ FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool
 {
 }
 
+FontPlatformData::~FontPlatformData()
+{
+}
+
 }
index 438d0a9..9d55d5f 100644 (file)
@@ -41,6 +41,7 @@ namespace WebCore {
 void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* faceName)
 {
     m_fontFace = cairo_win32_font_face_create_for_hfont(font);
+
     cairo_matrix_t sizeMatrix, ctm;
     cairo_matrix_init_identity(&ctm);
     cairo_matrix_init_scale(&sizeMatrix, size, size);
@@ -79,6 +80,17 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
    cairo_font_options_destroy(options);
 }
 
+FontPlatformData::FontPlatformData(const FontPlatformData& source)
+    : m_font(source.m_font)
+    , m_size(source.m_size)
+    , m_fontFace(cairo_font_face_reference(source.m_fontFace))
+    , m_scaledFont(cairo_scaled_font_reference(source.m_scaledFont))
+    , m_syntheticBold(source.m_syntheticBold)
+    , m_syntheticOblique(source.m_syntheticOblique)
+    , m_useGDI(source.m_useGDI)
+{
+}
+
 void FontPlatformData::setFont(cairo_t* cr) const
 {
     ASSERT(m_scaledFont);
@@ -86,4 +98,10 @@ void FontPlatformData::setFont(cairo_t* cr) const
     cairo_set_scaled_font(cr, m_scaledFont);
 }
 
+FontPlatformData::~FontPlatformData()
+{
+    cairo_scaled_font_destroy(m_scaledFont);
+    cairo_font_face_destroy(m_fontFace);
+}
+
 }
index 4b4df5a..fee77f4 100644 (file)
@@ -85,8 +85,4 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
 {
 }
 
-FontPlatformData::~FontPlatformData()
-{
-}
-
 }
index aaa089a..6b3a96e 100644 (file)
@@ -126,11 +126,6 @@ void SimpleFontData::platformCharWidthInit()
     }
 }
 
-void SimpleFontData::platformDestroy()
-{
-    platformCommonDestroy();
-}
-
 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     if (m_platformData.useGDI())
index 2e51621..0343007 100644 (file)
@@ -47,7 +47,6 @@ void SimpleFontData::platformInit()
     m_scriptCache = 0;
     m_scriptFontProperties = 0;
     m_isSystemFont = false;
-    m_syntheticBoldOffset = 0;
 
     m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
 
@@ -97,16 +96,6 @@ void SimpleFontData::platformCharWidthInit()
     // charwidths are set in platformInit.
 }
 
-void SimpleFontData::platformDestroy()
-{
-    cairo_font_face_destroy(m_platformData.fontFace());
-    cairo_scaled_font_destroy(m_platformData.scaledFont());
-
-    DeleteObject(m_platformData.hfont());
-
-    platformCommonDestroy();
-}
-
 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     if (m_platformData.useGDI())
index 9835e9f..d4f096d 100644 (file)
@@ -89,7 +89,7 @@ void SimpleFontData::initGDIFont()
      return;
 }
 
-void SimpleFontData::platformCommonDestroy()
+void SimpleFontData::platformDestroy()
 {
     // We don't hash this on Win32, so it's effectively owned by us.
     delete m_smallCapsFontData;