Changeset 86157 in webkit
- Timestamp:
- May 10, 2011 8:50:40 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r86156 r86157 1 2011-05-10 Adam Roben <aroben@apple.com> 2 3 Update some plugin tests to work with WebKit2's asynchronous windowed plugin positioning on Windows 4 5 Fixes <http://webkit.org/b/60442> <rdar://problem/9403200> REGRESSION (r85795): 6 platform/win/plugins/window-geometry-initialized-before-set-window.html and 7 platform/win/plugins/window-region-is-set-to-clip-rect.html failing on Windows 7 Release 8 (WebKit2 Tests) 9 10 Reviewed by Anders Carlsson. 11 12 * platform/win/plugins/window-geometry-initialized-before-set-window-expected.txt: Updated 13 for new test output that doesn't claim anything about the window's position. 14 15 * platform/win/plugins/window-region-is-set-to-clip-rect.html: Hide the plugin initially, 16 and tell the plugin when the load event has fired. 17 18 * platform/win-wk2/platform/win/plugins/window-geometry-initialized-before-set-window-expected.txt: Removed. 19 * platform/win-wk2/platform/win/plugins/window-region-is-set-to-clip-rect-expected.txt: Removed. 20 1 21 2011-05-10 Csaba Osztrogonác <ossy@webkit.org> 2 22 -
trunk/LayoutTests/platform/win/plugins/window-geometry-initialized-before-set-window-expected.txt
r68520 r86157 1 CONSOLE MESSAGE: line 0: PLUGIN: Plugin's HWND has been sized and positionedbefore NPP_SetWindow was called1 CONSOLE MESSAGE: line 0: PLUGIN: Plugin's HWND has been sized before NPP_SetWindow was called 2 2 3 3 This tests that a plugin's HWND is already sized and positioned before NPP_SetWindow is called. -
trunk/LayoutTests/platform/win/plugins/window-region-is-set-to-clip-rect.html
r71416 r86157 5 5 if (window.layoutTestController) 6 6 layoutTestController.dumpAsText(); 7 addEventListener('load', function() { document.getElementsByTagName('embed')[0].startTest() }, false); 7 8 </script> 8 9 <style> … … 17 18 top: -50px; 18 19 left: -50px; 20 visibility: hidden; 19 21 } 20 22 </style> -
trunk/Tools/ChangeLog
r86141 r86157 1 2011-05-10 Adam Roben <aroben@apple.com> 2 3 Update some plugin tests to work with WebKit2's asynchronous windowed plugin positioning on Windows 4 5 Fixes <http://webkit.org/b/60442> <rdar://problem/9403200> REGRESSION (r85795): 6 platform/win/plugins/window-geometry-initialized-before-set-window.html and 7 platform/win/plugins/window-region-is-set-to-clip-rect.html failing on Windows 7 Release 8 (WebKit2 Tests) 9 10 Reviewed by Anders Carlsson. 11 12 * DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp: 13 (NPNInvalidateRectInvalidatesWindow::NPP_SetWindow): Moved some code from here to the new 14 WindowedPluginTest::testHarnessWindow function. 15 16 * DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp: 17 (WindowGeometryInitializedBeforeSetWindow::NPP_SetWindow): Only check the window's size, not 18 its position. In WebKit2, the position won't have been set yet, so we can't test it. But it 19 turns out only the size mattered for <http://webkit.org/b/46716>, which this test was 20 created for. 21 22 * DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp: 23 (WindowRegionIsSetToClipRect::WindowRegionIsSetToClipRect): Converted to be a 24 WindowedPluginTest, and initialized new members. 25 (WindowRegionIsSetToClipRect::startTest): Make our plugin window visible, and set things up 26 to ensure we get a WM_WINDOWPOSCHANGED message about it becoming visible. 27 (WindowRegionIsSetToClipRect::finishTest): Check that the window region is what we expect, 28 then clean up and tell the test harness we're done. 29 (WindowRegionIsSetToClipRect::checkWindowRegion): Moved code to check the window region here 30 from NPP_SetWindow. Changed to use the fancy new log() function instead of pluginLog(). 31 (WindowRegionIsSetToClipRect::showTestHarnessWindowIfNeeded): Show the test harness's window 32 if it is hidden. This is needed to ensure we get a WM_WINDOWPOSCHANGED message when our own 33 window becomes visible. 34 (WindowRegionIsSetToClipRect::hideTestHarnessWindowIfNeeded): Hide the test harness's window 35 if it was hidden at the start of the test. 36 (WindowRegionIsSetToClipRect::wndProc): When our timer fires, tell the UI process to paint. 37 This should cause our window to become visible and our window region to get set. When we get 38 a WM_WINDOWPOSCHANGED message, we can finally finish the test. 39 (WindowRegionIsSetToClipRect::NPP_GetValue): Return our script object. 40 (WindowRegionIsSetToClipRect::ScriptObject::hasMethod): We only have one method: 41 "startTest". 42 (WindowRegionIsSetToClipRect::ScriptObject::invoke): Call through to the PluginTest object. 43 44 * DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp: 45 (WindowedPluginTest::testHarnessWindow): 46 * DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h: 47 Added this helper function. Code came from NPNInvalidateRectInvalidatesWindow. 48 1 49 2011-05-10 Csaba Osztrogonác <ossy@webkit.org> 2 50 -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
r71417 r86157 110 110 // accumulate an update region when the DWM is disabled. 111 111 112 HWND testHarnessWindow = ::GetAncestor(window(), GA_ROOT);112 HWND testHarnessWindow = this->testHarnessWindow(); 113 113 if (!testHarnessWindow) { 114 114 pluginLog(instance, "Failed to get test harness window"); -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp
r68785 r86157 64 64 } 65 65 66 HWND parent = ::GetParent(hwnd); 67 if (!parent) { 68 pluginLog(instance, "::GetParent failed"); 66 if ((rect.right - rect.left) != window->width || (rect.bottom - rect.top) != window->height) { 67 pluginLog(instance, "Size of HWND's rect and size of NPWindow's rect are not equal"); 69 68 return NPERR_GENERIC_ERROR; 70 69 } 71 70 72 // MSDN says that calling ::MapWindowPoints this way will tell it we're passing a RECT rather than two POINTs. 73 if (!::MapWindowPoints(hwnd, parent, reinterpret_cast<POINT*>(&rect), 2)) { 74 pluginLog(instance, "::MapWindowPoints failed"); 75 return NPERR_GENERIC_ERROR; 76 } 77 78 if (rect.left != window->x || rect.top != window->y || (rect.right - rect.left) != window->width || (rect.bottom - rect.top) != window->height) { 79 pluginLog(instance, "HWND's rect and NPWindow's rect are not equal"); 80 return NPERR_GENERIC_ERROR; 81 } 82 83 pluginLog(instance, "Plugin's HWND has been sized and positioned before NPP_SetWindow was called"); 71 pluginLog(instance, "Plugin's HWND has been sized before NPP_SetWindow was called"); 84 72 return NPERR_NO_ERROR; 85 73 } -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp
r71416 r86157 24 24 */ 25 25 26 #include " PluginTest.h"26 #include "WindowedPluginTest.h" 27 27 28 28 #include "PluginObject.h" … … 32 32 // The plugin's window's window region should be set to the plugin's clip rect. 33 33 34 class WindowRegionIsSetToClipRect : public PluginTest {34 class WindowRegionIsSetToClipRect : public WindowedPluginTest { 35 35 public: 36 36 WindowRegionIsSetToClipRect(NPP, const string& identifier); 37 37 38 38 private: 39 virtual NPError NPP_SetWindow(NPP, NPWindow*); 40 41 bool m_didReceiveInitialSetWindowCall; 39 struct ScriptObject : Object<ScriptObject> { 40 bool hasMethod(NPIdentifier); 41 bool invoke(NPIdentifier, const NPVariant*, uint32_t, NPVariant*); 42 }; 43 44 static const UINT_PTR triggerPaintTimerID = 1; 45 46 void startTest(); 47 void finishTest(); 48 void checkWindowRegion(); 49 50 void showTestHarnessWindowIfNeeded(); 51 void hideTestHarnessWindowIfNeeded(); 52 53 // WindowedPluginTest 54 virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled); 55 56 // PluginTest 57 virtual NPError NPP_GetValue(NPPVariable, void*); 58 59 bool m_didCheckWindowRegion; 60 bool m_testHarnessWindowWasVisible; 42 61 }; 43 62 … … 45 64 46 65 WindowRegionIsSetToClipRect::WindowRegionIsSetToClipRect(NPP npp, const string& identifier) 47 : PluginTest(npp, identifier) 48 , m_didReceiveInitialSetWindowCall(false) 49 { 50 } 51 52 NPError WindowRegionIsSetToClipRect::NPP_SetWindow(NPP instance, NPWindow* window) 53 { 54 if (m_didReceiveInitialSetWindowCall) 55 return NPERR_NO_ERROR; 56 m_didReceiveInitialSetWindowCall = true; 57 58 if (window->type != NPWindowTypeWindow) { 59 pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type); 60 return NPERR_GENERIC_ERROR; 61 } 62 63 HWND hwnd = reinterpret_cast<HWND>(window->window); 66 : WindowedPluginTest(npp, identifier) 67 , m_didCheckWindowRegion(false) 68 , m_testHarnessWindowWasVisible(false) 69 { 70 } 71 72 void WindowRegionIsSetToClipRect::startTest() 73 { 74 // In WebKit1, our window's window region will be set immediately. In WebKit2, it won't be set 75 // until the UI process paints. Since the UI process will also show our window when it paints, 76 // we can detect when the paint occurs (and thus when our window region should be set) by 77 // starting with our plugin element hidden, then making it visible and waiting for a 78 // WM_WINDOWPOSCHANGED event to tell us our window has been shown. 79 80 waitUntilDone(); 81 82 // If the test harness window isn't visible, we might not receive a WM_WINDOWPOSCHANGED message 83 // when our window is made visible. So we temporarily show the test harness window during this test. 84 showTestHarnessWindowIfNeeded(); 85 86 // Make our window visible. (In WebKit2, this won't take effect immediately.) 87 executeScript("document.getElementsByTagName('embed')[0].style.visibility = 'visible';"); 88 89 // We trigger a UI process paint after a slight delay to ensure that the UI process has 90 // received the "make the plugin window visible" message before it paints. 91 // FIXME: It would be nice to have a way to guarantee that the UI process had received that 92 // message before we triggered a paint. Hopefully that would let us get rid of this semi- 93 // arbitrary timeout. 94 ::SetTimer(window(), triggerPaintTimerID, 250, 0); 95 } 96 97 void WindowRegionIsSetToClipRect::finishTest() 98 { 99 checkWindowRegion(); 100 hideTestHarnessWindowIfNeeded(); 101 notifyDone(); 102 } 103 104 void WindowRegionIsSetToClipRect::checkWindowRegion() 105 { 106 if (m_didCheckWindowRegion) 107 return; 108 m_didCheckWindowRegion = true; 64 109 65 110 RECT regionRect; 66 if (::GetWindowRgnBox( hwnd, ®ionRect) == ERROR) {67 pluginLog(instance, "::GetWindowRgnBox failed with error %u", ::GetLastError());68 return NPERR_GENERIC_ERROR;111 if (::GetWindowRgnBox(window(), ®ionRect) == ERROR) { 112 log("::GetWindowRgnBox failed, or window has no window region"); 113 return; 69 114 } 70 115 … … 72 117 RECT expectedRect = { 50, 50, 100, 100 }; 73 118 if (!::EqualRect(®ionRect, &expectedRect)) { 74 pluginLog(instance,"Expected region rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, regionRect.left, regionRect.top, regionRect.right, regionRect.bottom);75 return NPERR_GENERIC_ERROR;76 } 77 78 pluginLog(instance,"PASS: Plugin's window's window region has been set as expected");119 log("Expected region rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, regionRect.left, regionRect.top, regionRect.right, regionRect.bottom); 120 return; 121 } 122 123 log("PASS: Plugin's window's window region has been set as expected"); 79 124 80 125 // While we're here, check that our window class doesn't have the CS_PARENTDC style, which … … 84 129 // during WM_PRINT (see <http://webkit.org/b/49034>). 85 130 wchar_t className[512]; 86 if (!::GetClassNameW( hwnd, className, _countof(className))) {87 pluginLog(instance,"::GetClassName failed with error %u", ::GetLastError());88 return NPERR_GENERIC_ERROR;131 if (!::GetClassNameW(window(), className, _countof(className))) { 132 log("::GetClassName failed with error %u", ::GetLastError()); 133 return; 89 134 } 90 135 … … 96 141 HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName); 97 142 if (!webKitModule) { 98 pluginLog(instance,"::GetModuleHandleW failed with error %u", ::GetLastError());99 return NPERR_GENERIC_ERROR;143 log("::GetModuleHandleW failed with error %u", ::GetLastError()); 144 return; 100 145 } 101 146 102 147 WNDCLASSW wndClass; 103 148 if (!::GetClassInfoW(webKitModule, className, &wndClass)) { 104 pluginLog(instance, "::GetClassInfoW failed with error %u", ::GetLastError()); 149 log("::GetClassInfoW failed with error %u", ::GetLastError()); 150 return; 151 } 152 153 if (wndClass.style & CS_PARENTDC) 154 log("FAIL: Plugin's window's class has the CS_PARENTDC style, which will defeat clipping"); 155 else 156 log("PASS: Plugin's window's class does not have the CS_PARENTDC style"); 157 } 158 159 void WindowRegionIsSetToClipRect::showTestHarnessWindowIfNeeded() 160 { 161 HWND testHarnessWindow = this->testHarnessWindow(); 162 m_testHarnessWindowWasVisible = ::IsWindowVisible(testHarnessWindow); 163 if (m_testHarnessWindowWasVisible) 164 return; 165 ::ShowWindow(testHarnessWindow, SW_SHOWNA); 166 } 167 168 void WindowRegionIsSetToClipRect::hideTestHarnessWindowIfNeeded() 169 { 170 if (m_testHarnessWindowWasVisible) 171 return; 172 ::ShowWindow(testHarnessWindow(), SW_HIDE); 173 } 174 175 LRESULT WindowRegionIsSetToClipRect::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled) 176 { 177 switch (message) { 178 case WM_TIMER: 179 if (wParam != triggerPaintTimerID) 180 break; 181 handled = true; 182 ::KillTimer(window(), wParam); 183 // Tell the UI process to paint. 184 ::PostMessageW(::GetParent(window()), WM_PAINT, 0, 0); 185 break; 186 case WM_WINDOWPOSCHANGED: { 187 WINDOWPOS* windowPos = reinterpret_cast<WINDOWPOS*>(lParam); 188 if (!(windowPos->flags & SWP_SHOWWINDOW)) 189 break; 190 finishTest(); 191 break; 192 } 193 194 } 195 196 return 0; 197 } 198 199 NPError WindowRegionIsSetToClipRect::NPP_GetValue(NPPVariable variable, void* value) 200 { 201 if (variable != NPPVpluginScriptableNPObject) 105 202 return NPERR_GENERIC_ERROR; 106 } 107 108 if (wndClass.style & CS_PARENTDC) 109 pluginLog(instance, "FAIL: Plugin's window's class has the CS_PARENTDC style, which will defeat clipping"); 110 else 111 pluginLog(instance, "PASS: Plugin's window's class does not have the CS_PARENTDC style"); 203 204 *static_cast<NPObject**>(value) = ScriptObject::create(this); 112 205 113 206 return NPERR_NO_ERROR; 114 207 } 208 209 bool WindowRegionIsSetToClipRect::ScriptObject::hasMethod(NPIdentifier methodName) 210 { 211 return methodName == pluginTest()->NPN_GetStringIdentifier("startTest"); 212 } 213 214 bool WindowRegionIsSetToClipRect::ScriptObject::invoke(NPIdentifier identifier, const NPVariant*, uint32_t, NPVariant*) 215 { 216 assert(identifier == pluginTest()->NPN_GetStringIdentifier("startTest")); 217 static_cast<WindowRegionIsSetToClipRect*>(pluginTest())->startTest(); 218 return true; 219 } -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp
r71417 r86157 37 37 } 38 38 39 HWND WindowedPluginTest::testHarnessWindow() const 40 { 41 return ::GetAncestor(window(), GA_ROOT); 42 } 43 39 44 NPError WindowedPluginTest::NPP_SetWindow(NPP instance, NPWindow* window) 40 45 { -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h
r71417 r86157 34 34 35 35 HWND window() const { return m_window; } 36 HWND testHarnessWindow() const; 36 37 37 38 // For derived classes to override
Note: See TracChangeset
for help on using the changeset viewer.