2010-06-15 Xan Lopez <xlopez@igalia.com>
authorxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jun 2010 19:14:38 +0000 (19:14 +0000)
committerxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jun 2010 19:14:38 +0000 (19:14 +0000)
        Reviewed by Gustavo Noronha.

        [GTK] Does not compile with -DGSEAL_ENABLE
        https://bugs.webkit.org/show_bug.cgi?id=37851

        Add GSEAL_ENABLE flag when doing debug builds.

        * GNUmakefile.am:

WebCore:

2010-06-15  Xan Lopez  <xlopez@igalia.com>

        Reviewed by Gustavo Noronha.

        [GTK] Does not compile with -DGSEAL_ENABLE
        https://bugs.webkit.org/show_bug.cgi?id=37851

        Fix compilation with GSEAL_ENABLE.

        * platform/gtk/GtkVersioning.h:
        * platform/gtk/PlatformScreenGtk.cpp:
        (WebCore::screenDepth):
        (WebCore::screenDepthPerComponent):
        * platform/gtk/PopupMenuGtk.cpp:
        (WebCore::PopupMenu::show):
        * platform/gtk/ScrollbarGtk.cpp:
        (ScrollbarGtk::detachAdjustment):
        (ScrollbarGtk::updateThumbPosition):
        (ScrollbarGtk::updateThumbProportion):
        * plugins/gtk/PluginViewGtk.cpp:
        (WebCore::PluginView::paint):
        (WebCore::PluginView::initXEvent):
        (WebCore::PluginView::platformGetValue):
        (WebCore::PluginView::platformStart):
        * plugins/gtk/gtk2xtbin.c:
        (gtk_xtbin_realize):
        (gtk_xtbin_new):
        (gtk_xtbin_set_position):
        (gtk_xtbin_unrealize):

WebKit/gtk:

2010-06-15  Xan Lopez  <xlopez@igalia.com>

        Reviewed by Gustavo Noronha.

        [GTK] Does not compile with -DGSEAL_ENABLE
        https://bugs.webkit.org/show_bug.cgi?id=37851

        Fix compilation with GSEAL_ENABLE.

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::pageRect):
        (WebKit::ChromeClient::contentsSizeChanged):
        * tests/testdomnode.c:
        (test_dom_node_insertion):
        * webkit/webkitwebview.cpp:
        (webkit_web_view_realize):
        (webkit_web_view_script_dialog):
        (webkit_web_view_drag_end):
        (webkit_web_view_init):

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

12 files changed:
ChangeLog
GNUmakefile.am
WebCore/ChangeLog
WebCore/platform/gtk/GtkVersioning.h
WebCore/platform/gtk/PlatformScreenGtk.cpp
WebCore/platform/gtk/PopupMenuGtk.cpp
WebCore/platform/gtk/ScrollbarGtk.cpp
WebCore/plugins/gtk/PluginViewGtk.cpp
WebCore/plugins/gtk/gtk2xtbin.c
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
WebKit/gtk/webkit/webkitwebview.cpp

index 6d29d703ec01cca785ada5ff96432eb59a2d88c8..d3fa785552f8fca94d5bbbfd07fb59052eb704cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-15  Xan Lopez  <xlopez@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Does not compile with -DGSEAL_ENABLE
+        https://bugs.webkit.org/show_bug.cgi?id=37851
+
+        Add GSEAL_ENABLE flag when doing debug builds.
+
+        * GNUmakefile.am:
+
 2010-06-13  Tony Chang  <tony@chromium.org>
 
         Reviewed by Darin Fisher.
index 1168782374c2b77f712eb7562f98933b63c86dd2..ca2c3bb3d60d866915db5b859e8ab661c7b5f1e5 100644 (file)
@@ -311,14 +311,14 @@ endif
 if !ENABLE_DEBUG
 global_cppflags += -DNDEBUG
 global_cflags += $(SYMBOL_VISIBILITY)
-
 else
 webcoregtk_cppflags += \
        -DG_DISABLE_DEPRECATED \
        -DGDK_PIXBUF_DISABLE_DEPRECATED \
        -DGDK_DISABLE_DEPRECATED \
        -DGTK_DISABLE_DEPRECATED \
-       -DPANGO_DISABLE_DEPRECATED
+       -DPANGO_DISABLE_DEPRECATED \
+       -DGSEAL_ENABLE
 
 # Might be useful in the future
 #      -DGDK_MULTIHEAD_SAFE \
