[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 14:50:29 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f7d43d9a71ba46b374308c031eedee2a13da0819
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 21 21:40:47 2010 +0000
Invalidate the plugin's HWND when NPN_InvalidateRect is called
Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
doesn't repaint in WebKit2
Reviewed by Anders Carlsson.
WebKit2:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::invalidate): Call platformInvalidate before
invalidating via the PluginController.
* WebProcess/Plugins/Netscape/NetscapePlugin.h: Added platformInvalidate.
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformInvalidate):
* WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
(WebKit::NetscapePlugin::platformInvalidate):
Stubbed out.
* WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
(WebKit::NetscapePlugin::platformInvalidate): If the plugin is
windowed, invalidate its HWND via ::InvalidateRect.
WebKitTools:
Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
called
* DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
(PluginTest::NPN_InvalidateRect): Added. Calls through to the browser.
(executeScript): Added. Asks the browser to evaluate the script.
(PluginTest::waitUntilDone):
(PluginTest::notifyDone):
Added. Calls through to layoutTestController.
* DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added
* NPN_InvalidateRect and waitUntilDone/notifyDone.
* DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp: Added.
(TemporaryWindowMover::moveSucceeded):
(TemporaryWindowMover::TemporaryWindowMover):
(TemporaryWindowMover::~TemporaryWindowMover):
This class moves a window on-screen and shows it, then moves it back and hides it.
(NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
Initialize our members.
(NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow):
Delete our window mover if it hasn't been deleted already.
(NPNInvalidateRectInvalidatesWindow::NPP_SetWindow): Subclass the
plugin HWND and move the test harness window on screen.
(NPNInvalidateRectInvalidatesWindow::wndProc): Call through to onPaint
when we get a WM_PAINT message.
(NPNInvalidateRectInvalidatesWindow::onPaint): Do the test and tell
LayoutTestController we're done.
(NPNInvalidateRectInvalidatesWindow::testInvalidateRect): Validate
ourselves, invalidate our lower-right quadrant via NPN_InvalidateRect,
then check that our HWND's invalid region is the rect that we
invalidated.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
* Added NPNInvalidateRectInvalidatesWindow.
LayoutTests:
Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
called
* platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt: Added.
* platform/win/plugins/npn-invalidate-rect-invalidates-window.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 531007c..df12a03 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-21 Adam Roben <aroben at apple.com>
+
+ Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
+ called
+
+ Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
+ doesn't repaint in WebKit2
+
+ Reviewed by Anders Carlsson.
+
+ * platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt: Added.
+ * platform/win/plugins/npn-invalidate-rect-invalidates-window.html: Added.
+
2010-10-21 David Hyatt <hyatt at apple.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt b/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt
new file mode 100644
index 0000000..8c8d442
--- /dev/null
+++ b/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 0: PLUGIN: Plugin's HWND has been invalidated as expected
+
+This tests that a plugin's HWND is invalidated by NPN_InvalidateRect.
diff --git a/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window.html b/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window.html
new file mode 100644
index 0000000..70fa007
--- /dev/null
+++ b/LayoutTests/platform/win/plugins/npn-invalidate-rect-invalidates-window.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<body>
+<embed id="testPlugin"
+ type="application/x-webkit-test-netscape"
+ src="data:text/plain,"
+ test="npn-invalidate-rect-invalidates-window">
+</embed>
+
+<div>
+ This tests that a plugin's HWND is invalidated by NPN_InvalidateRect.
+</div>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+</body>
+</html>
+
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index f5ad058..2102d2b 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,28 @@
+2010-10-21 Adam Roben <aroben at apple.com>
+
+ Invalidate the plugin's HWND when NPN_InvalidateRect is called
+
+ Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
+ doesn't repaint in WebKit2
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::invalidate): Call platformInvalidate before
+ invalidating via the PluginController.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added platformInvalidate.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::platformInvalidate):
+ * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
+ (WebKit::NetscapePlugin::platformInvalidate):
+ Stubbed out.
+
+ * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
+ (WebKit::NetscapePlugin::platformInvalidate): If the plugin is
+ windowed, invalidate its HWND via ::InvalidateRect.
+
2010-10-21 Anders Carlsson <andersca at apple.com>
Reviewed by John Sullivan.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 5e8b64f..4799725 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -95,6 +95,9 @@ void NetscapePlugin::invalidate(const NPRect* invalidRect)
rect = IntRect(invalidRect->left, invalidRect->top,
invalidRect->right - invalidRect->left, invalidRect->bottom - invalidRect->top);
+ if (platformInvalidate(rect))
+ return;
+
m_pluginController->invalidate(rect);
}
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index c9ab440..f87fa62 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -112,6 +112,7 @@ private:
bool platformPostInitialize();
void platformDestroy();
+ bool platformInvalidate(const WebCore::IntRect&);
void platformGeometryDidChange();
void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index 8eab800..08e4643 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -160,6 +160,11 @@ void NetscapePlugin::platformDestroy()
#endif
}
+bool NetscapePlugin::platformInvalidate(const IntRect&)
+{
+ return false;
+}
+
void NetscapePlugin::platformGeometryDidChange()
{
}
diff --git a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
index 206859a..89e6c9e 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
@@ -45,6 +45,12 @@ void NetscapePlugin::platformDestroy()
notImplemented();
}
+bool NetscapePlugin::platformInvalidate(const IntRect&)
+{
+ notImplemented();
+ return false;
+}
+
void NetscapePlugin::platformGeometryDidChange()
{
notImplemented();
diff --git a/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
index 6087fe3..db11d27 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
@@ -93,6 +93,16 @@ void NetscapePlugin::platformDestroy()
::DestroyWindow(m_window);
}
+bool NetscapePlugin::platformInvalidate(const IntRect& invalidRect)
+{
+ if (!m_isWindowed)
+ return false;
+
+ RECT rect = invalidRect;
+ ::InvalidateRect(m_window, &rect, FALSE);
+ return true;
+}
+
void NetscapePlugin::platformGeometryDidChange()
{
if (!m_isWindowed)
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8dc72f6..e3fb78b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,48 @@
+2010-10-21 Adam Roben <aroben at apple.com>
+
+ Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
+ called
+
+ Test for <http://webkit.org/b/48086> <rdar://problem/8482944>
+ Silverlight doesn't repaint in WebKit2
+
+ Reviewed by Anders Carlsson.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::NPN_InvalidateRect): Added. Calls through to the browser.
+ (executeScript): Added. Asks the browser to evaluate the script.
+
+ (PluginTest::waitUntilDone):
+ (PluginTest::notifyDone):
+ Added. Calls through to layoutTestController.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added
+ * NPN_InvalidateRect and waitUntilDone/notifyDone.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp: Added.
+ (TemporaryWindowMover::moveSucceeded):
+ (TemporaryWindowMover::TemporaryWindowMover):
+ (TemporaryWindowMover::~TemporaryWindowMover):
+ This class moves a window on-screen and shows it, then moves it back and hides it.
+
+ (NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
+ Initialize our members.
+ (NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow):
+ Delete our window mover if it hasn't been deleted already.
+ (NPNInvalidateRectInvalidatesWindow::NPP_SetWindow): Subclass the
+ plugin HWND and move the test harness window on screen.
+ (NPNInvalidateRectInvalidatesWindow::wndProc): Call through to onPaint
+ when we get a WM_PAINT message.
+ (NPNInvalidateRectInvalidatesWindow::onPaint): Do the test and tell
+ LayoutTestController we're done.
+ (NPNInvalidateRectInvalidatesWindow::testInvalidateRect): Validate
+ ourselves, invalidate our lower-right quadrant via NPN_InvalidateRect,
+ then check that our HWND's invalid region is the rect that we
+ invalidated.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * Added NPNInvalidateRectInvalidatesWindow.
+
2010-10-21 Daniel Bates <dbates at rim.com>
Add Git-support to do-file-rename
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
index d435a2e..9eb421c 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -26,6 +26,7 @@
#include "PluginTest.h"
#include <assert.h>
+#include <string.h>
using namespace std;
extern NPNetscapeFuncs *browser;
@@ -65,6 +66,11 @@ NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
return NPERR_NO_ERROR;
}
+void PluginTest::NPN_InvalidateRect(NPRect* invalidRect)
+{
+ browser->invalidaterect(m_npp, invalidRect);
+}
+
NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
{
return browser->getstringidentifier(name);
@@ -90,6 +96,30 @@ bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyNam
return browser->removeproperty(m_npp, npObject, propertyName);
}
+static void executeScript(NPP npp, const char* script)
+{
+ NPObject* windowScriptObject;
+ browser->getvalue(npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPString npScript;
+ npScript.UTF8Characters = script;
+ npScript.UTF8Length = strlen(script);
+
+ NPVariant browserResult;
+ browser->evaluate(npp, windowScriptObject, &npScript, &browserResult);
+ browser->releasevariantvalue(&browserResult);
+}
+
+void PluginTest::waitUntilDone()
+{
+ executeScript(m_npp, "layoutTestController.waitUntilDone()");
+}
+
+void PluginTest::notifyDone()
+{
+ executeScript(m_npp, "layoutTestController.notifyDone()");
+}
+
void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
{
assert(!createTestFunctions().count(identifier));
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
index cbc7934..0100829 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -60,6 +60,7 @@ public:
virtual NPError NPP_SetWindow(NPP, NPWindow*);
// NPN functions.
+ void NPN_InvalidateRect(NPRect* invalidRect);
NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
NPError NPN_GetValue(NPNVariable, void* value);
@@ -88,6 +89,9 @@ protected:
const std::string& identifier() const { return m_identifier; }
+ void waitUntilDone();
+ void notifyDone();
+
// NPObject helper template.
template<typename T> struct Object : NPObject {
public:
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
new file mode 100644
index 0000000..90ea54d
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2010 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"
+
+#include "PluginObject.h"
+
+using namespace std;
+
+// NPN_InvalidateRect should invalidate the plugin's HWND.
+
+static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.NPNInvalidateRectInvalidatesWindow.InstancePointer";
+
+class TemporaryWindowMover {
+public:
+ TemporaryWindowMover(HWND);
+ ~TemporaryWindowMover();
+
+ bool moveSucceeded() const { return m_moveSucceeded; }
+
+private:
+ static const UINT standardSetWindowPosFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER;
+ bool m_moveSucceeded;
+ HWND m_window;
+ RECT m_savedWindowRect;
+};
+
+TemporaryWindowMover::TemporaryWindowMover(HWND window)
+ : m_window(window)
+{
+ m_moveSucceeded = false;
+
+ if (!::GetWindowRect(m_window, &m_savedWindowRect))
+ return;
+
+ if (!::SetWindowPos(m_window, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | standardSetWindowPosFlags))
+ return;
+
+ m_moveSucceeded = true;
+};
+
+TemporaryWindowMover::~TemporaryWindowMover()
+{
+ if (!m_moveSucceeded)
+ return;
+
+ ::SetWindowPos(m_window, 0, m_savedWindowRect.left, m_savedWindowRect.top, 0, 0, SWP_HIDEWINDOW | standardSetWindowPosFlags);
+}
+
+class NPNInvalidateRectInvalidatesWindow : public PluginTest {
+public:
+ NPNInvalidateRectInvalidatesWindow(NPP, const string& identifier);
+ ~NPNInvalidateRectInvalidatesWindow();
+
+private:
+ static LRESULT CALLBACK wndProc(HWND, UINT message, WPARAM, LPARAM);
+
+ void onPaint();
+ void testInvalidateRect();
+
+ virtual NPError NPP_SetWindow(NPP, NPWindow*);
+
+ HWND m_window;
+ WNDPROC m_originalWndProc;
+ TemporaryWindowMover* m_windowMover;
+};
+
+NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ , m_window(0)
+ , m_originalWndProc(0)
+ , m_windowMover(0)
+{
+}
+
+NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow()
+{
+ delete m_windowMover;
+}
+
+NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ HWND newWindow = reinterpret_cast<HWND>(window->window);
+ if (newWindow == m_window)
+ return NPERR_NO_ERROR;
+
+ if (m_window) {
+ ::RemovePropW(m_window, instancePointerProperty);
+ ::SetWindowLongPtr(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_originalWndProc));
+ m_originalWndProc = 0;
+ }
+
+ m_window = newWindow;
+ if (!m_window)
+ return NPERR_NO_ERROR;
+
+ m_originalWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtrW(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(wndProc)));
+ ::SetPropW(m_window, instancePointerProperty, this);
+
+ // The test harness's window (the one that contains the WebView) is off-screen and hidden.
+ // We need to move it on-screen and make it visible in order for the plugin's window to
+ // accumulate an update region when the DWM is disabled.
+
+ HWND testHarnessWindow = ::GetAncestor(m_window, GA_ROOT);
+ if (!testHarnessWindow) {
+ pluginLog(instance, "Failed to get test harness window");
+ return NPERR_GENERIC_ERROR;
+ }
+
+ m_windowMover = new TemporaryWindowMover(testHarnessWindow);
+ if (!m_windowMover->moveSucceeded()) {
+ pluginLog(instance, "Failed to move test harness window on-screen");
+ return NPERR_GENERIC_ERROR;
+ }
+
+ // Wait until we receive a WM_PAINT message to ensure that the window is on-screen before we do
+ // the NPN_InvalidateRect test.
+ waitUntilDone();
+ return NPERR_NO_ERROR;
+}
+
+LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ NPNInvalidateRectInvalidatesWindow* instance = reinterpret_cast<NPNInvalidateRectInvalidatesWindow*>(::GetPropW(hwnd, instancePointerProperty));
+
+ if (message == WM_PAINT)
+ instance->onPaint();
+
+ return ::CallWindowProcW(instance->m_originalWndProc, hwnd, message, wParam, lParam);
+}
+
+void NPNInvalidateRectInvalidatesWindow::onPaint()
+{
+ testInvalidateRect();
+ notifyDone();
+ delete m_windowMover;
+ m_windowMover = 0;
+}
+
+void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
+{
+ RECT clientRect;
+ if (!::GetClientRect(m_window, &clientRect)) {
+ pluginLog(m_npp, "::GetClientRect failed");
+ return;
+ }
+
+ if (::IsRectEmpty(&clientRect)) {
+ pluginLog(m_npp, "Plugin's HWND has not been sized when NPP_SetWindow is called");
+ return;
+ }
+
+ // Clear the invalid region.
+ if (!::ValidateRect(m_window, 0)) {
+ pluginLog(m_npp, "::ValidateRect failed");
+ return;
+ }
+
+ // Invalidate our lower-right quadrant.
+ NPRect rectToInvalidate;
+ rectToInvalidate.left = (clientRect.right - clientRect.left) / 2;
+ rectToInvalidate.top = (clientRect.bottom - clientRect.top) / 2;
+ rectToInvalidate.right = clientRect.right;
+ rectToInvalidate.bottom = clientRect.bottom;
+ NPN_InvalidateRect(&rectToInvalidate);
+
+ RECT invalidRect;
+ if (!::GetUpdateRect(m_window, &invalidRect, FALSE)) {
+ pluginLog(m_npp, "::GetUpdateRect failed");
+ return;
+ }
+
+ if (invalidRect.left != rectToInvalidate.left || invalidRect.top != rectToInvalidate.top || invalidRect.right != rectToInvalidate.right || invalidRect.bottom != rectToInvalidate.bottom) {
+ pluginLog(m_npp, "Expected invalid rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", rectToInvalidate.left, rectToInvalidate.top, rectToInvalidate.right, rectToInvalidate.bottom, invalidRect.left, invalidRect.top, invalidRect.right, invalidRect.bottom);
+ return;
+ }
+
+ pluginLog(m_npp, "Plugin's HWND has been invalidated as expected");
+}
+
+static PluginTest::Register<NPNInvalidateRectInvalidatesWindow> registrar("npn-invalidate-rect-invalidates-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index cdd7729..6c9d162 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -398,6 +398,10 @@
>
</File>
<File
+ RelativePath="..\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"
>
</File>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list