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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webplugin_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_webview_delegate_gtk.cc
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index b389c6fccdf4810805d7b1833dc5a20fd162a41a..e3df8f41d86766155b50ed58866b8fc8f1338af9 100755
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -232,13 +232,31 @@ void TestWebViewDelegate::DidMove(WebWidget* webwidget,
// Update the window position. Resizing is handled by WebPluginDelegate.
// TODO(deanm): Verify that we only need to move and not resize.
- // TODO(deanm): Can we avoid the X call if it's already at the right place,
- // the GtkFixed knows where the child is, maybe it handles this for us?
+ // TODO(evanm): we should cache the last shape and position and skip all
+ // of this business in the common case where nothing has changed.
WebWidgetHost* host = GetHostForWidget(webwidget);
- gtk_fixed_move(GTK_FIXED(host->view_handle()),
- widget,
- move.window_rect.x(),
- move.window_rect.y());
+ int current_x, current_y;
+
+ // Until the above TODO is resolved, we can grab the last position
+ // off of the GtkFixed with a bit of hackery.
+ GValue value = {0};
+ g_value_init(&value, G_TYPE_INT);
+ gtk_container_child_get_property(GTK_CONTAINER(host->view_handle()), widget,
+ "x", &value);
+ current_x = g_value_get_int(&value);
+ gtk_container_child_get_property(GTK_CONTAINER(host->view_handle()), widget,
+ "y", &value);
+ current_y = g_value_get_int(&value);
+ 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
+
+ if (move.window_rect.x() != current_x || move.window_rect.y() != current_y) {
+ // Calling gtk_fixed_move unnecessarily is a no-no, as it causes the parent
+ // window to repaint!
+ gtk_fixed_move(GTK_FIXED(host->view_handle()),
+ widget,
+ move.window_rect.x(),
+ move.window_rect.y());
+ }
}
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
« 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