Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: third_party/WebKit/WebCore/platform/gtk/ScrollbarGtk.cpp

Issue 39293: WebKit merge 41447:41498 [third_party/WebKit] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove CRLF Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/WebCore/platform/gtk/ScrollbarGtk.cpp
===================================================================
--- third_party/WebKit/WebCore/platform/gtk/ScrollbarGtk.cpp (revision 11154)
+++ third_party/WebKit/WebCore/platform/gtk/ScrollbarGtk.cpp (working copy)
@@ -70,20 +70,10 @@
if (!parent())
return;
- IntPoint loc;
+ // Translate our coordinates, we are a RenderLayout scrollbar because our
+ // ScrollView scrollbars are native.
+ IntPoint loc = parent()->contentsToWindow(frameRect().location());
- /*
- * The same scrollbars are used for ScrollViews and 'floating divs'/
- * RenderLayout. We need to take this into account to decide which
- * function to use to transform the location coordinates.
- * The basic difference is that RenderLayout scrollbars need to have
- * substracted the scrollOffset() from their location.
- */
- if (parent()->isScrollViewScrollbar(this))
- loc = parent()->convertToContainingWindow(frameRect().location());
- else
- loc = parent()->contentsToWindow(frameRect().location());
-
// Don't allow the allocation size to be negative
IntSize sz = frameRect().size();
sz.clampNegativeToZero();
@@ -130,5 +120,43 @@
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);
+}
« no previous file with comments | « third_party/WebKit/WebCore/platform/gtk/ScrollbarGtk.h ('k') | third_party/WebKit/WebCore/platform/gtk/WheelEventGtk.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698