2009-03-04 Xan Lopez <xan@gnome.org>
authorxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 19:06:19 +0000 (19:06 +0000)
committerxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 19:06:19 +0000 (19:06 +0000)
        Reviewed by Holger Freyther.

        https://bugs.webkit.org/show_bug.cgi?id=24358
        [GTK] Scrollbars not clipped correctly

        Move Widget::paint to ScrollbarGtk::paint, since it's scrollbar
        specific and it's our only Widget anyway.

        * platform/gtk/ScrollbarGtk.cpp:
        (ScrollbarGtk::paint):
        * platform/gtk/ScrollbarGtk.h:
        * platform/gtk/WidgetGtk.cpp:

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

WebCore/ChangeLog
WebCore/platform/gtk/ScrollbarGtk.cpp
WebCore/platform/gtk/ScrollbarGtk.h
WebCore/platform/gtk/WidgetGtk.cpp

index 5e29b4b1fb69289d1b2b1b04902d54a9fdfabed9..5b3a1159a422b8eb6c9dc11a7aef157b8117b09d 100644 (file)
@@ -1,3 +1,18 @@
+2009-03-04  Xan Lopez  <xan@gnome.org>
+
+        Reviewed by Holger Freyther.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24358
+        [GTK] Scrollbars not clipped correctly
+
+        Move Widget::paint to ScrollbarGtk::paint, since it's scrollbar
+        specific and it's our only Widget anyway.
+
+        * platform/gtk/ScrollbarGtk.cpp:
+        (ScrollbarGtk::paint):
+        * platform/gtk/ScrollbarGtk.h:
+        * platform/gtk/WidgetGtk.cpp:
+
 2009-03-04  Xan Lopez  <xan@gnome.org>
 
         Reviewed by Holger Freyther.
index 43106bb60f1ac5a44a834df1657aa6ffcb48065a..073250eab9862b3a2a503b4b557c848a3d4d14e8 100644 (file)
@@ -130,5 +130,43 @@ void ScrollbarGtk::setEnabled(bool shouldEnable)
         gtk_widget_set_sensitive(platformWidget(), shouldEnable);
 }
 
+/*
+ * Strategy to painting a Widget:
+ *  1.) do not paint if there is no GtkWidget set
+ *  2.) We assume that GTK_NO_WINDOW is set and that frameRectsChanged positioned
+ *      the widget correctly. ATM we do not honor the GraphicsContext translation.
+ */
+void ScrollbarGtk::paint(GraphicsContext* context, const IntRect& rect)
+{
+    if (!platformWidget())
+        return;
+
+    if (!context->gdkExposeEvent())
+        return;
+
+    GtkWidget* widget = platformWidget();
+    ASSERT(GTK_WIDGET_NO_WINDOW(widget));
+
+    GdkEvent* event = gdk_event_new(GDK_EXPOSE);
+    event->expose = *context->gdkExposeEvent();
+    event->expose.area = static_cast<GdkRectangle>(rect);
 
+    IntPoint loc = parent()->contentsToWindow(rect.location());
+    event->expose.area.x = loc.x();
+    event->expose.area.y = loc.y();
 
+    event->expose.region = gdk_region_rectangle(&event->expose.area);
+
+    /*
+     * This will be unref'ed by gdk_event_free.
+     */
+    g_object_ref(event->expose.window);
+
+    /*
+     * If we are going to paint do the translation and GtkAllocation manipulation.
+     */
+    if (!gdk_region_empty(event->expose.region))
+        gtk_widget_send_expose(widget, event);
+
+    gdk_event_free(event);
+}
index adb0c78ffd0c285813b5fd66406b6e3f30d05861..aa26688562383145b62a41e18bc962533754f668 100644 (file)
@@ -38,6 +38,7 @@ public:
     friend class Scrollbar;
 
     virtual void setFrameRect(const IntRect&);
+    virtual void paint(GraphicsContext*, const IntRect&);
     
     virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) { return false; }
     virtual bool handleMouseOutEvent(const PlatformMouseEvent&) { return false; }
index ebd9dea897acd3ee05329f1743bc7a7992f9af84..4f09e7768c9f07df86e27bf819ef50972f54a06c 100644 (file)
@@ -95,45 +95,8 @@ void Widget::hide()
     gtk_widget_hide(platformWidget());
 }
 
-/*
- * Strategy to painting a Widget:
- *  1.) do not paint if there is no GtkWidget set
- *  2.) We assume that GTK_NO_WINDOW is set and that frameRectsChanged positioned
- *      the widget correctly. ATM we do not honor the GraphicsContext translation.
- */
 void Widget::paint(GraphicsContext* context, const IntRect& rect)
 {
-    if (!platformWidget())
-        return;
-
-    if (!context->gdkExposeEvent())
-        return;
-
-    GtkWidget* widget = platformWidget();
-    ASSERT(GTK_WIDGET_NO_WINDOW(widget));
-
-    GdkEvent* event = gdk_event_new(GDK_EXPOSE);
-    event->expose = *context->gdkExposeEvent();
-    event->expose.area = static_cast<GdkRectangle>(rect);
-
-    IntPoint loc = parent()->contentsToWindow(rect.location());
-    event->expose.area.x = loc.x();
-    event->expose.area.y = loc.y();
-
-    event->expose.region = gdk_region_rectangle(&event->expose.area);
-
-    /*
-     * This will be unref'ed by gdk_event_free.
-     */
-    g_object_ref(event->expose.window);
-
-    /*
-     * If we are going to paint do the translation and GtkAllocation manipulation.
-     */
-    if (!gdk_region_empty(event->expose.region))
-        gtk_widget_send_expose(widget, event);
-
-    gdk_event_free(event);
 }
 
 void Widget::setIsSelected(bool)