diff options
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 89 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 23 |
3 files changed, 29 insertions, 86 deletions
diff --git a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc index 8f3a89f..2907a5e 100644 --- a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc +++ b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc @@ -113,9 +113,6 @@ NPObjectDeletePluginInNPN_Evaluate::~NPObjectDeletePluginInNPN_Evaluate() { } NPError NPObjectDeletePluginInNPN_Evaluate::SetWindow(NPWindow* np_window) { - if (!::IsWindowVisible(reinterpret_cast<HWND>(np_window->window))) - return NPERR_NO_ERROR; - HWND window_handle = reinterpret_cast<HWND>(np_window->window); // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin // instance. This is to ensure that we don't destroy the plugin instance diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 0f713d7..a0de8da 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -9,8 +9,6 @@ #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 "base/string_util.h" #include "webkit/default_plugin/plugin_impl.h" @@ -133,7 +131,6 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( plugin_wnd_proc_(NULL), last_message_(0), is_calling_wndproc(false), - initial_plugin_resize_done_(false), dummy_window_for_activation_(NULL), handle_event_message_filter_hook_(NULL), handle_event_pump_messages_event_(NULL), @@ -322,13 +319,11 @@ void WebPluginDelegateImpl::DestroyInstance() { void WebPluginDelegateImpl::UpdateGeometry( const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible) { + const gfx::Rect& clip_rect) { if (windowless_) { WindowlessUpdateGeometry(window_rect, clip_rect); } else { - WindowedUpdateGeometry(window_rect, clip_rect, cutout_rects, visible); + WindowedUpdateGeometry(window_rect, clip_rect); } } @@ -377,6 +372,12 @@ void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url, void WebPluginDelegateImpl::DidReceiveManualResponse( const std::string& url, const std::string& mime_type, const std::string& headers, uint32 expected_length, uint32 last_modified) { + if (!windowless_) { + // Calling NPP_WriteReady before NPP_SetWindow causes movies to not load in + // Flash. See http://b/issue?id=892174. + DCHECK(windowed_did_set_window_); + } + instance()->DidReceiveManualResponse(url, mime_type, headers, expected_length, last_modified); } @@ -408,10 +409,8 @@ void WebPluginDelegateImpl::InstallMissingPlugin() { 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) || + const gfx::Rect& clip_rect) { + if (WindowedReposition(window_rect, clip_rect) || !windowed_did_set_window_) { // Let the plugin know that it has been moved WindowedSetWindow(); @@ -663,69 +662,33 @@ bool WebPluginDelegateImpl::CreateDummyWindowForActivation() { return true; } -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) - ::SetWindowRgn(window, hrgn, FALSE); - - unsigned long flags = 0; - if (visible) - flags |= SWP_SHOWWINDOW; - else - flags |= SWP_HIDEWINDOW; - - ::SetWindowPos(window, - NULL, - window_rect.x(), - window_rect.y(), - window_rect.width(), - window_rect.height(), - flags); -} - bool WebPluginDelegateImpl::WindowedReposition( const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible) { + const gfx::Rect& clip_rect) { if (!windowed_handle_) { NOTREACHED(); return false; } - if (window_rect_ == window_rect && clip_rect_ == clip_rect && - cutout_rects == cutout_rects_ && - initial_plugin_resize_done_) + if (window_rect_ == window_rect && clip_rect_ == clip_rect) return false; + // Clipping is handled by WebPlugin. + if (window_rect.size() != window_rect_.size()) { + ::SetWindowPos(windowed_handle_, + NULL, + 0, + 0, + window_rect.width(), + window_rect.height(), + SWP_SHOWWINDOW); + } + 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 - // the plugin window until we receive an indication that it is now visible. - // Subsequent repositions will be done by the browser. - if (visible) - initial_plugin_resize_done_ = true; - // 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, cutout_rects, visible); - // Ensure that the entire window gets repainted. - ::InvalidateRect(windowed_handle_, NULL, FALSE); - } + + // Ensure that the entire window gets repainted. + ::InvalidateRect(windowed_handle_, NULL, FALSE); return true; } diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 468d3c7..d01046c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -44,9 +44,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { WebPlugin* plugin, bool load_manually); virtual void UpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible); + const gfx::Rect& clip_rect); virtual void Paint(HDC hdc, const gfx::Rect& rect); virtual void Print(HDC hdc); virtual void SetFocus(); // only called when windowless @@ -99,12 +97,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate { int quirks() { return quirks_; } - static void MoveWindow(HWND window, - const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible); - private: WebPluginDelegateImpl(gfx::NativeView containing_view, NPAPI::PluginInstance *instance); @@ -113,9 +105,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { //-------------------------- // used for windowed plugins void WindowedUpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible); + const gfx::Rect& clip_rect); // Create the native window. // Returns true if the window is created (or already exists). // Returns false if unable to create the window. @@ -127,9 +117,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { // Reposition the native window to be in sync with the given geometry. // Returns true if the native window has moved or been clipped differently. bool WindowedReposition(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect, - const std::vector<gfx::Rect>& cutout_rects, - bool visible); + const gfx::Rect& clip_rect); // Tells the plugin about the current state of the window. // See NPAPI NPP_SetWindow for more information. @@ -202,11 +190,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate { std::vector<gfx::Rect> cutout_rects_; int quirks_; - // We only move/size the plugin window once after its creation. The - // rest of the moves are controlled by the browser. This flag controls - // this behaviour. - bool initial_plugin_resize_done_; - // Windowless plugins don't have keyboard focus causing issues with the // plugin not receiving keyboard events if the plugin enters a modal // loop like TrackPopupMenuEx or MessageBox, etc. |