diff options
author | ojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-09 21:58:05 +0000 |
---|---|---|
committer | ojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-09 21:58:05 +0000 |
commit | 8a2820a90f85f91c500a9d382f8e8ba870fb621c (patch) | |
tree | 8d8bd23228cd1e6455e64b0de46e961947459382 /chrome | |
parent | 283f76091ad757bdc17c6d9090209eade4211075 (diff) | |
download | chromium_src-8a2820a90f85f91c500a9d382f8e8ba870fb621c.zip chromium_src-8a2820a90f85f91c500a9d382f8e8ba870fb621c.tar.gz chromium_src-8a2820a90f85f91c500a9d382f8e8ba870fb621c.tar.bz2 |
Patch by Thatcher Ulrich <tulrich@google.com>.
Implement "iframe shim" behavior for windowed plugins.
In FF and IE on windows, iframes are implemented as native HWNDs.
This has the side effect that iframes display on top of windowed
plugins. This side effect has long been known as a workaround for
allowing HTML elements to appear above plugin content.
BUG=1788
Review URL: http://codereview.chromium.org/7032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/drag_utils.cc | 2 | ||||
-rw-r--r-- | chrome/browser/printing/printing_layout_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/render_widget_host.cc | 3 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_hwnd.cc | 2 | ||||
-rw-r--r-- | chrome/common/ipc_message_macros.h | 22 | ||||
-rw-r--r-- | chrome/common/ipc_message_utils.h | 34 | ||||
-rw-r--r-- | chrome/common/plugin_messages_internal.h | 3 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 4 | ||||
-rw-r--r-- | chrome/common/win_util.cc | 2 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 4 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.h | 4 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 5 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 1 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 14 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.h | 5 |
16 files changed, 92 insertions, 17 deletions
diff --git a/chrome/browser/drag_utils.cc b/chrome/browser/drag_utils.cc index 5499c26..f0be9be 100644 --- a/chrome/browser/drag_utils.cc +++ b/chrome/browser/drag_utils.cc @@ -9,7 +9,7 @@ #include <shobjidl.h> #include "base/file_util.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/point.h" #include "base/string_util.h" #include "chrome/app/theme/theme_resources.h" diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc index 359237b..7299860 100644 --- a/chrome/browser/printing/printing_layout_uitest.cc +++ b/chrome/browser/printing/printing_layout_uitest.cc @@ -4,7 +4,7 @@ #include "base/command_line.h" #include "base/file_util.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/platform_device_win.h" #include "base/gfx/png_decoder.h" #include "base/gfx/png_encoder.h" diff --git a/chrome/browser/render_widget_host.cc b/chrome/browser/render_widget_host.cc index 449b194..2966b6c 100644 --- a/chrome/browser/render_widget_host.cc +++ b/chrome/browser/render_widget_host.cc @@ -4,7 +4,7 @@ #include "chrome/browser/render_widget_host.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/message_loop.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/render_process_host.h" @@ -451,6 +451,7 @@ void RenderWidgetHost::MovePluginWindows( 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) diff --git a/chrome/browser/render_widget_host_hwnd.cc b/chrome/browser/render_widget_host_hwnd.cc index 3ed7b6d..bc49e62 100644 --- a/chrome/browser/render_widget_host_hwnd.cc +++ b/chrome/browser/render_widget_host_hwnd.cc @@ -5,7 +5,7 @@ #include "chrome/browser/render_widget_host_hwnd.h" #include "base/command_line.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/rect.h" #include "base/histogram.h" #include "base/win_util.h" diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h index 7278b4b..e724e2e 100644 --- a/chrome/common/ipc_message_macros.h +++ b/chrome/common/ipc_message_macros.h @@ -56,6 +56,7 @@ #undef IPC_MESSAGE_ROUTED3 #undef IPC_MESSAGE_ROUTED4 #undef IPC_MESSAGE_ROUTED5 +#undef IPC_MESSAGE_ROUTED6 #undef IPC_MESSAGE_EMPTY #undef IPC_SYNC_MESSAGE_CONTROL0_0 #undef IPC_SYNC_MESSAGE_CONTROL0_1 @@ -146,6 +147,9 @@ #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ msg_class##__ID, +#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \ + msg_class##__ID, + #define IPC_MESSAGE_EMPTY(msg_class) \ msg_class##__ID, @@ -392,6 +396,9 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_MESSAGE_EMPTY(msg_class) \ IPC_MESSAGE_LOG(msg_class) @@ -633,6 +640,21 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5)) {} \ }; +#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, \ + type6) \ + class msg_class : \ + public IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \ + type6> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4, const type5& arg5, \ + const type6& arg6) \ + : IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \ + type6> >( \ + routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5, arg6)) {} \ + }; + // Dummy class for now, just to give us the ID field. #define IPC_MESSAGE_EMPTY(msg_class) \ class msg_class { \ diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h index 0c6ef8e..d5531e2 100644 --- a/chrome/common/ipc_message_utils.h +++ b/chrome/common/ipc_message_utils.h @@ -943,6 +943,40 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > { } }; +template <class A, class B, class C, class D, class E, class F> +struct ParamTraits< Tuple6<A, B, C, D, E, F> > { + typedef Tuple6<A, B, C, D, E, F> param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.a); + WriteParam(m, p.b); + WriteParam(m, p.c); + WriteParam(m, p.d); + WriteParam(m, p.e); + WriteParam(m, p.f); + } + static bool Read(const Message* m, void** iter, param_type* r) { + return (ReadParam(m, iter, &r->a) && + ReadParam(m, iter, &r->b) && + ReadParam(m, iter, &r->c) && + ReadParam(m, iter, &r->d) && + ReadParam(m, iter, &r->e) && + ReadParam(m, iter, &r->f)); + } + static void Log(const param_type& p, std::wstring* l) { + LogParam(p.a, l); + l->append(L", "); + LogParam(p.b, l); + l->append(L", "); + LogParam(p.c, l); + l->append(L", "); + LogParam(p.d, l); + l->append(L", "); + LogParam(p.e, l); + l->append(L", "); + LogParam(p.f, l); + } +}; + template <> struct ParamTraits<webkit_glue::WebApplicationInfo> { typedef webkit_glue::WebApplicationInfo param_type; diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index 1059418..f2676fd 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -124,9 +124,10 @@ IPC_BEGIN_MESSAGES(Plugin, 5) // contains a buffer that the plugin draws into. background_buffer is used // for transparent windowless plugins, and holds the background of the plugin // rectangle. - IPC_MESSAGE_ROUTED5(PluginMsg_UpdateGeometry, + IPC_MESSAGE_ROUTED6(PluginMsg_UpdateGeometry, gfx::Rect /* window_rect */, gfx::Rect /* clip_rect */, + std::vector<gfx::Rect> /* cutout_rects */, bool /* visible */, SharedMemoryHandle /* windowless_buffer */, SharedMemoryHandle /* background_buffer */) diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c4038a2..a4e30a4 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -1007,6 +1007,7 @@ struct ParamTraits<WebPluginGeometry> { WriteParam(m, p.window); WriteParam(m, p.window_rect); WriteParam(m, p.clip_rect); + WriteParam(m, p.cutout_rects); WriteParam(m, p.visible); } static bool Read(const Message* m, void** iter, param_type* p) { @@ -1014,6 +1015,7 @@ struct ParamTraits<WebPluginGeometry> { ReadParam(m, iter, &p->window) && ReadParam(m, iter, &p->window_rect) && ReadParam(m, iter, &p->clip_rect) && + ReadParam(m, iter, &p->cutout_rects) && ReadParam(m, iter, &p->visible); } static void Log(const param_type& p, std::wstring* l) { @@ -1024,6 +1026,8 @@ struct ParamTraits<WebPluginGeometry> { l->append(L", "); LogParam(p.clip_rect, l); l->append(L", "); + LogParam(p.cutout_rects, l); + l->append(L", "); LogParam(p.visible, l); l->append(L")"); } diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc index b0ef230..9b51220 100644 --- a/chrome/common/win_util.cc +++ b/chrome/common/win_util.cc @@ -12,7 +12,7 @@ #include <shlobj.h> #include "base/file_util.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/png_encoder.h" #include "base/logging.h" #include "base/registry.h" diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 84bc069..69177e1 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -237,11 +237,13 @@ void WebPluginDelegateStub::OnPrint(PluginMsg_PrintResponse_Params* params) { void WebPluginDelegateStub::OnUpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, bool visible, const SharedMemoryHandle& windowless_buffer, const SharedMemoryHandle& background_buffer) { webplugin_->UpdateGeometry( - window_rect, clip_rect, visible, windowless_buffer, background_buffer); + window_rect, clip_rect, cutout_rects, visible, windowless_buffer, + background_buffer); } void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id, diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index 78684bf..fb7d4dd 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -64,7 +64,9 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, void OnPrint(PluginMsg_PrintResponse_Params* params); void OnUpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, bool visible, + const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, + bool visible, const SharedMemoryHandle& windowless_buffer, const SharedMemoryHandle& background_buffer); void OnGetPluginScriptableObject(int* route_id, void** npobject_ptr); diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 9528490..56beb25c 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -4,7 +4,7 @@ #include "chrome/plugin/webplugin_proxy.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/platform_device_win.h" #include "base/scoped_handle.h" #include "base/shared_memory.h" @@ -277,13 +277,14 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { void WebPluginProxy::UpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, bool visible, const SharedMemoryHandle& windowless_buffer, const SharedMemoryHandle& background_buffer) { gfx::Rect old = delegate_->rect(); bool moved = delegate_->rect().x() != window_rect.x() || delegate_->rect().y() != window_rect.y(); - delegate_->UpdateGeometry(window_rect, clip_rect, visible); + delegate_->UpdateGeometry(window_rect, clip_rect, cutout_rects, visible); if (windowless_buffer) { // The plugin's rect changed, so now we have a new buffer to draw into. SetWindowlessBuffer(windowless_buffer, background_buffer); diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index ab50933..5374d1c 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -81,6 +81,7 @@ class WebPluginProxy : public WebPlugin { void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, bool visible, const SharedMemoryHandle& windowless_buffer, const SharedMemoryHandle& background_buffer); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 4fe474d..722e67f 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -9,7 +9,7 @@ #include <vector> #include "base/command_line.h" -#include "base/gfx/bitmap_header.h" +#include "base/gfx/gdi_util.h" #include "base/gfx/bitmap_platform_device_win.h" #include "base/gfx/image_operations.h" #include "base/gfx/native_theme.h" diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 1d6e8d21..315fc89 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -183,6 +183,7 @@ void WebPluginDelegateProxy::FlushGeometryUpdates() { Send(new PluginMsg_UpdateGeometry(instance_id_, plugin_rect_, deferred_clip_rect_, + deferred_cutout_rects_, visible_, NULL, NULL)); @@ -333,12 +334,15 @@ void WebPluginDelegateProxy::OnChannelError() { render_view_->PluginCrashed(plugin_path_); } -void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - bool visible) { +void WebPluginDelegateProxy::UpdateGeometry( + const gfx::Rect& window_rect, + const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, + bool visible) { plugin_rect_ = window_rect; if (!windowless_) { deferred_clip_rect_ = clip_rect; + deferred_cutout_rects_ = cutout_rects; visible_ = visible; send_deferred_update_geometry_ = true; return; @@ -369,8 +373,8 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect, } IPC::Message* msg = new PluginMsg_UpdateGeometry( - instance_id_, window_rect, clip_rect, visible, transport_store_handle, - background_store_handle); + instance_id_, window_rect, clip_rect, cutout_rects, visible, + transport_store_handle, background_store_handle); msg->set_unblock(true); Send(msg); } diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 7a7da77..b401baa 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -52,7 +52,9 @@ class WebPluginDelegateProxy : public WebPluginDelegate, virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc, WebPlugin* plugin, bool load_manually); virtual void UpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, bool visible); + const gfx::Rect& clip_rect, + const std::vector<gfx::Rect>& cutout_rects, + bool visible); virtual void Paint(HDC hdc, const gfx::Rect& rect); virtual void Print(HDC hdc); virtual NPObject* GetPluginScriptableObject(); @@ -157,6 +159,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate, gfx::Rect plugin_rect_; gfx::Rect deferred_clip_rect_; + std::vector<gfx::Rect> deferred_cutout_rects_; bool send_deferred_update_geometry_; bool visible_; |