Title: [127252] branches/safari-536.26-branch

Diff

Modified: branches/safari-536.26-branch/LayoutTests/ChangeLog (127251 => 127252)


--- branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-31 13:17:25 UTC (rev 127252)
@@ -1,3 +1,17 @@
+2012-08-31  Timothy Hatcher  <[email protected]>
+
+        Merge r127047.
+
+    2012-08-29  Brady Eidson  <[email protected]>
+
+        REGRESSION: Not sending NPP_SetWindow is causing Flash to not throttle itself
+        <rdar://problem/12133021> and https://bugs.webkit.org/show_bug.cgi?id=95274
+
+        Reviewed by Sam Weinig.
+
+        * platform/mac-wk2/plugins/npp-setwindow-called-on-scroll-expected.txt: Added.
+        * platform/mac-wk2/plugins/npp-setwindow-called-on-scroll.html: Added.
+
 2012-08-24  Mark Lam  <[email protected]>
 
         Re-merge test expectations from r126219. Fixes previous bad merge.

Added: branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll-expected.txt (0 => 127252)


--- branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll-expected.txt	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll-expected.txt	2012-08-31 13:17:25 UTC (rev 127252)
@@ -0,0 +1,15 @@
+a div
+
+another div
+Tests that netscape plugins get appropriate calls to NPP_SetWindow when scrolled out of view or back in to view.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS NPP_SetWindow called with expected parameters
+PASS NPP_SetWindow called with expected parameters
+PASS NPP_SetWindow called with expected parameters
+PASS NPP_SetWindow called with expected parameters
+PASS NPP_SetWindow called with expected parameters
+PASS NPP_SetWindow called with expected parameters
+

Added: branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll.html (0 => 127252)


--- branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll.html	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/platform/mac-wk2/plugins/npp-setwindow-called-on-scroll.html	2012-08-31 13:17:25 UTC (rev 127252)
@@ -0,0 +1,62 @@
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+window.resizeTo(200,500);
+
+var windowWasSetCount = 0;
+
+var windowWasSetCommands = [
+    null, // The plug-in gets setWindow called explicitly during initialization, the clip rect should be empty.
+    null, // The plug-in gets setWindow called during initialization as a side effect of being told its window is visible, the clip rect should be empty.
+    "window.scrollTo(0, 700)",  // This should scroll the plug-in partially into view, the clip rect should be non-empty.
+    "window.scrollTo(0, 0)",    // This should scroll the plug-in back out of view, the clip rect should be empty.
+    "window.scrollTo(0, 1000)", // This should scroll the plug-in fully into view, the clip rect should be non-empty.
+    "window.scrollTo(0, 1300)", // This should scroll the plug-in back out of view, the clip rect should be empty.
+    "finishTest()"];
+
+// Note: These expected results will change once https://bugs.webkit.org/show_bug.cgi?id=95274 is resolved.
+var windowWasSetExpectedResults = [
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 0, 0}, Type 2", 
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 0, 0}, Type 2", 
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 200, 100}, Type 2", 
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 0, 0}, Type 2", 
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 200, 100}, Type 2", 
+    "NPP_SetWindow: NULL window, Rect {0, 0, 200, 100}, Clip Rect {0, 0, 0, 0}, Type 2"];
+    
+function windowWasSet(msg)
+{
+    if (msg == windowWasSetExpectedResults[windowWasSetCount])
+        testPassed("NPP_SetWindow called with expected parameters");
+    else
+        testFailed("NPP_SetWindow called with: " + msg + " but we expected " + windowWasSetExpectedResults[windowWasSetCount] + "... Maybe bug 95362 has been fixed?");
+
+    ++windowWasSetCount;    
+    if (windowWasSetCommands[windowWasSetCount])
+        eval(windowWasSetCommands[windowWasSetCount]);
+}
+
+function finishTest()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+
+</head>
+<body style="margin:0 0 0 0;">
+<div style="width:200px; height:1000px; background-color:red;">a div</div>
+<embed id="TestElement" type="application/x-webkit-test-netscape" test="log-npp-set-window" style="width:200px; height:100px; background-color:yellow;"></embed>
+<div style="width:200px; height:1000px; background-color:red;">another div</div>
+<p id="description"></p>
+<div id="console"></div>
+</body>
+
+<script>
+description("Tests that netscape plugins get appropriate calls to NPP_SetWindow when scrolled out of view or back in to view.");
+</script>

