summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 23:14:22 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 23:14:22 +0000
commitcaa385013316f797a989b41518a5609608a6588d (patch)
treef74a484881234ae62bb16fbbd8d50a8f2db5559a /webkit/tools
parentcd924e01f1edfaab98c953941a0a956103130151 (diff)
downloadchromium_src-caa385013316f797a989b41518a5609608a6588d.zip
chromium_src-caa385013316f797a989b41518a5609608a6588d.tar.gz
chromium_src-caa385013316f797a989b41518a5609608a6588d.tar.bz2
linux: make windowless plugins work again after r12179 regressed it.
r12179 makes painting always call DidMove(), even when the plugin hasn't moved, in case the cutout rects need to change. DidMove() on Linux test_shell causes the window to invalidate, causing an endless cycle of repaints. r12179: http://src.chromium.org/viewvc/chrome?view=rev&revision=12179 This code will be very different in the real multiproc case, so this is just the minimal change to make test_shell work again. BUG=10059 Review URL: http://codereview.chromium.org/67147 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate_gtk.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index b389c6f..e3df8f4 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);
+
+ 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) {