summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/plugins/renderer/webview_plugin.cc23
-rw-r--r--components/plugins/renderer/webview_plugin.h2
-rw-r--r--components/test_runner/test_plugin.h2
-rw-r--r--content/renderer/browser_plugin/browser_plugin.h2
-rw-r--r--content/renderer/npapi/webplugin_impl.cc2
-rw-r--r--content/renderer/npapi/webplugin_impl.h2
-rw-r--r--content/renderer/pepper/pepper_webplugin_impl.h2
-rw-r--r--third_party/WebKit/Source/core/frame/FrameView.cpp2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp3
-rw-r--r--third_party/WebKit/Source/core/plugins/PluginView.h2
-rw-r--r--third_party/WebKit/Source/web/WebPluginContainerImpl.cpp14
-rw-r--r--third_party/WebKit/Source/web/WebPluginContainerImpl.h4
-rw-r--r--third_party/WebKit/Source/web/tests/FakeWebPlugin.h2
-rw-r--r--third_party/WebKit/public/web/WebPlugin.h3
-rw-r--r--third_party/WebKit/public/web/WebPluginContainer.h7
15 files changed, 40 insertions, 32 deletions
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc
index 2869a77..02d8a0e 100644
--- a/components/plugins/renderer/webview_plugin.cc
+++ b/components/plugins/renderer/webview_plugin.cc
@@ -131,8 +131,8 @@ bool WebViewPlugin::initialize(WebPluginContainer* container) {
// scheduleAnimation, but due to timers controlling widget update,
// scheduleAnimation may be invoked before this initialize call (which
// comes through the widget update process). It doesn't hurt to mark
- // for layout again, and it does help us in the race-condition situation.
- container_->setNeedsLayout();
+ // for animation again, and it does help us in the race-condition situation.
+ container_->scheduleAnimation();
old_title_ = container_->element().getAttribute("title");
@@ -161,9 +161,7 @@ v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) {
return delegate_->GetV8ScriptableObject(isolate);
}
-// TODO(wkorman): Look into renaming this to something more in line with
-// either the Blink lifecycle or Compositor layer tree host nomenclature.
-void WebViewPlugin::layoutIfNeeded() {
+void WebViewPlugin::updateAllLifecyclePhases() {
web_view_->updateAllLifecyclePhases();
}
@@ -293,8 +291,19 @@ void WebViewPlugin::didChangeCursor(const WebCursorInfo& cursor) {
}
void WebViewPlugin::scheduleAnimation() {
- if (container_)
- container_->setNeedsLayout();
+ // 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_);
+ container_->scheduleAnimation();
+ }
}
void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) {
diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h
index 20fa038..713ed659 100644
--- a/components/plugins/renderer/webview_plugin.h
+++ b/components/plugins/renderer/webview_plugin.h
@@ -88,7 +88,7 @@ class WebViewPlugin : public blink::WebPlugin,
v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate) override;
- void layoutIfNeeded() override;
+ void updateAllLifecyclePhases() override;
void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override;
// Coordinates are relative to the containing window.
diff --git a/components/test_runner/test_plugin.h b/components/test_runner/test_plugin.h
index 55c2832..65b60e4 100644
--- a/components/test_runner/test_plugin.h
+++ b/components/test_runner/test_plugin.h
@@ -63,7 +63,7 @@ class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient {
NPObject* scriptableObject() override;
bool canProcessDrag() const override;
bool supportsKeyboardFocus() const override;
- void layoutIfNeeded() override {}
+ void updateAllLifecyclePhases() override {}
void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override {}
void updateGeometry(const blink::WebRect& window_rect,
const blink::WebRect& clip_rect,
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index 79907df..b166f5e 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -88,7 +88,7 @@ class CONTENT_EXPORT BrowserPlugin :
bool supportsEditCommands() const override;
bool supportsInputMethod() const override;
bool canProcessDrag() const override;
- void layoutIfNeeded() override {}
+ void updateAllLifecyclePhases() override {}
void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override;
void updateGeometry(const blink::WebRect& window_rect,
const blink::WebRect& clip_rect,
diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc
index f5b0273..cfa4f29 100644
--- a/content/renderer/npapi/webplugin_impl.cc
+++ b/content/renderer/npapi/webplugin_impl.cc
@@ -308,7 +308,7 @@ bool WebPluginImpl::getFormValue(blink::WebString& value) {
return true;
}
-void WebPluginImpl::layoutIfNeeded() {
+void WebPluginImpl::updateAllLifecyclePhases() {
if (!container_)
return;
diff --git a/content/renderer/npapi/webplugin_impl.h b/content/renderer/npapi/webplugin_impl.h
index a7408cb..108d1b5 100644
--- a/content/renderer/npapi/webplugin_impl.h
+++ b/content/renderer/npapi/webplugin_impl.h
@@ -76,7 +76,7 @@ class WebPluginImpl : public WebPlugin,
NPObject* scriptableObject() override;
struct _NPP* pluginNPP() override;
bool getFormValue(blink::WebString& value) override;
- void layoutIfNeeded() override;
+ void updateAllLifecyclePhases() override;
void paint(blink::WebCanvas* canvas,
const blink::WebRect& paint_rect) override;
void updateGeometry(const blink::WebRect& window_rect,
diff --git a/content/renderer/pepper/pepper_webplugin_impl.h b/content/renderer/pepper/pepper_webplugin_impl.h
index d8ee01d..65641ea 100644
--- a/content/renderer/pepper/pepper_webplugin_impl.h
+++ b/content/renderer/pepper/pepper_webplugin_impl.h
@@ -46,7 +46,7 @@ class PepperWebPluginImpl : public blink::WebPlugin {
void destroy() override;
v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate) override;
bool getFormValue(blink::WebString& value) override;
- void layoutIfNeeded() override {}
+ void updateAllLifecyclePhases() override {}
void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override;
void updateGeometry(const blink::WebRect& window_rect,
const blink::WebRect& clip_rect,
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 6e36bd9..dcfefc8 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -2564,7 +2564,7 @@ void FrameView::updateStyleAndLayoutIfNeededRecursive()
const ChildrenWidgetSet* viewChildren = children();
for (const RefPtrWillBeMember<Widget>& child : *viewChildren) {
if ((*child).isPluginContainer())
- toPluginView(child.get())->layoutIfNeeded();
+ toPluginView(child.get())->updateAllLifecyclePhases();
}
// FIXME: Calling layout() shouldn't trigger script execution or have any
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
index 993d003..7f82d75 100644
--- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
@@ -134,8 +134,9 @@ void LayoutEmbeddedObject::layout()
Widget* widget = this->widget();
if (widget) {
+ // TODO(chrishtr): remove this code. It's now called in FrameView::updateStyleAndLayoutIfNeededRecursive.
if (widget->isPluginView())
- toPluginView(widget)->layoutIfNeeded();
+ toPluginView(widget)->updateAllLifecyclePhases();
} else if (frameView()) {
frameView()->addPartToUpdate(*this);
}
diff --git a/third_party/WebKit/Source/core/plugins/PluginView.h b/third_party/WebKit/Source/core/plugins/PluginView.h
index 2aaaa2b..dd18608 100644
--- a/third_party/WebKit/Source/core/plugins/PluginView.h
+++ b/third_party/WebKit/Source/core/plugins/PluginView.h
@@ -54,7 +54,7 @@ public:
virtual void didReceiveResponse(const ResourceResponse&) { }
virtual void didReceiveData(const char*, int) { }
- virtual void layoutIfNeeded() { }
+ virtual void updateAllLifecyclePhases() { }
virtual void invalidatePaintIfNeeded() { }
protected:
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index 1a9ca13..ff4e808 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -106,10 +106,12 @@ void WebPluginContainerImpl::setFrameRect(const IntRect& frameRect)
Widget::setFrameRect(frameRect);
}
-void WebPluginContainerImpl::layoutIfNeeded()
+void WebPluginContainerImpl::updateAllLifecyclePhases()
{
- RELEASE_ASSERT(m_webPlugin);
- m_webPlugin->layoutIfNeeded();
+ if (!m_webPlugin)
+ return;
+
+ m_webPlugin->updateAllLifecyclePhases();
}
void WebPluginContainerImpl::paint(GraphicsContext& context, const CullRect& cullRect) const
@@ -411,10 +413,10 @@ void WebPluginContainerImpl::scrollRect(const WebRect& rect)
invalidateRect(rect);
}
-void WebPluginContainerImpl::setNeedsLayout()
+void WebPluginContainerImpl::scheduleAnimation()
{
- if (m_element->layoutObject())
- m_element->layoutObject()->setNeedsLayoutAndFullPaintInvalidation("Plugin needs layout");
+ if (auto* frameView = m_element->document().view())
+ frameView->scheduleAnimation();
}
void WebPluginContainerImpl::reportGeometry()
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.h b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
index c765b3a..1334e89 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.h
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
@@ -77,7 +77,7 @@ public:
bool supportsInputMethod() const override;
bool canProcessDrag() const override;
bool wantsWheelEvents() override;
- void layoutIfNeeded() override;
+ void updateAllLifecyclePhases() override;
void invalidatePaintIfNeeded() override { issuePaintInvalidations(); }
// Widget methods
@@ -101,7 +101,7 @@ public:
void invalidate() override;
void invalidateRect(const WebRect&) override;
void scrollRect(const WebRect&) override;
- void setNeedsLayout() override;
+ void scheduleAnimation() override;
void reportGeometry() override;
void allowScriptObjects() override;
void clearScriptObjects() override;
diff --git a/third_party/WebKit/Source/web/tests/FakeWebPlugin.h b/third_party/WebKit/Source/web/tests/FakeWebPlugin.h
index 5b3f1c3..310cb29 100644
--- a/third_party/WebKit/Source/web/tests/FakeWebPlugin.h
+++ b/third_party/WebKit/Source/web/tests/FakeWebPlugin.h
@@ -52,7 +52,7 @@ public:
void destroy() override;
NPObject* scriptableObject() override { return 0; }
bool canProcessDrag() const override { return false; }
- void layoutIfNeeded() override { }
+ void updateAllLifecyclePhases() override { }
void paint(WebCanvas*, const WebRect&) override { }
void updateGeometry(const WebRect& clientRect, const WebRect& clipRect, const WebRect& windowClipRect, const WebVector<WebRect>& cutOutsRects, bool isVisible) override { }
void updateFocus(bool, WebFocusType) override { }
diff --git a/third_party/WebKit/public/web/WebPlugin.h b/third_party/WebKit/public/web/WebPlugin.h
index c25bc6c..8e6703a 100644
--- a/third_party/WebKit/public/web/WebPlugin.h
+++ b/third_party/WebKit/public/web/WebPlugin.h
@@ -103,8 +103,7 @@ public:
virtual bool canProcessDrag() const { return false; }
- // TODO(schenney): Make these pure virtual when chromium changes land
- virtual void layoutIfNeeded() { }
+ virtual void updateAllLifecyclePhases() = 0;
virtual void paint(WebCanvas*, const WebRect&) = 0;
// Coordinates are relative to the containing window.
diff --git a/third_party/WebKit/public/web/WebPluginContainer.h b/third_party/WebKit/public/web/WebPluginContainer.h
index 569d190..47a0d37 100644
--- a/third_party/WebKit/public/web/WebPluginContainer.h
+++ b/third_party/WebKit/public/web/WebPluginContainer.h
@@ -65,11 +65,8 @@ public:
virtual void invalidateRect(const WebRect&) = 0;
virtual void scrollRect(const WebRect&) = 0;
- // Causes the container to be marked as needing layout, which in turn will cause
- // layoutIfNeeded() to be called on any contained WebPlugin during the container's
- // web view's lifecycle update, and in particular before calling paint() on the
- // WebPlugin.
- virtual void setNeedsLayout() = 0;
+ // Schedules an animation of the WebView that contains the plugin, as well as the plugin.
+ virtual void scheduleAnimation() = 0;
// Causes the container to report its current geometry via
// WebPlugin::updateGeometry.