diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /Tools/DumpRenderTree/TestNetscapePlugIn/win | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'Tools/DumpRenderTree/TestNetscapePlugIn/win')
10 files changed, 782 insertions, 0 deletions
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def new file mode 100644 index 0000000..ac41e7e --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def @@ -0,0 +1,6 @@ +LIBRARY "npTestNetscapePlugin"
+
+EXPORTS
+ NP_GetEntryPoints @1
+ NP_Initialize @2
+ NP_Shutdown @3
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc new file mode 100644 index 0000000..a8fbbcd --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc @@ -0,0 +1,101 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "windows.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""windows.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "Apple Inc."
+ VALUE "FileDescription", "TestNetscapePlugIn"
+ VALUE "FileOpenName", "test netscape content"
+ VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009"
+ VALUE "MIMEType", "application/x-webkit-test-netscape"
+ VALUE "OriginalFilename", "npTestNetscapePlugin.dll"
+ VALUE "ProductName", "TestNetscapePlugIn"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj new file mode 100644 index 0000000..11c9723 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj @@ -0,0 +1,508 @@ +<?xml version="1.0" encoding="windows-1251"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePlugin" + ProjectGUID="{C0737398-3565-439E-A2B8-AB2BE4D5430C}" + RootNamespace="TestNetscapePlugin" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_Cairo_CFLite|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_All|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_LTCG|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_Cairo_CFLite|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\TestNetscapePluginCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Tests" + > + <File + RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp" + > + </File> + <File + RelativePath="..\Tests\EvaluateJSAfterRemovingPluginElement.cpp" + > + </File> + <File + RelativePath="..\Tests\GetUserAgentWithNullNPPFromNPPNew.cpp" + > + </File> + <File + RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp" + > + </File> + <File + RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp" + > + </File> + <File + RelativePath="..\Tests\NullNPPGetValuePointer.cpp" + > + </File> + <File + RelativePath="..\Tests\PassDifferentNPPStruct.cpp" + > + </File> + <File + RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\Tests\win\DrawsGradient.cpp" + > + </File> + <File + RelativePath="..\Tests\win\GetValueNetscapeWindow.cpp" + > + </File> + <File + RelativePath="..\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp" + > + </File> + <File + RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp" + > + </File> + <File + RelativePath="..\Tests\win\WindowRegionIsSetToClipRect.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="win" + > + <File + RelativePath=".\WindowedPluginTest.cpp" + > + </File> + <File + RelativePath=".\WindowedPluginTest.h" + > + </File> + </Filter> + <File + RelativePath="..\main.cpp" + > + </File> + <File + RelativePath="..\PluginObject.cpp" + > + </File> + <File + RelativePath="..\PluginObject.h" + > + </File> + <File + RelativePath="..\PluginTest.cpp" + > + </File> + <File + RelativePath="..\PluginTest.h" + > + </File> + <File + RelativePath=".\resource.h" + > + </File> + <File + RelativePath=".\TestNetscapePlugin.def" + > + </File> + <File + RelativePath=".\TestNetscapePlugin.rc" + > + </File> + <File + RelativePath=".\TestNetscapePlugin_debug.def" + > + </File> + <File + RelativePath="..\TestObject.cpp" + > + </File> + <File + RelativePath="..\TestObject.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops new file mode 100644 index 0000000..922ae52 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="TestNetscapePluginCommon" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include"" + PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf" + DisableSpecificWarnings="4819" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="Msimg32.lib" + OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll" + ModuleDefinitionFile="TestNetscapePlugin$(WebKitConfigSuffix).def" + /> +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPostBuild.cmd b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPostBuild.cmd new file mode 100644 index 0000000..f011495 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPostBuild.cmd @@ -0,0 +1 @@ +if exist "%WEBKITOUTPUTDIR%\buildfailed" del "%WEBKITOUTPUTDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPreBuild.cmd b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPreBuild.cmd new file mode 100644 index 0000000..3a84c26 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPreBuild.cmd @@ -0,0 +1,6 @@ +%SystemDrive%\cygwin\bin\which.exe bash +if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% +cmd /c +if exist "%WEBKITOUTPUTDIR%\buildfailed" grep XX%PROJECTNAME%XX "%WEBKITOUTPUTDIR%\buildfailed" +if errorlevel 1 exit 1 +echo XX%PROJECTNAME%XX > "%WEBKITOUTPUTDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def new file mode 100644 index 0000000..158fb7c --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def @@ -0,0 +1,6 @@ +LIBRARY "npTestNetscapePlugin_debug" + +EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp new file mode 100644 index 0000000..96b51f8 --- /dev/null +++ b/Tools/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/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h new file mode 100644 index 0000000..7abc734 --- /dev/null +++ b/Tools/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 diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/resource.h b/Tools/DumpRenderTree/TestNetscapePlugIn/win/resource.h new file mode 100644 index 0000000..b0ce340 --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by TestNetscapePlugin.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif |