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

Unified Diff: webkit/glue/plugins/webplugin_delegate_impl.cc

Issue 1612: Implement "iframe shim" behavior for windowed plugins.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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/plugins/webplugin_delegate_impl.h ('k') | webkit/glue/stacking_order_iterator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/webplugin_delegate_impl.cc
===================================================================
--- webkit/glue/plugins/webplugin_delegate_impl.cc (revision 2783)
+++ webkit/glue/plugins/webplugin_delegate_impl.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
+#include "base/gfx/gdi_util.h"
#include "base/gfx/point.h"
#include "base/stats_counters.h"
#include "webkit/default_plugin/plugin_impl.h"
@@ -250,13 +251,15 @@
}
}
-void WebPluginDelegateImpl::UpdateGeometry(const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- bool visible) {
+void WebPluginDelegateImpl::UpdateGeometry(
+ const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect,
+ const std::vector<gfx::Rect>& cutout_rects,
+ bool visible) {
if (windowless_) {
WindowlessUpdateGeometry(window_rect, clip_rect);
} else {
- WindowedUpdateGeometry(window_rect, clip_rect, visible);
+ WindowedUpdateGeometry(window_rect, clip_rect, cutout_rects, visible);
}
// Initiate a download on the plugin url. This should be done for the
@@ -344,10 +347,12 @@
instance()->NPP_HandleEvent(&evt);
}
-void WebPluginDelegateImpl::WindowedUpdateGeometry(const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- bool visible) {
- if (WindowedReposition(window_rect, clip_rect, visible) ||
+void WebPluginDelegateImpl::WindowedUpdateGeometry(
+ const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect,
+ const std::vector<gfx::Rect>& cutout_rects,
+ bool visible) {
+ if (WindowedReposition(window_rect, clip_rect, cutout_rects, visible) ||
!windowed_did_set_window_) {
// Let the plugin know that it has been moved
WindowedSetWindow();
@@ -584,14 +589,17 @@
return true;
}
-void WebPluginDelegateImpl::MoveWindow(HWND window,
- const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- bool visible) {
+void WebPluginDelegateImpl::MoveWindow(
+ HWND window,
+ const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect,
+ const std::vector<gfx::Rect>& cutout_rects,
+ bool visible) {
HRGN hrgn = ::CreateRectRgn(clip_rect.x(),
clip_rect.y(),
clip_rect.right(),
clip_rect.bottom());
+ gfx::SubtractRectanglesFromRegion(hrgn, cutout_rects);
// Note: System will own the hrgn after we call SetWindowRgn,
// so we don't need to call DeleteObject(hrgn)
@@ -612,20 +620,24 @@
flags);
}
-bool WebPluginDelegateImpl::WindowedReposition(const gfx::Rect& window_rect,
- const gfx::Rect& clip_rect,
- bool visible) {
+bool WebPluginDelegateImpl::WindowedReposition(
+ const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect,
+ const std::vector<gfx::Rect>& cutout_rects,
+ bool visible) {
if (!windowed_handle_) {
NOTREACHED();
return false;
}
if (window_rect_ == window_rect && clip_rect_ == clip_rect &&
+ cutout_rects == cutout_rects_ &&
initial_plugin_resize_done_)
return false;
window_rect_ = window_rect;
clip_rect_ = clip_rect;
+ cutout_rects_ = cutout_rects;
if (!initial_plugin_resize_done_) {
// We need to ensure that the plugin process continues to reposition
@@ -636,7 +648,7 @@
// We created the window with 0 width and height since we didn't know it
// at the time. Now that we know the geometry, we we can update its size
// since the browser only calls SetWindowPos when scrolling occurs.
- MoveWindow(windowed_handle_, window_rect, clip_rect, visible);
+ MoveWindow(windowed_handle_, window_rect, clip_rect, cutout_rects, visible);
// Ensure that the entire window gets repainted.
::InvalidateRect(windowed_handle_, NULL, FALSE);
}
@@ -791,6 +803,7 @@
// We will inform the instance of this change when we call NPP_SetWindow.
clip_rect_ = clip_rect;
+ cutout_rects_.clear();
if (window_rect_ != window_rect) {
window_rect_ = window_rect;
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.h ('k') | webkit/glue/stacking_order_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698