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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Holger Hans Peter Freyther zecke@selfish.org 2 * Copyright (C) 2007 Holger Hans Peter Freyther zecke@selfish.org
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public 5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 */ 63 */
64 resize(ScrollbarTheme::nativeTheme()->scrollbarThickness(), 64 resize(ScrollbarTheme::nativeTheme()->scrollbarThickness(),
65 ScrollbarTheme::nativeTheme()->scrollbarThickness()); 65 ScrollbarTheme::nativeTheme()->scrollbarThickness());
66 } 66 }
67 67
68 void ScrollbarGtk::frameRectsChanged() 68 void ScrollbarGtk::frameRectsChanged()
69 { 69 {
70 if (!parent()) 70 if (!parent())
71 return; 71 return;
72 72
73 IntPoint loc; 73 // Translate our coordinates, we are a RenderLayout scrollbar because our
74 74 // ScrollView scrollbars are native.
75 /* 75 IntPoint loc = parent()->contentsToWindow(frameRect().location());
76 * The same scrollbars are used for ScrollViews and 'floating divs'/
77 * RenderLayout. We need to take this into account to decide which
78 * function to use to transform the location coordinates.
79 * The basic difference is that RenderLayout scrollbars need to have
80 * substracted the scrollOffset() from their location.
81 */
82 if (parent()->isScrollViewScrollbar(this))
83 loc = parent()->convertToContainingWindow(frameRect().location());
84 else
85 loc = parent()->contentsToWindow(frameRect().location());
86 76
87 // Don't allow the allocation size to be negative 77 // Don't allow the allocation size to be negative
88 IntSize sz = frameRect().size(); 78 IntSize sz = frameRect().size();
89 sz.clampNegativeToZero(); 79 sz.clampNegativeToZero();
90 80
91 GtkAllocation allocation = { loc.x(), loc.y(), sz.width(), sz.height() }; 81 GtkAllocation allocation = { loc.x(), loc.y(), sz.width(), sz.height() };
92 gtk_widget_size_allocate(platformWidget(), &allocation); 82 gtk_widget_size_allocate(platformWidget(), &allocation);
93 } 83 }
94 84
95 void ScrollbarGtk::updateThumbPosition() 85 void ScrollbarGtk::updateThumbPosition()
(...skipping 27 matching lines...) Expand all
123 void ScrollbarGtk::setEnabled(bool shouldEnable) 113 void ScrollbarGtk::setEnabled(bool shouldEnable)
124 { 114 {
125 if (enabled() == shouldEnable) 115 if (enabled() == shouldEnable)
126 return; 116 return;
127 117
128 Scrollbar::setEnabled(shouldEnable); 118 Scrollbar::setEnabled(shouldEnable);
129 if (platformWidget()) 119 if (platformWidget())
130 gtk_widget_set_sensitive(platformWidget(), shouldEnable); 120 gtk_widget_set_sensitive(platformWidget(), shouldEnable);
131 } 121 }
132 122
123 /*
124 * Strategy to painting a Widget:
125 * 1.) do not paint if there is no GtkWidget set
126 * 2.) We assume that GTK_NO_WINDOW is set and that frameRectsChanged positione d
127 * the widget correctly. ATM we do not honor the GraphicsContext translatio n.
128 */
129 void ScrollbarGtk::paint(GraphicsContext* context, const IntRect& rect)
130 {
131 if (!platformWidget())
132 return;
133 133
134 if (!context->gdkExposeEvent())
135 return;
134 136
137 GtkWidget* widget = platformWidget();
138 ASSERT(GTK_WIDGET_NO_WINDOW(widget));
139
140 GdkEvent* event = gdk_event_new(GDK_EXPOSE);
141 event->expose = *context->gdkExposeEvent();
142 event->expose.area = static_cast<GdkRectangle>(rect);
143
144 IntPoint loc = parent()->contentsToWindow(rect.location());
145 event->expose.area.x = loc.x();
146 event->expose.area.y = loc.y();
147
148 event->expose.region = gdk_region_rectangle(&event->expose.area);
149
150 /*
151 * This will be unref'ed by gdk_event_free.
152 */
153 g_object_ref(event->expose.window);
154
155 /*
156 * If we are going to paint do the translation and GtkAllocation manipulatio n.
157 */
158 if (!gdk_region_empty(event->expose.region))
159 gtk_widget_send_expose(widget, event);
160
161 gdk_event_free(event);
162 }
OLDNEW
« 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