diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 18:08:36 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 18:08:36 +0000 |
commit | a14909d45e3f8c87e65a6d1587d74142988c10a0 (patch) | |
tree | c3d1bfbe0624995f942ef40ec4a0cd902ee5e949 /webkit/tools | |
parent | 4d430ef1335bdfbfe04be7ff7a048c2aff06c000 (diff) | |
download | chromium_src-a14909d45e3f8c87e65a6d1587d74142988c10a0.zip chromium_src-a14909d45e3f8c87e65a6d1587d74142988c10a0.tar.gz chromium_src-a14909d45e3f8c87e65a6d1587d74142988c10a0.tar.bz2 |
Pull the test_webview_delegate DidMove into platform specific files, and implement the Gtk version. The Gtk code uses xshape to do the non-rectangular clipping that is required for plugin windows (iframe shims, etc).
Review URL: http://codereview.chromium.org/21248
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rwxr-xr-x[-rw-r--r--] | webkit/tools/test_shell/mac/test_webview_delegate.mm | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | webkit/tools/test_shell/test_webview_delegate.cc | 33 | ||||
-rwxr-xr-x[-rw-r--r--] | webkit/tools/test_shell/test_webview_delegate_gtk.cc | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | webkit/tools/test_shell/test_webview_delegate_win.cc | 30 |
4 files changed, 49 insertions, 34 deletions
diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm index a355ef3..48e2c3f 100644..100755 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -138,6 +138,11 @@ void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, *out_rect = gfx::Rect(NSRectToCGRect(resize_rect)); } +void TestWebViewDelegate::DidMove(WebWidget* webwidget, + const WebPluginGeometry& move) { + // TODO(port): add me once plugins work. +} + void TestWebViewDelegate::RunModal(WebWidget* webwidget) { NOTIMPLEMENTED(); } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index d7bd9d7..77dad42 100644..100755 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -31,7 +31,6 @@ #if defined(OS_WIN) // TODO(port): make these files work everywhere. -#include "base/gfx/gdi_util.h" #include "webkit/tools/test_shell/drag_delegate.h" #include "webkit/tools/test_shell/drop_delegate.h" #endif @@ -705,38 +704,6 @@ void TestWebViewDelegate::Blur(WebWidget* webwidget) { shell_->SetFocus(host, false); } - -void TestWebViewDelegate::DidMove(WebWidget* webwidget, - const WebPluginGeometry& move) { -#if defined(OS_WIN) - HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), - move.clip_rect.y(), - move.clip_rect.right(), - move.clip_rect.bottom()); - gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); - - // Note: System will own the hrgn after we call SetWindowRgn, - // so we don't need to call DeleteObject(hrgn) - ::SetWindowRgn(move.window, hrgn, FALSE); - - unsigned long flags = 0; - if (move.visible) - flags |= SWP_SHOWWINDOW; - else - flags |= SWP_HIDEWINDOW; - - ::SetWindowPos(move.window, - NULL, - move.window_rect.x(), - move.window_rect.y(), - move.window_rect.width(), - move.window_rect.height(), - flags); - -#endif - // TODO(port): add me once plugins work. -} - bool TestWebViewDelegate::IsHidden() { return false; } diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index 3b61456..2564061 100644..100755 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -8,6 +8,7 @@ #include <gtk/gtk.h> +#include "base/gfx/gtk_util.h" #include "base/gfx/point.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -199,6 +200,20 @@ void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, *out_rect = gfx::Rect(); } +void TestWebViewDelegate::DidMove(WebWidget* webwidget, + const WebPluginGeometry& move) { + // The window on WebPluginGeometry is misnamed, as it's a view. In our case + // it should be the GtkSocket of the plugin window. + GtkWidget* widget = move.window; + DCHECK(!GTK_WIDGET_NO_WINDOW(widget) && GTK_WIDGET_REALIZED(widget)); + + GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); + GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); + gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); + gdk_window_shape_combine_region(widget->window, clip_region, 0, 0); + gdk_region_destroy(clip_region); +} + void TestWebViewDelegate::RunModal(WebWidget* webwidget) { NOTIMPLEMENTED(); } diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index d8d38e1..e9fff70 100644..100755 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -12,8 +12,9 @@ #include <shlobj.h> #include <shlwapi.h> -#include "base/gfx/point.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/native_widget_types.h" +#include "base/gfx/point.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/trace_event.h" @@ -129,6 +130,33 @@ void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, *out_rect = gfx::Rect(); } +void TestWebViewDelegate::DidMove(WebWidget* webwidget, + const WebPluginGeometry& move) { + HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), + move.clip_rect.y(), + move.clip_rect.right(), + move.clip_rect.bottom()); + gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); + + // Note: System will own the hrgn after we call SetWindowRgn, + // so we don't need to call DeleteObject(hrgn) + ::SetWindowRgn(move.window, hrgn, FALSE); + + unsigned long flags = 0; + if (move.visible) + flags |= SWP_SHOWWINDOW; + else + flags |= SWP_HIDEWINDOW; + + ::SetWindowPos(move.window, + NULL, + move.window_rect.x(), + move.window_rect.y(), + move.window_rect.width(), + move.window_rect.height(), + flags); +} + void TestWebViewDelegate::RunModal(WebWidget* webwidget) { Show(webwidget, NEW_WINDOW); |