| Index: components/plugins/renderer/webview_plugin.cc
|
| diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc
|
| index b6ddb46033241a3afc3a2cc15e12b7bbfd70179a..65ff33478b2b3445040a85da38949e208bb6cf60 100644
|
| --- a/components/plugins/renderer/webview_plugin.cc
|
| +++ b/components/plugins/renderer/webview_plugin.cc
|
| @@ -57,7 +57,8 @@ WebViewPlugin::WebViewPlugin(content::RenderView* render_view,
|
| web_view_(WebView::create(this)),
|
| finished_loading_(false),
|
| focused_(false),
|
| - is_painting_(false) {
|
| + is_painting_(false),
|
| + is_resizing_(false) {
|
| // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a
|
| // consistent view of our preferences.
|
| content::RenderView::ApplyWebPreferences(preferences, web_view_);
|
| @@ -199,14 +200,22 @@ void WebViewPlugin::updateGeometry(const WebRect& window_rect,
|
| const WebRect& unobscured_rect,
|
| const WebVector<WebRect>& cut_outs_rects,
|
| bool is_visible) {
|
| + base::AutoReset<bool> is_painting(
|
| + &is_resizing_, true);
|
| +
|
| if (static_cast<gfx::Rect>(window_rect) != rect_) {
|
| rect_ = window_rect;
|
| WebSize newSize(window_rect.width, window_rect.height);
|
| web_view_->resize(newSize);
|
| }
|
|
|
| - if (delegate_)
|
| + 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();
|
| + }
|
| }
|
|
|
| void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) {
|
| @@ -293,6 +302,14 @@ void WebViewPlugin::didChangeCursor(const WebCursorInfo& cursor) {
|
| }
|
|
|
| void WebViewPlugin::scheduleAnimation() {
|
| + // Resizes must be self-contained: any lifecycle updating must
|
| + // be triggerd from within the WebView or this WebViewPlugin.
|
| + // This is because this WebViewPlugin is contained in another
|
| + // Web View which may be in the middle of updating its lifecycle,
|
| + // but after layout is done, and it is illegal to dirty earlier
|
| + // lifecycle stages during later ones.
|
| + if (is_resizing_)
|
| + return;
|
| if (container_) {
|
| // This should never happen; see also crbug.com/545039 for context.
|
| CHECK(!is_painting_);
|
|
|