index 5af51d14600ed2e1333e3baac4716ca1a491784d..ff936c8396ea8e0373b2de9d1667f01a0de58eb2 100644 (file)
@@ -1,3 +1,33 @@
+2010-06-15  Xan Lopez  <xlopez@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Does not compile with -DGSEAL_ENABLE
+        https://bugs.webkit.org/show_bug.cgi?id=37851
+
+        Fix compilation with GSEAL_ENABLE.
+
+        * platform/gtk/GtkVersioning.h:
+        * platform/gtk/PlatformScreenGtk.cpp:
+        (WebCore::screenDepth):
+        (WebCore::screenDepthPerComponent):
+        * platform/gtk/PopupMenuGtk.cpp:
+        (WebCore::PopupMenu::show):
+        * platform/gtk/ScrollbarGtk.cpp:
+        (ScrollbarGtk::detachAdjustment):
+        (ScrollbarGtk::updateThumbPosition):
+        (ScrollbarGtk::updateThumbProportion):
+        * plugins/gtk/PluginViewGtk.cpp:
+        (WebCore::PluginView::paint):
+        (WebCore::PluginView::initXEvent):
+        (WebCore::PluginView::platformGetValue):
+        (WebCore::PluginView::platformStart):
+        * plugins/gtk/gtk2xtbin.c:
+        (gtk_xtbin_realize):
+        (gtk_xtbin_new):
+        (gtk_xtbin_set_position):
+        (gtk_xtbin_unrealize):
+
 2010-06-15  Xan Lopez  <xlopez@igalia.com>
 
         Unreviewed build fix.
index cdd679c5e725c5e4619ec356c4c29203ed9199fa..24970d262554cac9a170113210b290c7484b7d4f 100644 (file)
 #include <gtk/gtk.h>
 
 // Macros to avoid deprecation checking churn
+#if !GTK_CHECK_VERSION(2, 21, 2)
+#define gdk_visual_get_depth(visual) (visual)->depth
+#define gdk_visual_get_bits_per_rgb(visual) (visual)->bits_per_rgb
+#define gdk_drag_context_get_selected_action(context) (context)->action
+#endif // GTK_CHECK_VERSION(2, 21, 2)
+
+#if !GTK_CHECK_VERSION(2, 20, 0)
+#define gtk_widget_set_realized(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_REALIZED)
+#define gtk_widget_set_realized(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_REALIZED)
+#endif // GTK_CHECK_VERSION(2, 20, 0)
+
 #if !GTK_CHECK_VERSION(2, 19, 0)
 #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL(widget)
 #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
 #define gtk_widget_is_sensitive(widget) GTK_WIDGET_IS_SENSITIVE(widget)
 #endif // GTK_CHECK_VERSION(2, 19, 0)
 
+#if !GTK_CHECK_VERSION(2, 18, 0)
+#define gtk_widget_set_visible(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_VISIBLE)
+#define gtk_widget_set_visible(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_VISIBLE)
+#define gtk_widget_set_window(widget, new_window) (widget)->window = (new_window)
+#define gtk_widget_set_can_focus(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_CAN_FOCUS)
+#define gtk_widget_set_can_focus(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_CAN_FOCUS)
+#endif // GTK_CHECK_VERSION(2, 18, 0)
+
 #if !GTK_CHECK_VERSION(2, 14, 0)
 #define gtk_widget_get_window(widget) (widget)->window
-#endif
+#define gtk_adjustment_get_value(adj) (adj)->value
+#define gtk_dialog_get_content_area(dialog) (dialog)->vbox
+#endif // GTK_CHECK_VERSION(2, 14, 0)
 
 #endif // GtkVersioning_h
index 0ab00a1ed81006fabf5f19754b628234e372c367..6ace728217ae97ab364ee994852b60bf02ee655f 100644 (file)
@@ -72,7 +72,7 @@ int screenDepth(Widget* widget)
     GdkVisual* visual = getVisual(widget);
     if (!visual)
         return 24;
-    return visual->depth;
+    return gdk_visual_get_depth(visual);
 }
 
 int screenDepthPerComponent(Widget* widget)
@@ -81,7 +81,7 @@ int screenDepthPerComponent(Widget* widget)
     if (!visual)
         return 8;
 
-    return visual->bits_per_rgb;
+    return gdk_visual_get_bits_per_rgb(visual);
 }
 
 bool screenIsMonochrome(Widget* widget)
