Plugin in iframe may not display
https://bugs.webkit.org/show_bug.cgi?id=109879
Patch by John Bauman <jbauman@chromium.org> on 2013-02-27
Reviewed by Simon Fraser.
Source/WebCore:
Changing the cliprect on a layer containing an iframe may change the
cliprect of plugins inside the iframe, so recursively tell all plugins
in iframes that their cliprect has changed after doing layout on the
outer frame.
Test: plugins/plugin-clip-subframe.html
* platform/ScrollView.cpp:
(WebCore::ScrollView::clipRectChanged):
* platform/ScrollView.h:
* platform/Widget.h:
(WebCore::Widget::clipRectChanged):
* plugins/PluginView.cpp:
(WebCore::PluginView::clipRectChanged):
* plugins/PluginView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::setWidgetGeometry):
Source/WebKit/chromium:
Use clipRectChanged to update the geometry.
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::clipRectChanged):
* src/WebPluginContainerImpl.h:
Source/WebKit/mac:
Ensure NetscapePluginWidget informs the plugin view of the cliprect change directly.
* Plugins/WebBaseNetscapePluginView.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(NetscapePluginWidget::clipRectChanged):
Source/WebKit2:
Update geometry when cliprect changes.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::clipRectChanged):
* WebProcess/Plugins/PluginView.h:
Tools:
LogNPPSetWindow will be used with other ports as well.
* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
LayoutTests:
Use log-npp-set-window to ensure plugin clip changes correctly.
* platform/mac-wk2/plugins/plugin-clip-subframe-expected.txt: Added.
* platform/mac/plugins/plugin-clip-subframe-expected.txt: Added.
* plugins/plugin-clip-subframe-expected.txt: Added.
* plugins/plugin-clip-subframe.html: Added.
* plugins/resources/plugin-clip-subframe-iframe.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7b8f293..68edfac 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2013-02-27 John Bauman <jbauman@chromium.org>
+
+ Plugin in iframe may not display
+ https://bugs.webkit.org/show_bug.cgi?id=109879
+
+ Reviewed by Simon Fraser.
+
+ Changing the cliprect on a layer containing an iframe may change the
+ cliprect of plugins inside the iframe, so recursively tell all plugins
+ in iframes that their cliprect has changed after doing layout on the
+ outer frame.
+
+ Test: plugins/plugin-clip-subframe.html
+
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::clipRectChanged):
+ * platform/ScrollView.h:
+ * platform/Widget.h:
+ (WebCore::Widget::clipRectChanged):
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::clipRectChanged):
+ * plugins/PluginView.h:
+ * rendering/RenderWidget.cpp:
+ (WebCore::RenderWidget::setWidgetGeometry):
+
2013-02-27 Chris Rogers <crogers@google.com>
Implement channel up-mixing and down-mixing rules
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 27038d3..3c97a85 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -887,6 +887,13 @@
(*current)->frameRectsChanged();
}
+void ScrollView::clipRectChanged()
+{
+ HashSet<RefPtr<Widget> >::const_iterator end = m_children.end();
+ for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current)
+ (*current)->clipRectChanged();
+}
+
#if USE(ACCELERATED_COMPOSITING)
static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scrollbar)
{
diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h
index a31645d..d04c3e8 100644
--- a/Source/WebCore/platform/ScrollView.h
+++ b/Source/WebCore/platform/ScrollView.h
@@ -243,6 +243,9 @@
// Widget override to update our scrollbars and notify our contents of the resize.
virtual void setFrameRect(const IntRect&);
+ // Widget override to notify our contents of a cliprect change.
+ virtual void clipRectChanged() OVERRIDE;
+
// For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
diff --git a/Source/WebCore/platform/Widget.h b/Source/WebCore/platform/Widget.h
index c2c7c6d..515421e 100644
--- a/Source/WebCore/platform/Widget.h
+++ b/Source/WebCore/platform/Widget.h
@@ -210,6 +210,9 @@
// Notifies this widget that other widgets on the page have been repositioned.
virtual void widgetPositionsUpdated() {}
+ // Notifies this widget that its clip rect changed.
+ virtual void clipRectChanged() { }
+
// Whether transforms affect the frame rect. FIXME: We get rid of this and have
// the frame rects be the same no matter what transforms are applied.
virtual bool transformsAffectFrameRect() { return true; }
diff --git a/Source/WebCore/plugins/PluginView.cpp b/Source/WebCore/plugins/PluginView.cpp
index 7d92bec..af0576f 100644
--- a/Source/WebCore/plugins/PluginView.cpp
+++ b/Source/WebCore/plugins/PluginView.cpp
@@ -158,6 +158,11 @@
updatePluginWidget();
}
+void PluginView::clipRectChanged()
+{
+ updatePluginWidget();
+}
+
void PluginView::handleEvent(Event* event)
{
if (!m_plugin || m_isWindowed)
diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h
index 84e62d8..b333480 100644
--- a/Source/WebCore/plugins/PluginView.h
+++ b/Source/WebCore/plugins/PluginView.h
@@ -210,6 +210,7 @@
virtual void show();
virtual void hide();
virtual void paint(GraphicsContext*, const IntRect&);
+ virtual void clipRectChanged() OVERRIDE;
// This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore,
// e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space.
diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp
index c07681f..c8dc5da 100644
--- a/Source/WebCore/rendering/RenderWidget.cpp
+++ b/Source/WebCore/rendering/RenderWidget.cpp
@@ -155,6 +155,9 @@
RenderWidgetProtector protector(this);
RefPtr<Node> protectedNode(node());
m_widget->setFrameRect(newFrame);
+
+ if (clipChanged && !boundsChanged)
+ m_widget->clipRectChanged();
#if USE(ACCELERATED_COMPOSITING)
if (hasLayer() && layer()->isComposited())
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 6aba331..3a23679 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,16 @@
+2013-02-27 John Bauman <jbauman@chromium.org>
+
+ Plugin in iframe may not display
+ https://bugs.webkit.org/show_bug.cgi?id=109879
+
+ Reviewed by Simon Fraser.
+
+ Use clipRectChanged to update the geometry.
+
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::clipRectChanged):
+ * src/WebPluginContainerImpl.h:
+
2013-02-27 Stephen Chenney <schenney@chromium.org>
RenderTableCellDeathTest unit test fails on mac
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
index 180002e..6e4dde6 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
@@ -222,6 +222,11 @@
reportGeometry();
}
+void WebPluginContainerImpl::clipRectChanged()
+{
+ reportGeometry();
+}
+
void WebPluginContainerImpl::setParentVisible(bool parentVisible)
{
// We override this function to make sure that geometry updates are sent
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
index bb2f4ea..19d397d 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
@@ -92,6 +92,7 @@
virtual void setParentVisible(bool);
virtual void setParent(WebCore::ScrollView*);
virtual void widgetPositionsUpdated();
+ virtual void clipRectChanged() OVERRIDE;
virtual bool isPluginContainer() const { return true; }
// WebPluginContainer methods
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index a51e6ae2..02764bf 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,16 @@
+2013-02-27 John Bauman <jbauman@chromium.org>
+
+ Plugin in iframe may not display
+ https://bugs.webkit.org/show_bug.cgi?id=109879
+
+ Reviewed by Simon Fraser.
+
+ Ensure NetscapePluginWidget informs the plugin view of the cliprect change directly.
+
+ * Plugins/WebBaseNetscapePluginView.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (NetscapePluginWidget::clipRectChanged):
+
2013-02-26 Alexey Proskuryakov <ap@apple.com>
Don't add a body to platform request until necessary
diff --git a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 4b4d6dc..9b933f4 100644
--- a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -99,6 +99,7 @@
- (void)handleMouseExited:(NSEvent *)event;
- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
- (void)focusChanged;
+- (void)updateAndSetWindow;
- (WebFrame *)webFrame;
- (WebDataSource *)dataSource;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index a6d2cbc..2f7b587 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1585,6 +1585,12 @@
event->setDefaultHandled(); // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one.
}
+ virtual void clipRectChanged()
+ {
+ // Changing the clip rect doesn't affect the view hierarchy, so the plugin must be told about the change directly.
+ [(WebBaseNetscapePluginView *)platformWidget() updateAndSetWindow];
+ }
+
private:
virtual void notifyWidget(WidgetNotification notification)
{
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 7b62aa1..bcb47f7 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,16 @@
+2013-02-27 John Bauman <jbauman@chromium.org>
+
+ Plugin in iframe may not display
+ https://bugs.webkit.org/show_bug.cgi?id=109879
+
+ Reviewed by Simon Fraser.
+
+ Update geometry when cliprect changes.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::clipRectChanged):
+ * WebProcess/Plugins/PluginView.h:
+
2013-02-27 Jer Noble <jer.noble@apple.com>
REGRESSION (48533): Full-frame plugins stopped working (download instead of loading the plugin)
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
index 8df14cb..d9c2005 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -738,6 +738,11 @@
viewGeometryDidChange();
}
+void PluginView::clipRectChanged()
+{
+ viewGeometryDidChange();
+}
+
void PluginView::setParent(ScrollView* scrollView)
{
Widget::setParent(scrollView);
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h
index eec236a..386da86 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h
@@ -160,6 +160,7 @@
virtual void show();
virtual void hide();
virtual bool transformsAffectFrameRect();
+ virtual void clipRectChanged() OVERRIDE;
// WebCore::MediaCanStartListener
virtual void mediaCanStart();