diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-03 16:56:49 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-03 16:56:49 +0000 |
commit | db02fae7346c52cd7ab8b74da92f1f3ff557120a (patch) | |
tree | 3139a38348606296a5e199253463839058b58f82 /content | |
parent | 9d55427d08ed292f47c56aadb487a54bb356489c (diff) | |
download | chromium_src-db02fae7346c52cd7ab8b74da92f1f3ff557120a.zip chromium_src-db02fae7346c52cd7ab8b74da92f1f3ff557120a.tar.gz chromium_src-db02fae7346c52cd7ab8b74da92f1f3ff557120a.tar.bz2 |
Merge 247881 "Fix windowed plugins not appearing if opened in th..."
> Fix windowed plugins not appearing if opened in the background until the browser resizes.
>
> BUG=335900
> R=ben@chromium.org
>
> Review URL: https://codereview.chromium.org/150073002
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/152913002
git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@248505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
5 files changed, 31 insertions, 17 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 1cbbda0..7f4da87 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1337,15 +1337,16 @@ void RenderWidgetHostViewAura::DidReceiveFrameFromRenderer() { #if defined(OS_WIN) void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( const std::vector<gfx::Rect>& rects) { + // Check this before setting constrained_rects_, so that next time they're set + // and we have a root window we don't early return. + if (!window_->GetDispatcher()) + return; + if (rects == constrained_rects_) return; + constrained_rects_ = rects; - UpdateCutoutRects(); -} -void RenderWidgetHostViewAura::UpdateCutoutRects() { - if (!window_->GetRootWindow()) - return; HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); CutoutRectsParams params; params.widget = this; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 86db864..041b61d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -566,12 +566,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // Helper function to set keyboard focus to the main window. void SetKeyboardFocus(); -#if defined(OS_WIN) - // Updates the total list of cutout rects, which is the union of transient - // windows and constrained windows. - void UpdateCutoutRects(); -#endif - // The model object. RenderWidgetHostImpl* host_; diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index 8995b3a..484d04b 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -789,10 +789,8 @@ class WebContentsViewAura::WindowObserver virtual void OnWindowVisibilityChanged(aura::Window* window, bool visible) OVERRIDE { - if (window == view_->window_) - return; - - if (window->parent() == parent_ || + if (window == view_->window_ || + window->parent() == parent_ || window->parent() == view_->window_->GetRootWindow()) { UpdateConstrainedWindows(NULL); } diff --git a/content/test/plugin/plugin_test_factory.cc b/content/test/plugin/plugin_test_factory.cc index 742b8f3..3039534 100644 --- a/content/test/plugin/plugin_test_factory.cc +++ b/content/test/plugin/plugin_test_factory.cc @@ -99,7 +99,8 @@ PluginTest* CreatePluginTest(const std::string& test_name, test_name == "create_instance_in_paint" || test_name == "alert_in_window_message" || test_name == "ensure_scripting_works_in_destroy" || - test_name == "set_title_in_paint") { + test_name == "set_title_in_paint" || + test_name == "set_title_in_set_window_and_paint") { new_test = new WindowedPluginTest(instance, host_functions); #endif } else if (test_name == "setup") { diff --git a/content/test/plugin/plugin_windowed_test.cc b/content/test/plugin/plugin_windowed_test.cc index bfc825d..c0d6630 100644 --- a/content/test/plugin/plugin_windowed_test.cc +++ b/content/test/plugin/plugin_windowed_test.cc @@ -39,7 +39,8 @@ NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) { if ((test_name() == "create_instance_in_paint" && test_id() == "1") || test_name() == "alert_in_window_message" || - test_name() == "set_title_in_paint") { + test_name() == "set_title_in_paint" || + test_name() == "set_title_in_set_window_and_paint") { static ATOM window_class = 0; if (!window_class) { WNDCLASSEX wcex; @@ -68,6 +69,9 @@ NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) { ::SetProp(window_, L"Plugin_Instance", this); } + if (test_name() == "set_title_in_set_window_and_paint") + CallJSFunction(this, "PluginCreated"); + return NPERR_NO_ERROR; } @@ -122,6 +126,18 @@ LRESULT CALLBACK WindowedPluginTest::WindowProc( reinterpret_cast<WindowedPluginTest*> (::GetProp(window, L"Plugin_Instance")); + if (message == WM_PAINT) { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(window, &ps); + HBRUSH brush = CreateSolidBrush(RGB(255, 0, 0)); + SelectObject(hdc, brush); + RECT r; + GetClientRect(window, &r); + Rectangle(hdc, 0, 0, r.right, r.bottom); + DeleteObject(brush); + EndPaint(window, &ps); + } + if (this_ptr && !this_ptr->done_) { if (this_ptr->test_name() == "create_instance_in_paint" && message == WM_PAINT) { @@ -138,6 +154,10 @@ LRESULT CALLBACK WindowedPluginTest::WindowProc( message == WM_PAINT) { this_ptr->done_ = true; CallJSFunction(this_ptr, "SetTitle"); + } else if (this_ptr->test_name() == "set_title_in_set_window_and_paint" && + message == WM_PAINT) { + this_ptr->done_ = true; + CallJSFunction(this_ptr, "PluginShown"); } if (this_ptr->done_) { |