index f29d51b4bc910dac4a5a5d6085712706f08a44de..bf8cfb45a3e76a56f2599011a3d7afb4d7e6b91c 100644 (file)
@@ -89,22 +89,24 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
     gtk_widget_size_request(GTK_WIDGET(m_popup.get()), &requisition);
     gtk_widget_set_size_request(GTK_WIDGET(m_popup.get()), std::max(rect.width(), requisition.width), -1);
 
-    GList* children = GTK_MENU_SHELL(m_popup.get())->children;
+    GList* children = gtk_container_get_children(GTK_CONTAINER(m_popup.get()));
+    GList* p = children;
     if (size)
         for (int i = 0; i < size; i++) {
             if (i > index)
               break;
 
-            GtkWidget* item = reinterpret_cast<GtkWidget*>(children->data);
+            GtkWidget* item = reinterpret_cast<GtkWidget*>(p->data);
             GtkRequisition itemRequisition;
             gtk_widget_get_child_requisition(item, &itemRequisition);
             m_menuPosition.setY(m_menuPosition.y() - itemRequisition.height);
 
-            children = g_list_next(children);
+            p = g_list_next(p);
         } else
             // Center vertically the empty popup in the combo box area
             m_menuPosition.setY(m_menuPosition.y() - rect.height() / 2);
 
+    g_list_free(children);
     gtk_menu_popup(m_popup.get(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 0, gtk_get_current_event_time());
 }
 
index 3d4cc4737e303f402216e1dbba59b262d68594b7..5dc4dd68d09a69bb915ffd8834e57abaf3569b88 100644 (file)
@@ -120,11 +120,15 @@ void ScrollbarGtk::detachAdjustment()
     // For the case where we only operate on the GtkAdjustment it is best to
     // reset the values so that the surrounding scrollbar gets updated, or
     // e.g. for a GtkScrolledWindow the scrollbar gets hidden.
+#if GTK_CHECK_VERSION(2, 14, 0)
+    gtk_adjustment_configure(m_adjustment, 0, 0, 0, 0, 0, 0);
+#else
     m_adjustment->lower = 0;
     m_adjustment->upper = 0;
     m_adjustment->value = 0;
     gtk_adjustment_changed(m_adjustment);
     gtk_adjustment_value_changed(m_adjustment);
+#endif
     g_object_unref(m_adjustment);
     m_adjustment = 0;
 }
