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

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate_gtk.cc

Issue 67147: linux: make windowless plugins work again after r12179 regressed it. (Closed)
Patch Set: Created 11 years, 8 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
« no previous file with comments | « webkit/glue/webplugin_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file was forked off the Mac port. 5 // This file was forked off the Mac port.
6 6
7 #include "webkit/tools/test_shell/test_webview_delegate.h" 7 #include "webkit/tools/test_shell/test_webview_delegate.h"
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 // Update the clipping region on the GdkWindow. 226 // Update the clipping region on the GdkWindow.
227 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); 227 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle();
228 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); 228 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect);
229 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); 229 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects);
230 gdk_window_shape_combine_region(widget->window, clip_region, 0, 0); 230 gdk_window_shape_combine_region(widget->window, clip_region, 0, 0);
231 gdk_region_destroy(clip_region); 231 gdk_region_destroy(clip_region);
232 232
233 // Update the window position. Resizing is handled by WebPluginDelegate. 233 // Update the window position. Resizing is handled by WebPluginDelegate.
234 // TODO(deanm): Verify that we only need to move and not resize. 234 // TODO(deanm): Verify that we only need to move and not resize.
235 // TODO(deanm): Can we avoid the X call if it's already at the right place, 235 // TODO(evanm): we should cache the last shape and position and skip all
236 // the GtkFixed knows where the child is, maybe it handles this for us? 236 // of this business in the common case where nothing has changed.
237 WebWidgetHost* host = GetHostForWidget(webwidget); 237 WebWidgetHost* host = GetHostForWidget(webwidget);
238 gtk_fixed_move(GTK_FIXED(host->view_handle()), 238 int current_x, current_y;
239 widget, 239
240 move.window_rect.x(), 240 // Until the above TODO is resolved, we can grab the last position
241 move.window_rect.y()); 241 // off of the GtkFixed with a bit of hackery.
242 GValue value = {0};
243 g_value_init(&value, G_TYPE_INT);
244 gtk_container_child_get_property(GTK_CONTAINER(host->view_handle()), widget,
245 "x", &value);
246 current_x = g_value_get_int(&value);
247 gtk_container_child_get_property(GTK_CONTAINER(host->view_handle()), widget,
248 "y", &value);
249 current_y = g_value_get_int(&value);
250 g_value_unset(&value);
Dean McNamee 2009/04/15 08:30:27 I would have pulled this out, but it's ok.
Evan Martin 2009/04/15 16:03:38 I was concerned about some data structure inside t
Dean McNamee 2009/04/15 16:05:55 I meant I would have made a helper. fixed_pos(Gtk
251
252 if (move.window_rect.x() != current_x || move.window_rect.y() != current_y) {
253 // Calling gtk_fixed_move unnecessarily is a no-no, as it causes the parent
254 // window to repaint!
255 gtk_fixed_move(GTK_FIXED(host->view_handle()),
256 widget,
257 move.window_rect.x(),
258 move.window_rect.y());
259 }
242 } 260 }
243 261
244 void TestWebViewDelegate::RunModal(WebWidget* webwidget) { 262 void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
245 NOTIMPLEMENTED(); 263 NOTIMPLEMENTED();
246 } 264 }
247 265
248 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { 266 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) {
249 if (is_empty_selection) 267 if (is_empty_selection)
250 return; 268 return;
251 269
(...skipping 17 matching lines...) Expand all
269 // Private methods ----------------------------------------------------------- 287 // Private methods -----------------------------------------------------------
270 288
271 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { 289 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) {
272 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), 290 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()),
273 ("Test Shell - " + WideToUTF8(title)).c_str()); 291 ("Test Shell - " + WideToUTF8(title)).c_str());
274 } 292 }
275 293
276 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { 294 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) {
277 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); 295 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str());
278 } 296 }
OLDNEW
« no previous file with comments | « webkit/glue/webplugin_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698