wiki.webvm.net/ webkit gtk osx

For building under Debian? Mike’s message on the webkit-dev list.

First do not down load any of the graphics related libraries using Fink.

Follow the instructions here http://developer.imendio.com/projects/gtk-macosx/build-instructions

Next you have to upgrade the cairo version. I used git to grab the latest from opendesktop.

http://cairographics.org/download/

And you may need a full copy of IBM’s ICU

Here is my jhbuild stetup script.

svn co http://svn.gnome.org/svn/jhbuild/trunk jhbuild

Install into ~/bin:

(cd jhbuild && make -f Makefile.plain install)

Cairo git clone git://anongit.freedesktop.org/git/cairo git clone git://anongit.freedesktop.org/git/pixman

Finally you need this patch the cairo OSX port is broken so we fallback to a image buffer. A braver soul than me could push the changes to apple. Hendry ??

Index: WebKit/gtk/Api/webkitgtkpage.cpp
===================================================================
--- WebKit/gtk/Api/webkitgtkpage.cpp    (revision 27077)
+++ WebKit/gtk/Api/webkitgtkpage.cpp    (working copy)
@@ -75,8 +75,16 @@
 {
     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
     GdkRectangle clip;
+    cairo_t* cr;
     gdk_region_get_clipbox(event->region, &clip);
-    cairo_t* cr = gdk_cairo_create(event->window);
+
+//quartz backend is broken
+#if CAIRO_HAS_QUARTZ_SURFACE
+    WebKitPagePrivate* private_data = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(widget));
+    cr = cairo_create(private_data->buffer);
+#else
+    cr = gdk_cairo_create(event->window);
+#endif GraphicsContext ctx(cr);
     ctx.setGdkExposeEvent(event);
     if (frame->renderer()) {
@@ -84,6 +92,12 @@
         IntRect rect(clip.x, clip.y, clip.width, clip.height);
         frame->view()->paint(&ctx, rect);
     }
+#if CAIRO_HAS_QUARTZ_SURFACE
+    cairo_t* wcr = gdk_cairo_create(event->window);
+    cairo_set_source_surface(wcr,private_data->buffer,0,0);
+    cairo_paint(wcr);
+    cairo_destroy(wcr);
+#endif
     cairo_destroy(cr);

     return FALSE;
@@ -127,7 +141,12 @@
 static void webkit_page_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
 {
     GTK_WIDGET_CLASS(webkit_page_parent_class)->size_allocate(widget,allocation);
-
+#if CAIRO_HAS_QUARTZ_SURFACE
+    WebKitPagePrivate* private_data = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(widget));
+    if(private_data->buffer)
+        cairo_surface_destroy(private_data->buffer);
+    private_data->buffer = cairo_image_surface_create(CAIRO_FORMAT_RGB24,allocation->width,allocation->height);
+#endif
     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
     frame->view()->resize(allocation->width, allocation->height);
     frame->forceLayout();
@@ -269,6 +288,10 @@
     delete pageData->settings;
     g_object_unref(pageData->mainFrame);
     delete pageData->userAgent;
+#if CAIRO_HAS_QUARTZ_SURFACE
+    if(pageData->buffer)
+        cairo_surface_destroy(pageData->buffer);
+#endif

     G_OBJECT_CLASS(webkit_page_parent_class)->finalize(object);
 }
Index: WebKit/gtk/Api/webkitgtkprivate.h
===================================================================
--- WebKit/gtk/Api/webkitgtkprivate.h   (revision 27077)
+++ WebKit/gtk/Api/webkitgtkprivate.h   (working copy)
@@ -62,6 +62,9 @@
     #define WEBKIT_PAGE_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_PAGE, WebKitPagePrivate))
     typedef struct _WebKitPagePrivate WebKitPagePrivate;
     struct _WebKitPagePrivate {
+#if CAIRO_HAS_QUARTZ_SURFACE
+        cairo_surface_t* buffer;
+#endif
         WebCore::Page* page;
         WebCore::Settings* settings;