[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 15:31:03 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e50c4f5a656e9a88f67e298461b1bc86d744dbe1
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 5 14:46:45 2010 +0000
Extract much of NPNInvalidateRectInvalidatesWindow's code into a WindowedPluginTest base class
The base class takes care of subclassing the plugin's window so that a
custom WNDPROC is called. This will make it easier to write tests that
need to handle window messages.
Fixes <http://webkit.org/b/49028> It's hard to write a PluginTest with
a custom WNDPROC
Reviewed by Jon Honeycutt.
* DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp:
(NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
(NPNInvalidateRectInvalidatesWindow::NPP_SetWindow):
(NPNInvalidateRectInvalidatesWindow::wndProc):
(NPNInvalidateRectInvalidatesWindow::testInvalidateRect):
Moved code from here to WindowedPluginTest. Changed to use window()
instead of m_window.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
Added WindowedPluginTest and added TestNetscapePlugIn/win to the
include path. Also reordered the include path to make a little more
sense and simplified the entry that added TestNetscapePlugIn itself to
the include path.
* DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp: Added.
(WindowedPluginTest::WindowedPluginTest):
(WindowedPluginTest::NPP_SetWindow):
(WindowedPluginTest::staticWndProc):
* DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h: Added.
(WindowedPluginTest::window):
Code came from NPNInvalidateRectInvalidatesWindow.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6394ab0..86538ec 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,41 @@
2010-11-04 Adam Roben <aroben at apple.com>
+ Extract much of NPNInvalidateRectInvalidatesWindow's code into a
+ WindowedPluginTest base class
+
+ The base class takes care of subclassing the plugin's window so that a
+ custom WNDPROC is called. This will make it easier to write tests that
+ need to handle window messages.
+
+ Fixes <http://webkit.org/b/49028> It's hard to write a PluginTest with
+ a custom WNDPROC
+
+ Reviewed by Jon Honeycutt.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp:
+ (NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
+ (NPNInvalidateRectInvalidatesWindow::NPP_SetWindow):
+ (NPNInvalidateRectInvalidatesWindow::wndProc):
+ (NPNInvalidateRectInvalidatesWindow::testInvalidateRect):
+ Moved code from here to WindowedPluginTest. Changed to use window()
+ instead of m_window.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ Added WindowedPluginTest and added TestNetscapePlugIn/win to the
+ include path. Also reordered the include path to make a little more
+ sense and simplified the entry that added TestNetscapePlugIn itself to
+ the include path.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp: Added.
+ (WindowedPluginTest::WindowedPluginTest):
+ (WindowedPluginTest::NPP_SetWindow):
+ (WindowedPluginTest::staticWndProc):
+ * DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h: Added.
+ (WindowedPluginTest::window):
+ Code came from NPNInvalidateRectInvalidatesWindow.
+
+2010-11-04 Adam Roben <aroben at apple.com>
+
Add a plugin test to show that windowed plugins are clipped correctly
Fixes <http://webkit.org/b/49024> <rdar://problem/8487847> Windowed
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
index 90ea54d..e598c49 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "PluginTest.h"
+#include "WindowedPluginTest.h"
#include "PluginObject.h"
@@ -69,28 +69,24 @@ TemporaryWindowMover::~TemporaryWindowMover()
::SetWindowPos(m_window, 0, m_savedWindowRect.left, m_savedWindowRect.top, 0, 0, SWP_HIDEWINDOW | standardSetWindowPosFlags);
}
-class NPNInvalidateRectInvalidatesWindow : public PluginTest {
+class NPNInvalidateRectInvalidatesWindow : public WindowedPluginTest {
public:
NPNInvalidateRectInvalidatesWindow(NPP, const string& identifier);
~NPNInvalidateRectInvalidatesWindow();
private:
- static LRESULT CALLBACK wndProc(HWND, UINT message, WPARAM, LPARAM);
+ virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled);
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)
+ : WindowedPluginTest(npp, identifier)
, m_windowMover(0)
{
}
@@ -100,30 +96,20 @@ NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow()
delete m_windowMover;
}
-NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* window)
+NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* npWindow)
{
- 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;
- }
+ NPError error = WindowedPluginTest::NPP_SetWindow(instance, npWindow);
+ if (error != NPERR_NO_ERROR)
+ return error;
- m_window = newWindow;
- if (!m_window)
+ if (!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);
+ HWND testHarnessWindow = ::GetAncestor(window(), GA_ROOT);
if (!testHarnessWindow) {
pluginLog(instance, "Failed to get test harness window");
return NPERR_GENERIC_ERROR;
@@ -141,14 +127,13 @@ NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow
return NPERR_NO_ERROR;
}
-LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
- NPNInvalidateRectInvalidatesWindow* instance = reinterpret_cast<NPNInvalidateRectInvalidatesWindow*>(::GetPropW(hwnd, instancePointerProperty));
-
if (message == WM_PAINT)
- instance->onPaint();
+ onPaint();
- return ::CallWindowProcW(instance->m_originalWndProc, hwnd, message, wParam, lParam);
+ handled = false;
+ return 0;
}
void NPNInvalidateRectInvalidatesWindow::onPaint()
@@ -162,7 +147,7 @@ void NPNInvalidateRectInvalidatesWindow::onPaint()
void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
{
RECT clientRect;
- if (!::GetClientRect(m_window, &clientRect)) {
+ if (!::GetClientRect(window(), &clientRect)) {
pluginLog(m_npp, "::GetClientRect failed");
return;
}
@@ -173,7 +158,7 @@ void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
}
// Clear the invalid region.
- if (!::ValidateRect(m_window, 0)) {
+ if (!::ValidateRect(window(), 0)) {
pluginLog(m_npp, "::ValidateRect failed");
return;
}
@@ -187,7 +172,7 @@ void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
NPN_InvalidateRect(&rectToInvalidate);
RECT invalidRect;
- if (!::GetUpdateRect(m_window, &invalidRect, FALSE)) {
+ if (!::GetUpdateRect(window(), &invalidRect, FALSE)) {
pluginLog(m_npp, "::GetUpdateRect failed");
return;
}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index a451d60..6d51817 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -109,7 +109,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -178,7 +178,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -248,7 +248,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -317,7 +317,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin";"$(WebKitLibrariesDir)\include""
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -419,6 +419,18 @@
</File>
</Filter>
</Filter>
+ <Filter
+ Name="win"
+ >
+ <File
+ RelativePath=".\WindowedPluginTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\WindowedPluginTest.h"
+ >
+ </File>
+ </Filter>
<File
RelativePath="..\main.cpp"
>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp
new file mode 100644
index 0000000..96b51f8
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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 "WindowedPluginTest.h"
+
+using namespace std;
+
+static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.WindowedPluginTest.InstancePointer";
+
+WindowedPluginTest::WindowedPluginTest(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ , m_window(0)
+ , m_originalWndProc(0)
+{
+}
+
+NPError WindowedPluginTest::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>(staticWndProc)));
+ ::SetPropW(m_window, instancePointerProperty, this);
+
+ return NPERR_NO_ERROR;
+}
+
+LRESULT WindowedPluginTest::staticWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ WindowedPluginTest* instance = reinterpret_cast<WindowedPluginTest*>(::GetPropW(hwnd, instancePointerProperty));
+
+ bool handled = false;
+ LRESULT result = instance->wndProc(message, wParam, lParam, handled);
+ if (handled)
+ return result;
+
+ return ::CallWindowProcW(instance->m_originalWndProc, hwnd, message, wParam, lParam);
+}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h
new file mode 100644
index 0000000..7abc734
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef WindowedPluginTest_h
+#define WindowedPluginTest_h
+
+#include "PluginTest.h"
+
+class WindowedPluginTest : public PluginTest {
+protected:
+ WindowedPluginTest(NPP, const std::string& identifier);
+
+ HWND window() const { return m_window; }
+
+ // For derived classes to override
+ virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled) = 0;
+
+ // PluginTest
+ virtual NPError NPP_SetWindow(NPP, NPWindow*);
+
+private:
+ static LRESULT CALLBACK staticWndProc(HWND, UINT message, WPARAM, LPARAM);
+
+ HWND m_window;
+ WNDPROC m_originalWndProc;
+};
+
+#endif // WindowedPluginTest_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list