diff options
Diffstat (limited to 'components/plugins/renderer/webview_plugin.cc')
-rw-r--r-- | components/plugins/renderer/webview_plugin.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc index c8ef592..26525de 100644 --- a/components/plugins/renderer/webview_plugin.cc +++ b/components/plugins/renderer/webview_plugin.cc @@ -49,7 +49,8 @@ WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate, container_(NULL), web_view_(WebView::create(this)), finished_loading_(false), - focused_(false) { + focused_(false), + animationNeeded_(false) { // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a // consistent view of our preferences. content::RenderView::ApplyWebPreferences(preferences, web_view_); @@ -147,10 +148,18 @@ v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) { } void WebViewPlugin::layoutIfNeeded() { + animationNeeded_ = false; web_view_->layout(); } void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { + // Do not paint before the container is set (that is, before initialize() has + // been called). We will be asked to paint again thanks to the initialize() + // method calling setNeedsLayout on the container. Without this check we + // may attempt to paint before the WebView's frame has been laid-out. + if (animationNeeded_) + return; + gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect); if (paint_rect.IsEmpty()) return; @@ -270,6 +279,7 @@ void WebViewPlugin::didChangeCursor(const WebCursorInfo& cursor) { } void WebViewPlugin::scheduleAnimation() { + animationNeeded_ = true; if (container_) container_->setNeedsLayout(); } |