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:

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: http://svn.webkit.org/repository/webkit/trunk@61206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5af51d1..ff936c8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,35 @@
 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.
 
         Fix the build when WebSockets are disabled.
diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h
index cdd679c..24970d2 100644
--- a/WebCore/platform/gtk/GtkVersioning.h
+++ b/WebCore/platform/gtk/GtkVersioning.h
@@ -23,6 +23,17 @@
 #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)
@@ -31,8 +42,18 @@
 #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
diff --git a/WebCore/platform/gtk/PlatformScreenGtk.cpp b/WebCore/platform/gtk/PlatformScreenGtk.cpp
index 0ab00a1..6ace728 100644
--- a/WebCore/platform/gtk/PlatformScreenGtk.cpp
+++ b/WebCore/platform/gtk/PlatformScreenGtk.cpp
@@ -72,7 +72,7 @@
     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 @@
     if (!visual)
         return 8;
 
-    return visual->bits_per_rgb;
+    return gdk_visual_get_bits_per_rgb(visual);
 }
 
 bool screenIsMonochrome(Widget* widget)
diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp
index f29d51b..bf8cfb4 100644
--- a/WebCore/platform/gtk/PopupMenuGtk.cpp
+++ b/WebCore/platform/gtk/PopupMenuGtk.cpp
@@ -89,22 +89,24 @@
     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());
 }
 
diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp
index 3d4cc47..5dc4dd6 100644
--- a/WebCore/platform/gtk/ScrollbarGtk.cpp
+++ b/WebCore/platform/gtk/ScrollbarGtk.cpp
@@ -120,11 +120,15 @@
     // 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::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)
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index 400ba6f..dca7dad 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -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 @@
         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 @@
     // 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 @@
         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 @@
             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 @@
         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 @@
         }
         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 @@
         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();
diff --git a/WebCore/plugins/gtk/gtk2xtbin.c b/WebCore/plugins/gtk/gtk2xtbin.c
index 28388cf..b7fd3f0 100644
--- a/WebCore/plugins/gtk/gtk2xtbin.c
+++ b/WebCore/plugins/gtk/gtk2xtbin.c
@@ -271,6 +271,9 @@
 {
   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 @@
   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 @@
   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 @@
   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 @@
   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));
   }