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 995ff09bcff0f2cb0ae812f3dd4bd43979a69c86..3186391bdf6bd479d80aca509ec9ab6df5ebf070 100644 |
| --- a/components/plugins/renderer/webview_plugin.cc |
| +++ b/components/plugins/renderer/webview_plugin.cc |
| @@ -55,7 +55,8 @@ WebViewPlugin::WebViewPlugin(content::RenderView* render_view, |
| container_(nullptr), |
| web_view_(WebView::create(this)), |
| finished_loading_(false), |
| - focused_(false) { |
| + focused_(false), |
| + is_painting_(false) { |
| // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a |
| // consistent view of our preferences. |
| content::RenderView::ApplyWebPreferences(preferences, web_view_); |
| @@ -172,6 +173,8 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| if (paint_rect.IsEmpty()) |
| return; |
| + is_painting_ = true; |
|
tommycli
2016/02/08 22:20:43
Seems like this should use base::AutoReset
chrishtr
2016/02/08 22:43:38
Done.
|
| + |
| paint_rect.Offset(-rect_.x(), -rect_.y()); |
| canvas->save(); |
| @@ -186,6 +189,7 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| web_view_->paint(canvas, paint_rect); |
| canvas->restore(); |
| + is_painting_ = false; |
| } |
| // Coordinates are relative to the containing window. |
| @@ -288,7 +292,7 @@ void WebViewPlugin::didChangeCursor(const WebCursorInfo& cursor) { |
| } |
| void WebViewPlugin::scheduleAnimation() { |
| - if (container_) |
| + if (container_ && !is_painting_) |
|
tommycli
2016/02/08 22:20:43
If this should not happen anyways, shouldn't this
chrishtr
2016/02/08 22:43:39
Added DCHECK plus defensive logic.
|
| container_->setNeedsLayout(); |
| } |