@@ -158,19 +162,33 @@ void ScrollbarGtk::frameRectsChanged()
 
 void ScrollbarGtk::updateThumbPosition()
 {
-    if (m_adjustment->value != m_currentPos) {
+    if (gtk_adjustment_get_value(m_adjustment) != m_currentPos) {
+#if GTK_CHECK_VERSION(2, 14, 0)
+        gtk_adjustment_set_value(m_adjustment, m_currentPos);
+#else
         m_adjustment->value = m_currentPos;
         gtk_adjustment_value_changed(m_adjustment);
+#endif
     }
 }
 
 void ScrollbarGtk::updateThumbProportion()
 {
+#if GTK_CHECK_VERSION(2, 14, 0)
+    gtk_adjustment_configure(m_adjustment,
+                             gtk_adjustment_get_value(m_adjustment),
+                             gtk_adjustment_get_lower(m_adjustment),
+                             m_totalSize,
+                             m_lineStep,
+                             m_pageStep,
+                             m_visibleSize);
+#else
     m_adjustment->step_increment = m_lineStep;
     m_adjustment->page_increment = m_pageStep;
     m_adjustment->page_size = m_visibleSize;
     m_adjustment->upper = m_totalSize;
     gtk_adjustment_changed(m_adjustment);
+#endif
 }
 
 void ScrollbarGtk::setFrameRect(const IntRect& rect)
index 400ba6fb06262d83459d833e5aea1bf4fc7a3dd5..dca7dad71cd798793bd6eae8bc817a3c2f797acb 100644 (file)
@@ -39,6 +39,7 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
+#include "GtkVersioning.h"
 #include "HTMLNames.h"
 #include "HTMLPlugInElement.h"
 #include "HostWindow.h"
@@ -214,7 +215,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
         GdkDrawable* gdkBackingStore = 0;
         gint xoff = 0, yoff = 0;
 
-        gdk_window_get_internal_paint_info(widget->window, &gdkBackingStore, &xoff, &yoff);
+        gdk_window_get_internal_paint_info(gtk_widget_get_window(widget), &gdkBackingStore, &xoff, &yoff);
 
         GC gc = XDefaultGC(GDK_DISPLAY(), gdk_screen_get_number(gdk_screen_get_default()));
         if (gdkBackingStore) {
@@ -348,7 +349,7 @@ void PluginView::initXEvent(XEvent* xEvent)
     // but does in the case of KeyPress, KeyRelease, ButtonPress, ButtonRelease, and MotionNotify
     // events; thus, this is right:
     GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient();
-    xEvent->xany.window = widget ? GDK_WINDOW_XWINDOW(widget->window) : 0;
+    xEvent->xany.window = widget ? GDK_WINDOW_XWINDOW(gtk_widget_get_window(widget)) : 0;
 }
 
 static void setXButtonEventSpecificFields(XEvent* xEvent, MouseEvent* event, const IntPoint& postZoomPos, Frame* parentFrame)
@@ -656,11 +657,13 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re
         case NPNVnetscapeWindow: {
 #if defined(XP_UNIX)
             void* w = reinterpret_cast<void*>(value);
-            *((XID *)w) = GDK_WINDOW_XWINDOW(m_parentFrame->view()->hostWindow()->platformPageClient()->window);
+            GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient();
+            *((XID *)w) = GDK_WINDOW_XWINDOW(gtk_widget_get_window(widget));
 #endif
 #ifdef GDK_WINDOWING_WIN32
             HGDIOBJ* w = reinterpret_cast<HGDIOBJ*>(value);
-            *w = GDK_WINDOW_HWND(m_parentFrame->view()->hostWindow()->platformPageClient()->window);
+            GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient();
+            *w = GDK_WINDOW_HWND(gtk_widget_get_window(widget));
 #endif
             *result = NPERR_NO_ERROR;
             return true;
@@ -810,7 +813,7 @@ bool PluginView::platformStart()
             g_signal_connect(platformPluginWidget(), "plug-added", G_CALLBACK(plugAddedCallback), this);
             g_signal_connect(platformPluginWidget(), "plug-removed", G_CALLBACK(plugRemovedCallback), NULL);
         } else
-            setPlatformWidget(gtk_xtbin_new(pageClient->window, 0));
+            setPlatformWidget(gtk_xtbin_new(gtk_widget_get_window(pageClient), 0));
 #else
         setPlatformWidget(gtk_socket_new());
         gtk_container_add(GTK_CONTAINER(pageClient), platformPluginWidget());
@@ -831,12 +834,14 @@ bool PluginView::platformStart()
         m_npWindow.type = NPWindowTypeWindow;
 #if defined(XP_UNIX)
         if (m_needsXEmbed) {
-            gtk_widget_realize(platformPluginWidget());
+            GtkWidget* widget = platformPluginWidget();
+            gtk_widget_realize(widget);
             m_npWindow.window = (void*)gtk_socket_get_id(GTK_SOCKET(platformPluginWidget()));
-            ws->display = GDK_WINDOW_XDISPLAY(platformPluginWidget()->window);
-            ws->visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(GDK_DRAWABLE(platformPluginWidget()->window)));
-            ws->depth = gdk_drawable_get_visual(GDK_DRAWABLE(platformPluginWidget()->window))->depth;
-            ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(GDK_DRAWABLE(platformPluginWidget()->window)));
+            GdkWindow* window = gtk_widget_get_window(widget);
+            ws->display = GDK_WINDOW_XDISPLAY(window);
+            ws->visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(GDK_DRAWABLE(window)));
+            ws->depth = gdk_visual_get_depth(gdk_drawable_get_visual(GDK_DRAWABLE(window)));
+            ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(GDK_DRAWABLE(window)));
         } else {
             m_npWindow.window = (void*)GTK_XTBIN(platformPluginWidget())->xtwindow;
             ws->display = GTK_XTBIN(platformPluginWidget())->xtdisplay;
@@ -846,7 +851,7 @@ bool PluginView::platformStart()
         }
         XFlush (ws->display);
 #elif defined(GDK_WINDOWING_WIN32)
