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

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

Issue 2211263003: WebViewPlugin: Make WebView resize take place synchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 | « no previous file | 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 ed0adbc0fe6950024154d026e3230004845dd7c3..7992f78bc5eca6fc5724d0cddc8f52d50094dfc8 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,13 @@ 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();
- }
+ // The delegate may instantiate a new plugin.
+ 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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698