Title: [144236] trunk
Revision
144236
Author
[email protected]
Date
2013-02-27 14:05:07 -0800 (Wed, 27 Feb 2013)

Log Message

Plugin in iframe may not display
https://bugs.webkit.org/show_bug.cgi?id=109879

Patch by John Bauman <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144235 => 144236)


--- trunk/LayoutTests/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/LayoutTests/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,18 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        Plugin in iframe may not display
+        https://bugs.webkit.org/show_bug.cgi?id=109879
+
+        Reviewed by Simon Fraser.
+
+        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.
+
 2013-02-27  Chris Rogers  <[email protected]>
 
         Implement channel up-mixing and down-mixing rules

Added: trunk/LayoutTests/platform/mac/plugins/plugin-clip-subframe-expected.txt (0 => 144236)


--- trunk/LayoutTests/platform/mac/plugins/plugin-clip-subframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/plugins/plugin-clip-subframe-expected.txt	2013-02-27 22:05:07 UTC (rev 144236)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 3: NPP_SetWindow: NULL window, Rect {18, 218, 300, 150}, Clip Rect {0, 600, 0, 600}, Type 0
+CONSOLE MESSAGE: line 3: NPP_SetWindow: NULL window, Rect {18, 218, 300, 150}, Clip Rect {18, 218, 108, 368}, Type 0
+

Added: trunk/LayoutTests/platform/mac-wk2/plugins/plugin-clip-subframe-expected.txt (0 => 144236)


--- trunk/LayoutTests/platform/mac-wk2/plugins/plugin-clip-subframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/plugins/plugin-clip-subframe-expected.txt	2013-02-27 22:05:07 UTC (rev 144236)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 3: NPP_SetWindow: NULL window, Rect {0, 0, 300, 150}, Clip Rect {0, 0, 0, 0}, Type 2
+CONSOLE MESSAGE: line 3: NPP_SetWindow: NULL window, Rect {0, 0, 300, 150}, Clip Rect {0, 0, 0, 0}, Type 2
+CONSOLE MESSAGE: line 3: NPP_SetWindow: NULL window, Rect {0, 0, 300, 150}, Clip Rect {0, 0, 300, 150}, Type 2
+

Added: trunk/LayoutTests/plugins/plugin-clip-subframe-expected.txt (0 => 144236)


--- trunk/LayoutTests/plugins/plugin-clip-subframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/plugins/plugin-clip-subframe-expected.txt	2013-02-27 22:05:07 UTC (rev 144236)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 3: NPP_SetWindow: non-NULL window, Rect {18, 218, 300, 150}, Clip Rect {65518, 65318, 65518, 65318}, Type 1
+CONSOLE MESSAGE: line 3: NPP_SetWindow: non-NULL window, Rect {18, 218, 300, 150}, Clip Rect {0, 0, 90, 150}, Type 1
+

Added: trunk/LayoutTests/plugins/plugin-clip-subframe.html (0 => 144236)


--- trunk/LayoutTests/plugins/plugin-clip-subframe.html	                        (rev 0)
+++ trunk/LayoutTests/plugins/plugin-clip-subframe.html	2013-02-27 22:05:07 UTC (rev 144236)
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+<script>
+function test() {
+    // Increase the size of the container so the iframe becomes visible.
+    document.getElementById("container").style.height = "400px";
+    setTimeout(done, 10);
+}
+
+function done() {
+    if (testRunner) {
+        testRunner.dumpAsText();
+        testRunner.notifyDone();
+    }
+}
+
+function runTest() {
+    if (testRunner)
+        testRunner.waitUntilDone();
+    setTimeout(test, 10);
+}
+</script>
+<body _onload_="runTest()">
+
+<div id = "container" style="overflow: hidden; width:100px; height:100px">
+<iframe id='subframe' src='' width=500 height=500 style="margin-top:200px"></iframe>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/plugins/resources/plugin-clip-subframe-iframe.html (0 => 144236)


--- trunk/LayoutTests/plugins/resources/plugin-clip-subframe-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/plugins/resources/plugin-clip-subframe-iframe.html	2013-02-27 22:05:07 UTC (rev 144236)
@@ -0,0 +1,7 @@
+<script>
+function windowWasSet(msg) {
+    console.log(msg);
+}
+</script>
+
+<embed id="testCPlugin" type="application/x-webkit-test-netscape" test="log-npp-set-window"></embed>

Modified: trunk/Source/WebCore/ChangeLog (144235 => 144236)


--- trunk/Source/WebCore/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,28 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        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  <[email protected]>
 
         Implement channel up-mixing and down-mixing rules

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (144235 => 144236)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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)
 {

Modified: trunk/Source/WebCore/platform/ScrollView.h (144235 => 144236)


--- trunk/Source/WebCore/platform/ScrollView.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/platform/ScrollView.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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);
 

