Chromium Code Reviews| Index: components/plugins/renderer/webview_plugin.cc |
| diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc |
| index ed0adbc0fe6950024154d026e3230004845dd7c3..9518dcb9be7f3da751934b479915092c146a3e1a 100644 |
| --- a/components/plugins/renderer/webview_plugin.cc |
| +++ b/components/plugins/renderer/webview_plugin.cc |
| @@ -209,6 +209,13 @@ void WebViewPlugin::updateGeometry(const WebRect& window_rect, |
| bool is_visible) { |
| DCHECK(container_); |
| + base::AutoReset<bool> is_resizing(&is_resizing_, true); |
| + |
| + if (static_cast<gfx::Rect>(window_rect) != rect_) { |
| + rect_ = window_rect; |
| + web_view_->resize(rect_.size()); |
| + } |
| + |
| // Plugin updates are forbidden during Blink layout. Therefore, |
| // UpdatePluginForNewGeometry must be posted to a task to run asynchronously. |
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| @@ -348,19 +355,12 @@ void WebViewPlugin::UpdatePluginForNewGeometry( |
| const blink::WebRect& window_rect, |
| const blink::WebRect& unobscured_rect) { |
| DCHECK(container_); |
| + if (!delegate_) |
| + return; |
| - base::AutoReset<bool> is_resizing(&is_resizing_, true); |
| - |
| - if (static_cast<gfx::Rect>(window_rect) != rect_) { |
| - rect_ = window_rect; |
| - web_view_->resize(rect_.size()); |
| - } |
| - |
| - if (delegate_) { |
| - delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| - // The delegate may have dirtied style and layout of the WebView. |
| - // See for example the resizePoster function in plugin_poster.html. |
| - // Run the lifecycle now so that it is clean. |
| - web_view_->updateAllLifecyclePhases(); |
| - } |
| + delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
|
dcheng
2016/08/04 01:48:51
Nit: perhaps comment that this is what can actuall
tommycli
2016/08/04 02:10:12
Done.
|
| + // The delegate may have dirtied style and layout of the WebView. |
| + // See for example the resizePoster function in plugin_poster.html. |
| + // Run the lifecycle now so that it is clean. |
| + web_view_->updateAllLifecyclePhases(); |
| } |