Reviewed by Darin Adler.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Mar 2010 20:40:28 +0000 (20:40 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Mar 2010 20:40:28 +0000 (20:40 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=36184
        YouTube video resizing doesn't work with OOP plug-ins

        Test: plugins/resize-from-plugin.html

        We were calling _WKPHResizePluginInstance synchronously or asynchronously, depending on
        whether the size has changed. But sync and async messages are not necessarily delivered in
        order - plug-in host listens only to the former while waiting for a response to a message it
        sent (a call to invoke() in this case).

        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
        (WebKit::NetscapePluginInstanceProxy::resize):
        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
        (-[WebHostedNetscapePluginView updateAndSetWindow]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@56079 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/plugins/resize-from-plugin-expected.txt [new file with mode: 0644]
LayoutTests/plugins/resize-from-plugin.html [new file with mode: 0644]
LayoutTests/plugins/resources/resize-from-plugin-frame.html [new file with mode: 0644]
WebKit/mac/ChangeLog
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm

index 685845c..13863d1 100644 (file)
@@ -1,3 +1,18 @@
+2010-03-16  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36184
+        YouTube video resizing doesn't work with OOP plug-ins
+
+        This test is quite fragile, as it depends on when exactly WebCore decides to do layout.
+        If WebCore logic changes, the test will just always pass without executing the code path
+        in question.
+
+        * plugins/resize-from-plugin-expected.txt: Added.
+        * plugins/resize-from-plugin.html: Added.
+        * plugins/resources/resize-from-plugin-frame.html: Added.
+
 2010-03-16  Zhenyao Mo  <zmo@google.com>
 
         Reviewed by Darin Fisher.
diff --git a/LayoutTests/plugins/resize-from-plugin-expected.txt b/LayoutTests/plugins/resize-from-plugin-expected.txt
new file mode 100644 (file)
index 0000000..2376c24
--- /dev/null
@@ -0,0 +1,13 @@
+Please follow this link for a manual test.
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+
+Test for NPP_SetWindow calls sent while a plug-in resizes itself.
+
+x: 18, y: 52, width: 200, height: 200, clipRect: (18, 52, 200, 142)
+Height and width should equal 200, and the plug-in size should not change on scroll.
+
diff --git a/LayoutTests/plugins/resize-from-plugin.html b/LayoutTests/plugins/resize-from-plugin.html
new file mode 100644 (file)
index 0000000..895589e
--- /dev/null
@@ -0,0 +1,2 @@
+<p>Please follow <a href="resources/resize-from-plugin-frame.html">this link</a> for a manual test.</p>
+<iframe src="resources/resize-from-plugin-frame.html"></iframe>
diff --git a/LayoutTests/plugins/resources/resize-from-plugin-frame.html b/LayoutTests/plugins/resources/resize-from-plugin-frame.html
new file mode 100644 (file)
index 0000000..2e68d18
--- /dev/null
@@ -0,0 +1,41 @@
+<html>
+<body>
+<embed name="plg" type="application/x-webkit-test-netscape" width="100px" height="100px">
+<p>Test for NPP_SetWindow calls sent while a plug-in resizes itself.</p>
+<pre id=result></pre>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+}
+
+function resizePlugin(width, height)
+{
+    plg.style.width = width + "px";
+    plg.style.height = height + "px";
+}
+
+function test()
+{
+    try {
+        plg.resizeTo(200, 200);
+        document.getElementById("result").innerHTML = plg.lastSetWindowArguments
+            + "\nHeight and width should equal 200, and the plug-in size should not change on scroll.";
+    } catch (ex) {
+        alert("Exception: " + ex.description + ". Test plugin was not found");
+    }
+}
+
+plg.onclick = test;
+
+if (window.eventSender) {
+    eventSender.mouseMoveTo(50, 70);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+} else
+    document.getElementById("result").innerHTML = "Please click the plug-in square above.\n&nbsp;";
+
+</script>
+<div style="visibility:hidden;height:5000px"></div>
+</body>
+</html>
index 8decc58..d10e083 100644 (file)
@@ -1,3 +1,23 @@
+2010-03-16  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36184
+        YouTube video resizing doesn't work with OOP plug-ins
+
+        Test: plugins/resize-from-plugin.html
+
+        We were calling _WKPHResizePluginInstance synchronously or asynchronously, depending on
+        whether the size has changed. But sync and async messages are not necessarily delivered in
+        order - plug-in host listens only to the former while waiting for a response to a message it
+        sent (a call to invoke() in this case).
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::resize):
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView updateAndSetWindow]):
+
 2010-03-16  Yury Semikhatsky <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index ea31356..e098247 100644 (file)
@@ -89,7 +89,7 @@ public:
     
     void pluginHostDied();
     
-    void resize(NSRect size, NSRect clipRect, bool sync);
+    void resize(NSRect size, NSRect clipRect);
     void destroy();
     void focusChanged(bool hasFocus);
     void windowFocusChanged(bool hasFocus);
index f710efe..46aec82 100644 (file)
@@ -246,19 +246,17 @@ NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
 #endif
 }
 
-void NetscapePluginInstanceProxy::resize(NSRect size, NSRect clipRect, bool sync)
+void NetscapePluginInstanceProxy::resize(NSRect size, NSRect clipRect)
 {
     uint32_t requestID = 0;
     
-    if (sync)
-        requestID = nextRequestID();
+    requestID = nextRequestID();
 
     _WKPHResizePluginInstance(m_pluginHostProxy->port(), m_pluginID, requestID,
                               size.origin.x, size.origin.y, size.size.width, size.size.height,
                               clipRect.origin.x, clipRect.origin.y, clipRect.size.width, clipRect.size.height);
     
-    if (sync)
-        waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+    waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
 }
 
 void NetscapePluginInstanceProxy::stopAllStreams()
index 156e117..0e099f9 100644 (file)
@@ -180,10 +180,9 @@ extern "C" {
     if (!shouldClipOutPlugin)
         visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
 
-    BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size);
     _previousSize = boundsInWindow.size;
     
-    _proxy->resize(boundsInWindow, visibleRectInWindow, sizeChanged);
+    _proxy->resize(boundsInWindow, visibleRectInWindow);
 }
 
 - (void)windowFocusChanged:(BOOL)hasFocus