Modified: branches/safari-536.26-branch/Source/WebKit2/ChangeLog (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-08-31 13:17:25 UTC (rev 127252)
@@ -1,3 +1,32 @@
+2012-08-31  Timothy Hatcher  <[email protected]>
+
+        Merge r127047.
+
+    2012-08-29  Brady Eidson  <[email protected]>
+
+        REGRESSION: Not sending NPP_SetWindow is causing Flash to not throttle itself
+        <rdar://problem/12133021> and https://bugs.webkit.org/show_bug.cgi?id=95274
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView viewDidMoveToWindow]): Previously we'd only update window visibility when the window is hidden.
+          Now we also update window visibility when the window is shown.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::callSetWindowInvisible): Call set window with a manufactured empty clip rect to tell
+          the plug-in that it is complete hidden.
+        (WebKit):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        (NetscapePlugin):
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::windowVisibilityChanged): Call "callSetWindow" or "callSetWindowInvisible" as appropriate.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::setWindowIsVisible): Tell the plugin that its visibility changed.
+        (WebKit::PluginView::viewGeometryDidChange): Grab a clip rect that - although incorrect - at least is correct if
+          the PluginView is completely hidden.
+
 2012-08-20  Mark Rowe  <[email protected]>
 
         Merge r126041.

Modified: branches/safari-536.26-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-08-31 13:17:25 UTC (rev 127252)
@@ -1918,6 +1918,7 @@
 
         [self _accessibilityRegisterUIProcessTokens];
     } else {
+        [self _updateWindowVisibility];
         _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
         _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow);
 

Modified: branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-08-31 13:17:25 UTC (rev 127252)
@@ -508,6 +508,20 @@
     m_hasCalledSetWindow = true;
 }
 
+void NetscapePlugin::callSetWindowInvisible()
+{
+    NPWindow invisibleWindow = m_npWindow;
+    
+    invisibleWindow.window = 0;
+    invisibleWindow.clipRect.top = 0;
+    invisibleWindow.clipRect.left = 0;
+    invisibleWindow.clipRect.bottom = 0;
+    invisibleWindow.clipRect.right = 0;
+    
+    NPP_SetWindow(&invisibleWindow);
+    m_hasCalledSetWindow = true;
+}
+
 bool NetscapePlugin::shouldLoadSrcURL()
 {
     // Check if we should cancel the load

Modified: branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-08-31 13:17:25 UTC (rev 127252)
@@ -141,6 +141,7 @@
     NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule);
 
     void callSetWindow();
+    void callSetWindowInvisible();
     bool shouldLoadSrcURL();
     NetscapePluginStream* streamFromID(uint64_t streamID);
     void stopAllStreams();

Modified: branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2012-08-31 13:17:25 UTC (rev 127252)
@@ -912,9 +912,12 @@
     }
 }
     
-void NetscapePlugin::windowVisibilityChanged(bool)
+void NetscapePlugin::windowVisibilityChanged(bool visible)
 {
-    // FIXME: Implement.
+    if (visible)
+        callSetWindow();
+    else
+        callSetWindowInvisible();
 }
 
 uint64_t NetscapePlugin::pluginComplexTextInputIdentifier() const

Modified: branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (127251 => 127252)


--- branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-08-31 13:17:25 UTC (rev 127252)
@@ -404,7 +404,7 @@
     if (!m_plugin)
         return;
 
-    // FIXME: Implement.
+    m_plugin->windowVisibilityChanged(windowIsVisible);
 }
 
 void PluginView::setWindowIsFocused(bool windowIsFocused)
@@ -756,8 +756,13 @@
     transform.translate(scaledLocationInRootViewCoordinates.x(), scaledLocationInRootViewCoordinates.y());
     transform.scale(pageScaleFactor);
 
-    // FIXME: The clip rect isn't correct.
-    IntRect clipRect = boundsRect();
+    // FIXME: This clip rect isn't correct.
+    // But it is still important distinguish between empty and non-empty rects so we can notify the plug-in when it becomes invisible.
+    // Making the rect actually correct is covered by https://bugs.webkit.org/show_bug.cgi?id=95362
+    IntRect clipRect = clipRectInWindowCoordinates();
+    if (!clipRect.isEmpty())
+        clipRect = boundsRect();
+        
     m_plugin->geometryDidChange(size(), clipRect, transform);
 }
 

Modified: branches/safari-536.26-branch/Tools/ChangeLog (127251 => 127252)