-        m_npWindow.window = (void*)GDK_WINDOW_HWND(platformPluginWidget()->window);
+        m_npWindow.window = (void*)GDK_WINDOW_HWND(gtk_widget_get_window(platformPluginWidget()));
 #endif
     } else {
         m_npWindow.type = NPWindowTypeDrawable;
@@ -856,14 +861,14 @@ bool PluginView::platformStart()
         GdkScreen* gscreen = gdk_screen_get_default();
         GdkVisual* gvisual = gdk_screen_get_system_visual(gscreen);
 
-        if (gvisual->depth == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) {
+        if (gdk_visual_get_depth(gvisual) == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) {
             getVisualAndColormap(32, &m_visual, &m_colormap);
             ws->depth = 32;
         }
 
         if (!m_visual) {
-            getVisualAndColormap(gvisual->depth, &m_visual, &m_colormap);
-            ws->depth = gvisual->depth;
+            getVisualAndColormap(gdk_visual_get_depth(gvisual), &m_visual, &m_colormap);
+            ws->depth = gdk_visual_get_depth(gvisual);
         }
 
         ws->display = GDK_DISPLAY();
index 28388cfbbb026f09f223aca9d64928c57bac2097..b7fd3f0c9ffa4171313bcfa69dd5a6ff962dc062 100644 (file)
@@ -271,6 +271,9 @@ gtk_xtbin_realize (GtkWidget *widget)
 {
   GtkXtBin     *xtbin;
   GtkAllocation allocation = { 0, 0, 200, 200 };
+#if GTK_CHECK_VERSION(2, 18, 0)
+  GtkAllocation widget_allocation;
+#endif
   gint  x, y, w, h, d; /* geometry of window */
 
 #ifdef DEBUG_XTBIN
@@ -291,8 +294,14 @@ gtk_xtbin_realize (GtkWidget *widget)
   printf("initial allocation %d %d %d %d\n", x, y, w, h);
 #endif
 
+#if GTK_CHECK_VERSION(2, 18, 0)
+  gtk_widget_get_allocation(widget, &widget_allocation);
+  xtbin->width = widget_allocation.width;
+  xtbin->height = widget_allocation.height;
+#else
   xtbin->width = widget->allocation.width;
   xtbin->height = widget->allocation.height;
+#endif
 
   /* use GtkSocket's realize */
   (*GTK_WIDGET_CLASS(parent_class)->realize)(widget);
@@ -333,7 +342,7 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f)
   xt_client_init(&(xtbin->xtclient), 
       GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()),
       GDK_COLORMAP_XCOLORMAP(gdk_rgb_get_colormap()),
-      gdk_rgb_get_visual()->depth);
+      gdk_visual_get_depth(gdk_rgb_get_visual()));
 
   if (!xtbin->xtclient.xtdisplay) {
     /* If XtOpenDisplay failed, we can't go any further.
@@ -404,7 +413,7 @@ gtk_xtbin_set_position (GtkXtBin *xtbin,
   xtbin->y = y;
 
   if (gtk_widget_get_realized (GTK_WIDGET(xtbin)))
-    gdk_window_move (GTK_WIDGET (xtbin)->window, x, y);
+    gdk_window_move (gtk_widget_get_window(GTK_WIDGET (xtbin)), x, y);
 }
 
 void
@@ -457,7 +466,7 @@ gtk_xtbin_unrealize (GtkWidget *object)
   xtbin = GTK_XTBIN(object);
   widget = GTK_WIDGET(object);
 
-  GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+  gtk_widget_set_visible(widget, FALSE);
   if (gtk_widget_get_realized (widget)) {
     xt_client_unrealize(&(xtbin->xtclient));
   }
index 9841cbad2e18ec39c15a3eae4d810cc065ede10f..8ef79175f74442093a4478dd22e239ddaacbef11 100644 (file)
@@ -1,3 +1,23 @@
+2010-06-15  Xan Lopez  <xlopez@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Does not compile with -DGSEAL_ENABLE
+        https://bugs.webkit.org/show_bug.cgi?id=37851
+
+        Fix compilation with GSEAL_ENABLE.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::pageRect):
+        (WebKit::ChromeClient::contentsSizeChanged):
+        * tests/testdomnode.c:
+        (test_dom_node_insertion):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_realize):
+        (webkit_web_view_script_dialog):
+        (webkit_web_view_drag_end):
+        (webkit_web_view_init):
+
 2010-06-14  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Unreviewed build fix.
index 575960135ef567fd970331a8b03e3cf8b7180635..b91b3491ef3d701f521bbfe484110a86cf51ac5c 100644 (file)
@@ -104,7 +104,12 @@ void ChromeClient::setWindowRect(const FloatRect& rect)
 
 FloatRect ChromeClient::pageRect()
 {
+    GtkAllocation allocation;
+#if GTK_CHECK_VERSION(2, 18, 0)
+    gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
+#else
     GtkAllocation allocation = GTK_WIDGET(m_webView)->allocation;
+#endif
     return IntRect(allocation.x, allocation.y, allocation.width, allocation.height);
 }
 
@@ -425,9 +430,15 @@ void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
     // We need to queue a resize request only if the size changed,
     // otherwise we get into an infinite loop!
     GtkWidget* widget = GTK_WIDGET(m_webView);
+    GtkRequisition requisition;
+#if GTK_CHECK_VERSION(2, 20, 0)
+    gtk_widget_get_requisition(widget, &requisition);
+#else
+    requisition = widget->requisition;
+#endif
     if (gtk_widget_get_realized(widget)
-        && (widget->requisition.height != size.height())
-        || (widget->requisition.width != size.width()))
+        && (requisition.height != size.height())
+        || (requisition.width != size.width()))
         gtk_widget_queue_resize_no_redraw(widget);
 }
 
index 6744732de57d3a0c9723e7bfb7b11a033f5c03f6..f0e484d2cc822a9e7bc82fe4a482d3a4094536dd 100644 (file)
@@ -799,17 +799,24 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus
 
 static void webkit_web_view_realize(GtkWidget* widget)
 {
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    gtk_widget_set_realized(widget, TRUE);
+
+    GtkAllocation allocation;
+#if GTK_CHECK_VERSION(2, 18, 0)
+    gtk_widget_get_allocation(widget, &allocation);
+#else
+    allocation = widget->allocation;
+#endif
 
     GdkWindowAttr attributes;
     attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
+    attributes.x = allocation.x;
+    attributes.y = allocation.y;
+    attributes.width = allocation.width;
+    attributes.height = allocation.height;
     attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.visual = gtk_widget_get_visual (widget);
-    attributes.colormap = gtk_widget_get_colormap (widget);
+    attributes.visual = gtk_widget_get_visual(widget);
+    attributes.colormap = gtk_widget_get_colormap(widget);
     attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
                             | GDK_EXPOSURE_MASK
                             | GDK_BUTTON_PRESS_MASK
@@ -823,15 +830,20 @@ static void webkit_web_view_realize(GtkWidget* widget)
                             | GDK_BUTTON3_MOTION_MASK;
 
     gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-    widget->window = gdk_window_new(gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-    gdk_window_set_user_data(widget->window, widget);
+    GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
+    gtk_widget_set_window(widget, window);
+    gdk_window_set_user_data(window, widget);
 
-    widget->style = gtk_style_attach(widget->style, widget->window);
-    gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
+#if GTK_CHECK_VERSION(2, 20, 0)
+    gtk_widget_style_attach(widget);
+#else
+    widget->style = gtk_style_attach(gtk_widget_get_style(widget), window);
+#endif
+    gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL);
 
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
     WebKitWebViewPrivate* priv = webView->priv;
-    gtk_im_context_set_client_window(priv->imContext, widget->window);
+    gtk_im_context_set_client_window(priv->imContext, window);
 }
 
 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj)
@@ -970,7 +982,7 @@ static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebF
     if (type == WEBKIT_SCRIPT_DIALOG_PROMPT) {
         entry = gtk_entry_new();
         gtk_entry_set_text(GTK_ENTRY(entry), defaultValue);
-        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), entry);
+        gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry);
         gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
         gtk_widget_show(entry);
     }
@@ -1312,7 +1324,7 @@ static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
     event->button.state = modifiers;
 
     PlatformMouseEvent platformEvent(&event->button);
-    frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(context->action));
+    frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
 
     gdk_event_free(event);
 }
@@ -2882,7 +2894,7 @@ static void webkit_web_view_init(WebKitWebView* webView)
     g_object_ref_sink(priv->horizontalAdjustment);
     g_object_ref_sink(priv->verticalAdjustment);
 
-    GTK_WIDGET_SET_FLAGS(webView, GTK_CAN_FOCUS);
+    gtk_widget_set_can_focus(GTK_WIDGET(webView), TRUE);
     priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView));
     priv->lastPopupXPosition = priv->lastPopupYPosition = -1;
     priv->editable = false;