[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

kevino at webkit.org kevino at webkit.org
Thu Oct 29 20:42:59 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 2a6ece311bed4a08f56a4fba69699828d8e685d7
Author: kevino at webkit.org <kevino at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Oct 11 20:01:25 2009 +0000

    wx build fixes, adding bindings to include/source dirs and fixing wxMac 2.9 compilation.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49425 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9b71065..4339ef9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-11  Kevin Ollivier  <kevino at theolliviers.com>
+
+        wx build fix for wxMac 2.9, use wxGC API for measuring text.
+
+        * platform/wx/wxcode/mac/carbon/fontprops.cpp:
+        (GetTextExtent):
+
 2009-10-10  Cameron McCormack  <cam at mcc.id.au>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
index 653f142..23dea6b 100644
--- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
+++ b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
@@ -30,6 +30,7 @@
 
 #include <wx/defs.h>
 #include <wx/gdicmn.h>
+#include <wx/graphics.h>
 
 #ifdef BUILDING_ON_TIGER
 void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
@@ -91,98 +92,21 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0)
 void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height,
                             wxCoord *descent, wxCoord *externalLeading )
 {
-    ATSUStyle* ATSUIStyle;
-
-    if ( font.Ok() )
+    wxGraphicsContext * const gc = wxGraphicsContext::Create();
+    gc->SetFont(font, *wxBLACK); // colour doesn't matter but must be specified
+    struct GCTextExtent
     {
-        OSStatus status ;
-
-        status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , (ATSUStyle*) &ATSUIStyle ) ;
-
-        wxASSERT_MSG( status == noErr, wxT("couldn't create ATSU style") ) ;
-
-        // we need the scale here ...
-
-        Fixed atsuSize = IntToFixed( int( /*m_scaleY*/ 1 * font.GetPointSize()) ) ;
-        //RGBColor atsuColor = MAC_WXCOLORREF( m_textForegroundColor.GetPixel() ) ;
-        ATSUAttributeTag atsuTags[] =
-        {
-                kATSUSizeTag //,
-        //        kATSUColorTag ,
-        } ;
-        ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
-        {
-                sizeof( Fixed ) //,
-        //        sizeof( RGBColor ) ,
-        } ;
-        ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
-        {
-                &atsuSize //,
-        //        &atsuColor ,
-        } ;
-
-        status = ::ATSUSetAttributes(
-            (ATSUStyle)ATSUIStyle, sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
-            atsuTags, atsuSizes, atsuValues);
-
-        wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") ) ;
-    }
-    
-    wxCHECK_RET( ATSUIStyle != NULL, wxT("GetTextExtent - no valid font set") ) ;
-
-    OSStatus status = noErr ;
-
-    ATSUTextLayout atsuLayout ;
-    UniCharCount chars = str.length() ;
-    UniChar* ubuf = NULL ;
-
-#if SIZEOF_WCHAR_T == 4
-    wxMBConvUTF16 converter ;
-#if wxUSE_UNICODE
-    size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
-    ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
-    converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 ) ;
-#else
-    const wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ;
-    size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ;
-    ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
-    converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 ) ;
-#endif
-    chars = unicharlen / 2 ;
-#else
-#if wxUSE_UNICODE
-    ubuf = (UniChar*) str.wc_str() ;
-#else
-    wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ;
-    chars = wxWcslen( wchar.data() ) ;
-    ubuf = (UniChar*) wchar.data() ;
-#endif
-#endif
-
-    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
-        &chars , (ATSUStyle*) &ATSUIStyle , &atsuLayout ) ;
-
-    wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") );
-
-    ATSUTextMeasurement textBefore, textAfter ;
-    ATSUTextMeasurement textAscent, textDescent ;
-
-    status = ::ATSUGetUnjustifiedBounds( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-        &textBefore , &textAfter, &textAscent , &textDescent );
-
+        wxDouble width, height, descent, externalLeading;
+    } e;
+    gc->GetTextExtent(str, &e.width, &e.height, &e.descent, &e.externalLeading);
+    if ( width )
+        *width = wxCoord(e.width + .5);
     if ( height )
-        *height = FixedToInt(textAscent + textDescent) ;
+        *height = wxCoord(e.height + .5);
     if ( descent )
-        *descent = FixedToInt(textDescent) ;
+        *descent = wxCoord(e.descent + .5);
     if ( externalLeading )
-        *externalLeading = 0 ;
-    if ( width )
-        *width = FixedToInt(textAfter - textBefore) ;
-
-#if SIZEOF_WCHAR_T == 4
-    free( ubuf ) ;
-#endif
+        *externalLeading = wxCoord(e.externalLeading + .5);
 
-    ::ATSUDisposeTextLayout(atsuLayout);
-    ::ATSUDisposeStyle((ATSUStyle)ATSUIStyle);
+    delete gc;
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 807e4eb..5d9eaf6 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-11  Kevin Ollivier  <kevino at theolliviers.com>
+
+        wx build fix, add bindings to source/include dirs now that there are sources there.
+
+        * wx/build/settings.py:
+
 2009-10-09  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Brady Eidson.
diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py
index 4019273..f04630d 100644
--- a/WebKitTools/wx/build/settings.py
+++ b/WebKitTools/wx/build/settings.py
@@ -95,8 +95,9 @@ jscore_dirs = [
 ]
 
 webcore_dirs = [
-    'accessibility', 
-    'bindings/js', 
+    'accessibility',
+    'bindings',
+    'bindings/js',
     'bridge', 
     'bridge/c', 
     'css',

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list