--- branches/safari-536.26-branch/Tools/ChangeLog	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Tools/ChangeLog	2012-08-31 13:17:25 UTC (rev 127252)
@@ -1,3 +1,23 @@
+2012-08-31  Timothy Hatcher  <[email protected]>
+
+        Merge r127047.
+
+    2012-08-29  Brady Eidson  <[email protected]>
+
+        REGRESSION: Not sending NPP_SetWindow is causing Flash to not throttle itself
+        <rdar://problem/12133021> and https://bugs.webkit.org/show_bug.cgi?id=95274
+
+        Reviewed by Sam Weinig.
+
+        Add a test plug-in that calls back into the page with info on the NPWindow passed
+        in to NPP_SetWindow.
+
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+        * DumpRenderTree/TestNetscapePlugIn/Tests/LogNPPSetWindow.cpp: Added.
+        (LogNPPSetWindow):
+        (LogNPPSetWindow::LogNPPSetWindow):
+        (LogNPPSetWindow::NPP_SetWindow):
+
 2012-08-010  Lucas Forschler  <[email protected]>
 
     Rollout r124956.

Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (127251 => 127252)


--- branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj	2012-08-31 12:58:52 UTC (rev 127251)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj	2012-08-31 13:17:25 UTC (rev 127252)
@@ -70,6 +70,7 @@
 		515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */; };
 		5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; };
 		5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F69E10714A57007AA393 /* HistoryDelegate.h */; };
+		515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */; };
 		53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */; };
 		53CBB833134E42F3001CE6A4 /* CyclicRedundancyCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */; };
 		5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */ = {isa = PBXBuildFile; fileRef = AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */; };
@@ -285,6 +286,7 @@
 		A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; };
 		A817090308B164D300CCB9FB /* _javascript_Core.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = _javascript_Core.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		A84F608908B136DA00E9745F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+		515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LogNPPSetWindow.cpp; sourceTree = "<group>"; };
 		A8B91AD70CF3B32F008F91FF /* DumpRenderTreePasteboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DumpRenderTreePasteboard.m; path = mac/DumpRenderTreePasteboard.m; sourceTree = "<group>"; };
 		A8B91AD90CF3B32F008F91FF /* DumpRenderTreeWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeWindow.mm; path = mac/DumpRenderTreeWindow.mm; sourceTree = "<group>"; };
 		A8B91ADD0CF3B372008F91FF /* DumpRenderTreeWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreeWindow.h; path = mac/DumpRenderTreeWindow.h; sourceTree = "<group>"; };
@@ -534,6 +536,7 @@
 				1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */,
 				1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */,
 				1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */,
+				515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */,
 				1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */,
 				C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */,
 				1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */,
@@ -896,6 +899,7 @@
 		};
 		2D403ED8150871F9005358D2 /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
+				515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */,
 			buildActionMask = 2147483647;
 			files = (
 				2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */,

Added: branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LogNPPSetWindow.cpp (0 => 127252)


--- branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LogNPPSetWindow.cpp	                        (rev 0)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LogNPPSetWindow.cpp	2012-08-31 13:17:25 UTC (rev 127252)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginTest.h"
+
+using namespace std;
+
+class LogNPPSetWindow : public PluginTest {
+public:
+    LogNPPSetWindow(NPP, const string& identifier);
+
+private:
+    virtual NPError NPP_SetWindow(NPWindow*);
+};
+
+LogNPPSetWindow::LogNPPSetWindow(NPP npp, const string& identifier)
+    : PluginTest(npp, identifier)
+{
+}
+
+NPError LogNPPSetWindow::NPP_SetWindow(NPWindow* window)
+{
+    char message[1024];
+    snprintf(message, 1024, "NPP_SetWindow: %s window, Rect {%i, %i, %i, %i}, Clip Rect {%i, %i, %i, %i}, Type %i",
+        window->window ? "non-NULL" : "NULL", window->x, window->y, window->width, window->height,
+        window->clipRect.left, window->clipRect.top, window->clipRect.right, window->clipRect.bottom,
+        window->type);
+    
+    char script[1536];
+    snprintf(script, 1536, "window.setTimeout('windowWasSet(\"%s\");', 0);", message);
+
+    executeScript(script);
+
+    return NPERR_NO_ERROR;
+}
+
+static PluginTest::Register<LogNPPSetWindow> registrar("log-npp-set-window");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to