Modified: trunk/Source/WebCore/platform/Widget.h (144235 => 144236)


--- trunk/Source/WebCore/platform/Widget.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/platform/Widget.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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; }

Modified: trunk/Source/WebCore/plugins/PluginView.cpp (144235 => 144236)


--- trunk/Source/WebCore/plugins/PluginView.cpp	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/plugins/PluginView.cpp	2013-02-27 22:05:07 UTC (rev 144236)
@@ -158,6 +158,11 @@
     updatePluginWidget();
 }
 
+void PluginView::clipRectChanged()
+{
+    updatePluginWidget();
+}
+
 void PluginView::handleEvent(Event* event)
 {
     if (!m_plugin || m_isWindowed)

Modified: trunk/Source/WebCore/plugins/PluginView.h (144235 => 144236)


--- trunk/Source/WebCore/plugins/PluginView.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/plugins/PluginView.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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.

Modified: trunk/Source/WebCore/rendering/RenderWidget.cpp (144235 => 144236)


--- trunk/Source/WebCore/rendering/RenderWidget.cpp	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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())

Modified: trunk/Source/WebKit/chromium/ChangeLog (144235 => 144236)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,16 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        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  <[email protected]>
 
         RenderTableCellDeathTest unit test fails on mac

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (144235 => 144236)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h (144235 => 144236)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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

Modified: trunk/Source/WebKit/mac/ChangeLog (144235 => 144236)


--- trunk/Source/WebKit/mac/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,16 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        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  <[email protected]>
 
         Don't add a body to platform request until necessary

Modified: trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h (144235 => 144236)


--- trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -99,6 +99,7 @@
 - (void)handleMouseExited:(NSEvent *)event;
 - (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
 - (void)focusChanged;
+- (void)updateAndSetWindow;
 
 - (WebFrame *)webFrame;
 - (WebDataSource *)dataSource;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (144235 => 144236)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-02-27 22:05:07 UTC (rev 144236)
@@ -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)
     {

Modified: trunk/Source/WebKit2/ChangeLog (144235 => 144236)


--- trunk/Source/WebKit2/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,16 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        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  <[email protected]>
 
         REGRESSION (48533): Full-frame plugins stopped working (download instead of loading the plugin)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (144235 => 144236)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-02-27 22:05:07 UTC (rev 144236)
@@ -738,6 +738,11 @@
     viewGeometryDidChange();
 }
 
+void PluginView::clipRectChanged()
+{
+    viewGeometryDidChange();
+}
+
 void PluginView::setParent(ScrollView* scrollView)
 {
     Widget::setParent(scrollView);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (144235 => 144236)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-02-27 22:05:07 UTC (rev 144236)
@@ -160,6 +160,7 @@
     virtual void show();
     virtual void hide();
     virtual bool transformsAffectFrameRect();
+    virtual void clipRectChanged() OVERRIDE;
 
     // WebCore::MediaCanStartListener
     virtual void mediaCanStart();

Modified: trunk/Tools/ChangeLog (144235 => 144236)


--- trunk/Tools/ChangeLog	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Tools/ChangeLog	2013-02-27 22:05:07 UTC (rev 144236)
@@ -1,3 +1,15 @@
+2013-02-27  John Bauman  <[email protected]>
+
+        Plugin in iframe may not display
+        https://bugs.webkit.org/show_bug.cgi?id=109879
+
+        Reviewed by Simon Fraser.
+
+        LogNPPSetWindow will be used with other ports as well.
+
+        * DumpRenderTree/DumpRenderTree.gypi:
+        * DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
+
 2013-02-27  Jochen Eisinger  <[email protected]>
 
         plugins/netscape-plugin-setwindow-size*.html and plugins/pass-different-npp-struct.html should be async

Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.gypi (144235 => 144236)


--- trunk/Tools/DumpRenderTree/DumpRenderTree.gypi	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.gypi	2013-02-27 22:05:07 UTC (rev 144236)
@@ -113,6 +113,7 @@
             'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp',
             'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp',
             'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp',
+            'TestNetscapePlugIn/Tests/LogNPPSetWindow.cpp',
             'TestNetscapePlugIn/Tests/NPPNewFails.cpp',
             'TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp',
             'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp',

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt (144235 => 144236)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2013-02-27 21:46:32 UTC (rev 144235)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2013-02-27 22:05:07 UTC (rev 144236)
@@ -13,6 +13,7 @@
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURL.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp
+    ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/LogNPPSetWindow.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPDeallocateCalledBeforeNPShutdown.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPNewFails.cpp
     ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPSetWindowCalledDuringDestruction.cpp
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to