Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Unified Diff: components/plugins/renderer/webview_plugin.cc

Issue 1677063004: Don't allow dirtying layout during paint of a plugin placeholder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698