summaryrefslogtreecommitdiffstats
path: root/WebKitTools
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools')
-rw-r--r--WebKitTools/ChangeLog839
-rw-r--r--WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj32
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp22
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h1
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp25
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h11
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp95
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h212
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp56
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp72
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp89
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp68
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp27
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj38
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/EventSender.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp31
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.h3
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.h2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp7
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellMac.mm2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EventSender.cpp32
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/mac/EventSendingController.mm8
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm7
-rw-r--r--WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h2
-rw-r--r--WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro7
-rw-r--r--WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp32
-rw-r--r--WebKitTools/DumpRenderTree/win/EventSender.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp6
-rw-r--r--WebKitTools/GNUmakefile.am6
-rw-r--r--WebKitTools/MiniBrowser/mac/AppDelegate.m29
-rw-r--r--WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch2
-rw-r--r--WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m69
-rw-r--r--WebKitTools/QtTestBrowser/QtTestBrowser.pro4
-rw-r--r--WebKitTools/QtTestBrowser/launcherwindow.cpp881
-rw-r--r--WebKitTools/QtTestBrowser/launcherwindow.h185
-rw-r--r--WebKitTools/QtTestBrowser/main.cpp1023
-rw-r--r--WebKitTools/QtTestBrowser/webpage.cpp29
-rw-r--r--WebKitTools/QtTestBrowser/webview.h1
-rwxr-xr-xWebKitTools/Scripts/build-webkit5
-rwxr-xr-xWebKitTools/Scripts/find-included-framework-headers30
-rwxr-xr-xWebKitTools/Scripts/old-run-webkit-tests11
-rw-r--r--WebKitTools/Scripts/webkitdirs.pm10
-rw-r--r--WebKitTools/Scripts/webkitpy/common/config/committers.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checkers/cpp.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/thirdparty/__init__.py10
-rw-r--r--WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops2
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl3
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp52
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h13
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp56
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h2
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp12
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h8
-rw-r--r--WebKitTools/WebKitTestRunner/TestController.cpp83
-rw-r--r--WebKitTools/WebKitTestRunner/TestController.h26
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.cpp36
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.h2
-rw-r--r--WebKitTools/WebKitTestRunner/WebKitTestRunner.sln2
-rw-r--r--WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm1
-rw-r--r--WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm4
-rw-r--r--WebKitTools/WebKitTestRunner/mac/main.mm9
-rw-r--r--WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj (renamed from WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj)32
-rw-r--r--WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp4
-rw-r--r--WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln39
-rw-r--r--WebKitTools/WebKitTestRunner/win/main.cpp5
73 files changed, 3155 insertions, 1310 deletions
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 7aa3128..987fe7c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,842 @@
+2010-08-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add alias for run-webkit-tests --webkit-test-runner (run-webkit-tests -2).
+
+ * Scripts/old-run-webkit-tests:
+
+2010-08-02 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Restore the WebKitTestRunner.sln that was removed, and remove the
+ correct one.
+
+ Rubber-stamped by Sam Weinig.
+
+ * WebKitTestRunner/WebKitTestRunner.sln: Added.
+ * WebKitTestRunner/win/WebKitTestRunner.sln: Removed.
+
+2010-08-02 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Move InjectedBundle.vcproj to where the other WebKitTestRunner vcprojs live.
+
+ Remove the unused WebKitTestRunner.sln.
+
+ Reviewed by Sam Weinig.
+
+ * WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops:
+ * WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj: Removed.
+ * WebKitTestRunner/WebKitTestRunner.sln: Removed.
+ * WebKitTestRunner/win/InjectedBundle.vcproj: Added.
+ * WebKitTestRunner/win/WebKitTestRunner.sln:
+
+2010-08-02 Sam Weinig <sam@webkit.org>
+
+ Fix the windows build.
+
+ * WebKitTestRunner/win/main.cpp:
+
+2010-07-29 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Add a Skipped list on Windows, and have run-webkit-tests respect it.
+
+ Part of <rdar://problem/8233237> Fill WebKit2 Windows skipped list so
+ there are zero tests failing
+ https://bugs.webkit.org/show_bug.cgi?id=43374
+
+ Reviewed by Adam Roben.
+
+ * Scripts/old-run-webkit-tests:
+ If using WebKitTestRunner and Apple Windows WebKit, set the platform to
+ win-wk2. When building the result hierarchy, if the platform is win-wk2,
+ add it first to the list of platforms.
+
+2010-08-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ WebKitTestRunner needs layoutTestController.setCanOpenWindows
+ https://bugs.webkit.org/show_bug.cgi?id=42321
+
+ WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
+ https://bugs.webkit.org/show_bug.cgi?id=42779
+
+ * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added
+ setCanOpenWindows, setCloseRemainingWindowsWhenComplete, and windowCount
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::InjectedBundle): Initialize m_mainPage to 0 instead of
+ waiting for the first call to didCreatePage.
+ (WTR::InjectedBundle::didCreatePage): Set m_mainPage only when the first page
+ is created. Put other pages into a map.
+ (WTR::InjectedBundle::willDestroyPage): Added code to handle the destruction
+ of the main page.
+ (WTR::InjectedBundle::closeOtherPages): Added. Closes all the pages other than
+ the main page.
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added pageCount and
+ closeOtherPages functions.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::didFinishLoadForFrame): Don't let pages other than
+ the main page affect dumping.
+ (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto.
+
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::LayoutTestController::LayoutTestController): Initialize the new
+ m_shouldCloseExtraWindows member.
+ (WTR::LayoutTestController::setCanOpenWindows): Added. Empty for now.
+ (WTR::LayoutTestController::windowCount): Added.
+
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+ Added setCanOpenWindows, setCloseRemainingWindowsWhenComplete,
+ windowCount, shouldCloseExtraWindowsAfterRunningTest, and
+ m_shouldCloseExtraWindows.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::shared): Return a pointer to the shared copy, but
+ don't allocate and leak it. This seemed cleaner than adding an explicit
+ finalize call to go along with the explicit initialize call.
+ (WTR::TestController::TestController): Added calls to the initialize and
+ run function, which are now done automatically.
+ (WTR::TestController::~TestController): Added, since it's called now.
+ (WTR::closeOtherPage): Added. Used to close pages other than the main page.
+ (WTR::createOtherPage): Added. Used to create pages other than the main page.
+ (WTR::TestController::initialize): Added code to set up createOtherPage.
+ (WTR::TestController::run): Removed unused return value.
+ * WebKitTestRunner/TestController.h: Made constructor and destructor public,
+ and initialize and run private. Changed m_mainWebView to be an OwnPtr.
+
+ * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+ (WTR::PlatformWebView::PlatformWebView): Added a call to setReleasedWhenClosed
+ to avoid releasing the window twice. Another way to handle it would be to
+ remove the release, but this approach is slightly more robust because it works
+ even if some other code calls the close method an extra time.
+
+ * WebKitTestRunner/mac/main.mm:
+ (main): Use a stack-allocated TestController object instead of calling
+ initalize and run on a globally allocated one.
+
+2010-08-02 Tony Chang <tony@chromium.org>
+
+ Reviewed by David Levin.
+
+ add myself to the reviewers list
+ https://bugs.webkit.org/show_bug.cgi?id=43366
+
+ * Scripts/webkitpy/common/config/committers.py:
+
+2010-08-02 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Cache JSNPObjects and fix bugs in the object map
+ https://bugs.webkit.org/show_bug.cgi?id=43368
+
+ Test that we correctly throw exceptions when trying to do things to a JSObject that used to
+ wrap an NPObject that came from a plug-in that is now destroyed.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ (PluginTest::Object::getProperty):
+ (PluginTest::Object::NP_GetProperty):
+ (PluginTest::Object::npClass):
+ * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp: Added.
+ (NPRuntimeObjectFromDestroyedPlugin::NPRuntimeObjectFromDestroyedPlugin):
+ (NPRuntimeObjectFromDestroyedPlugin::ScriptableObject::hasProperty):
+ (NPRuntimeObjectFromDestroyedPlugin::ScriptableObject::getProperty):
+ (NPRuntimeObjectFromDestroyedPlugin::NPP_GetValue):
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * GNUmakefile.am:
+
+2010-08-02 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] DOM listeners get wrong keycodes for some keys
+ https://bugs.webkit.org/show_bug.cgi?id=35170
+
+ Add support to all event senders for simulating keypad insert
+ and print screen keys.
+
+ * DumpRenderTree/chromium/EventSender.cpp:
+ (EventSender::keyDown): Add support for generating keypad insert and print screen.
+ * DumpRenderTree/gtk/EventSender.cpp:
+ (keyDownCallback): Ditto.
+ * DumpRenderTree/mac/EventSendingController.mm:
+ (-[EventSendingController keyDown:withModifiers:withLocation:]): Ditto.
+ * DumpRenderTree/qt/EventSenderQt.cpp:
+ (EventSender::keyDown): Ditto.
+ * DumpRenderTree/win/EventSender.cpp:
+ (keyDownCallback): Ditto.
+
+2010-08-02 Martin Robinson <mrobinson@igalia.com>
+
+ Build fix for building against development versions of GTK+. GTK 2.22
+ has not yet been released, so these function definitions must be conditionalized
+ on the development version.
+
+ * DumpRenderTree/gtk/EventSender.cpp: Fix GTK+ 2.21 build.
+
+2010-08-02 Tony Chang <tony@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ [chromium] use ChromiumDriver on Linux when running webkit tests
+ https://bugs.webkit.org/show_bug.cgi?id=43273
+
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+
+2010-08-02 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Always initialize GTK
+ https://bugs.webkit.org/show_bug.cgi?id=43327
+
+ Call gtk_init() in order to fix plugin test crash.
+
+ * DumpRenderTree/chromium/DumpRenderTree.cpp:
+ (main): Pass argc/argv to platformInit().
+ * DumpRenderTree/chromium/TestShell.h:
+ * DumpRenderTree/chromium/TestShellGtk.cpp:
+ (platformInit): Update parameters, call gtk_init().
+ * DumpRenderTree/chromium/TestShellMac.mm:
+ (platformInit): Update parameters.
+ * DumpRenderTree/chromium/TestShellWin.cpp:
+ (platformInit): Update parameters.
+
+2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Generate forwarding headers for WebKit2
+
+ https://bugs.webkit.org/show_bug.cgi?id=43336
+
+ * Scripts/webkitdirs.pm: Call make on WebKit2/Makefile.DerivedSources.
+
+2010-08-02 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ WebSocket server should start with SO_REUSEADDR
+ https://bugs.webkit.org/show_bug.cgi?id=43329
+
+ Pulls in pywebsocket-0.5.2.
+ pywebsocket-0.5.2 includes a small fix to start server with SO_REUSE_ADDR.
+ http://code.google.com/p/pywebsocket/source/detail?r=273
+
+ * Scripts/webkitpy/thirdparty/__init__.py: Bump pywebsocket version
+
+2010-08-01 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Remove string_util.h dependency
+ https://bugs.webkit.org/show_bug.cgi?id=43312
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::pathToLocalResource):
+ Use string::find() instead of StartsWithASCII().
+ (LayoutTestController::cppVariantToInt32):
+ Use strtol() instead of StringToNumber().
+
+2010-08-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add ability to reset frame names for WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=43316
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::reset):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::reset):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
+2010-08-01 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement NPN_RemoveProperty
+ https://bugs.webkit.org/show_bug.cgi?id=43315
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add NPRuntimeRemoveProperty.cpp
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::NPN_GetStringIdentifier):
+ (PluginTest::NPN_GetIntIdentifier):
+ (PluginTest::NPN_RemoveProperty):
+ Add NPN_ helpers.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ Support more NPClass functions.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: Added.
+ (NPRuntimeRemoveProperty::NPRuntimeRemoveProperty):
+ Test for NPN_RemoveProperty.
+
+ (NPRuntimeRemoveProperty::TestObject::hasMethod):
+ (NPRuntimeRemoveProperty::TestObject::invoke):
+ Add a testRemoveProperty method.
+
+ (NPRuntimeRemoveProperty::NPP_GetValue):
+ Return the test object.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * GNUmakefile.am:
+ Add NPRuntimeRemoveProperty.cpp
+
+2010-07-30 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an NPObject class template helper to TestNetscapePlugin
+ https://bugs.webkit.org/show_bug.cgi?id=43288
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ Add some template magic to be able to figure out if a class has a member function of a given type.
+
+ (PluginTest::Object::create):
+ Create an object.
+
+ (PluginTest::Object::invokeDefault):
+ Add dummy function, this should never be called.
+
+ (PluginTest::Object::Object):
+ Initialize m_pluginTest to 0.
+
+ (PluginTest::Object::~Object):
+ Add virtual destructor.
+
+ (PluginTest::Object::NP_Allocate):
+ Create a new object.
+
+ (PluginTest::Object::NP_Deallocate):
+ Delete the object.
+
+ (PluginTest::Object::NP_InvokeDefault):
+ Call invokeDefault.
+
+ (PluginTest::Object::npClass):
+ Initialize the NPClass struct.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp:
+ (DocumentOpenInDestroyStream::NPP_DestroyStream):
+ Move this inline.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp:
+ (PluginScriptableNPObjectInvokeDefault::NPObjectWithInvokeDefault::invokeDefault):
+ (PluginScriptableNPObjectInvokeDefault::NPP_GetValue):
+ Use the PluginTest::Object class template.
+
+2010-07-31 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=43305
+ Add back WKBundleFrameCopyInnerText to fix ~50 test failures
+ due to SVGElements not having the innerText function.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::dumpFrameText):
+
+2010-07-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=43290
+ Add structured message passing from the injected bundle to UIProcess
+
+ * MiniBrowser/mac/AppDelegate.m:
+ (didRecieveMessageFromInjectedBundle):
+ * MiniBrowser/mac/WebBundle/WebBundleMain.m:
+ (didClearWindowForFrame):
+ (didRecieveMessage):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::done):
+ (WTR::InjectedBundle::didReceiveMessage):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ (WTR::TestController::didReceiveMessageFromInjectedBundle):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+ * WebKitTestRunner/TestInvocation.h:
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+
+2010-07-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=43275
+ Make WKArrayRef more usable.
+
+ Remove now unnecessary const_casts.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::dumpDescendantFrameScrollPositions):
+ (WTR::dumpDescendantFramesText):
+
+2010-07-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=43274
+ Add first pass of structured message passing.
+
+ Update Minibrowser and WebKitTestRunner to work with the new post message
+ function.
+
+ * MiniBrowser/mac/AppDelegate.m:
+ (didRecieveMessageFromInjectedBundle):
+ (-[BrowserAppDelegate init]):
+ * MiniBrowser/mac/MiniBrowser_Prefix.pch:
+ * MiniBrowser/mac/WebBundle/WebBundleMain.m:
+ (didStartProvisionalLoadForFrame):
+ (didReceiveServerRedirectForProvisionalLoadForFrame):
+ (didFailProvisionalLoadWithErrorForFrame):
+ (didCommitLoadForFrame):
+ (didFinishLoadForFrame):
+ (didFailLoadWithErrorForFrame):
+ (didReceiveTitleForFrame):
+ (didClearWindowForFrame):
+ (didCreatePage):
+ (willDestroyPage):
+ (didRecieveMessage):
+ (WKBundleInitialize):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::_didReceiveMessage):
+ (WTR::InjectedBundle::didReceiveMessage):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::invoke):
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+
+2010-07-30 Anders Carlsson <andersca@apple.com>
+
+ Try to fix the layout test failures.
+
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_get_value):
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Replace plugins/npruntime/bindings-test.html with a more sophisticated test
+ https://bugs.webkit.org/show_bug.cgi?id=43232
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add PluginScriptableNPObjectInvokeDefault.cpp.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+ Remove invokeDefault callback function.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::create):
+ Move this to the top of the file.
+
+ (PluginTest::NPP_GetValue):
+ Add default implementation.
+
+ (PluginTest::NPN_CreateObject):
+ Add NPN_ wrapper.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ (PluginTest::identifier):
+ Add identifier getter.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp:
+ (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
+ Add "using namespace std".
+
+ * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+ (NPP_GetValue):
+ Give PluginTest a chance to return a value.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * GNUmakefile.am:
+ Add PluginScriptableNPObjectInvokeDefault.cpp.
+
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_get_value):
+ Give PluginTest a chance to return a value.
+
+2010-07-30 Steve Block <steveblock@google.com>
+
+ Reviewed by Steve Block.
+
+ Add LayoutTestController methods to test DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39589
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setMockDeviceOrientationCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * Scripts/build-webkit:
+
+2010-07-29 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ [Qt] QtTestBrowser: -resizes-to-contents command line parameter is broken
+ https://bugs.webkit.org/show_bug.cgi?id=43209
+
+ When -resizes-to-content was being passed as a command line parameter it was simply
+ not being set (although the corresponding menu item was marked as ON).
+ User had to toggle the menu OFF and then ON again for it to take place.
+
+ Reason: LauncherWindow::applyPrefs method sets many user options passed in from
+ the command line, but not resizesToContents. Patch addresses that.
+
+ * QtTestBrowser/launcherwindow.cpp:
+ (LauncherWindow::createChrome):
+ (LauncherWindow::applyPrefs):
+ (LauncherWindow::toggleResizesToContents):
+ * QtTestBrowser/webview.h:
+ (WebViewGraphicsBased::resizesToContents):
+
+2010-07-29 Antonio Gomes <tonikitoo@webkit.org>
+
+ Rubber-stamped by Simon Fraser.
+
+ [Qt] QtTestBrowser: more method grouping and clean ups.
+
+ Moving blocks of code around. Basically grouping related methods close to each.
+
+ * QtTestBrowser/launcherwindow.cpp:
+ (LauncherWindow::initializeView):
+ (LauncherWindow::createChrome):
+ (LauncherWindow::changeViewportUpdateMode):
+ (LauncherWindow::showFPS):
+ (LauncherWindow::newWindow):
+ (LauncherWindow::cloneWindow):
+ * QtTestBrowser/launcherwindow.h:
+
+2010-07-30 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [QT][Symbian] QtTestBrowser missing location capabilities
+ https://bugs.webkit.org/show_bug.cgi?id=43235
+
+ QtTestBrowser missing capabilities to use QtMobility::QLocation.
+
+ * QtTestBrowser/QtTestBrowser.pro:
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Add PluginTest.cpp
+
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+
+2010-07-29 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Update download URLs for python irclib package; the old URLs
+ pointed at a specific mirror host and not the general sourceforge
+ URLs.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43228
+
+ * Scripts/webkitpy/thirdparty/__init__.py:
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Fix typo.
+
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Another attempt at fixing the Qt and GTK+ build.
+
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_new_instance):
+ (webkit_test_plugin_destroy_stream):
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Another build fix attempt.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_new_instance):
+ * GNUmakefile.am:
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Try to fix Windows and Unix builds.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_new_instance):
+ (webkit_test_plugin_destroy_stream):
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactor TestNetscapePlugin so tests can be split in separate files
+ https://bugs.webkit.org/show_bug.cgi?id=43220
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+ (pluginAllocate):
+ Initialize pluginTest to 0. Remove testDocumentOpenInDestroyStream.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: Added.
+ (PluginTest::PluginTest):
+ Initialize m_npp and the test identifier.
+
+ (PluginTest::createTestFunctions):
+ Return the map from identifiers to createTest functions.
+
+ (PluginTest::registerCreateTestFunction):
+ Insert the identifier and create function pair in the map.
+
+ (PluginTest::create):
+ Look for a createTest function. If one is found, call it. Otherwise create a vanilla PluginTest object.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added.
+ (PluginTest::Register::Register):
+ Helper class template for registering plug-in tests.
+
+ (PluginTest::Register::create):
+ Create a new test of the given type.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: Added.
+ (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
+ Add a test that calls testDocumentOpen from its NPP_DestroyStream callback.
+
+ * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+ (NPP_New):
+ Create a PluginTest given the identifier. Remove the check for "testdocumentopenindestroystream".
+
+ (NPP_DestroyStream):
+ Call the plug-in test NPP_DestroyStream member function.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
+
+2010-07-29 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed build fix.
+
+ Add missing second argument to assert_lint in new style checker tests.
+
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+
+2010-07-29 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam Roben.
+
+ check-webkit-style shouldn't complain about NPAPI functions
+ https://bugs.webkit.org/show_bug.cgi?id=43211
+
+ Allow underscores in functions that start with NPN_, NPP_ or NP_.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+
+2010-07-29 Victor Wang <victorw@chromium.org>
+
+ Unreviewed, rolling out r64270.
+ http://trac.webkit.org/changeset/64270
+ https://bugs.webkit.org/show_bug.cgi?id=39589
+
+ The patch breaks chromium webkit unittest
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ * Scripts/build-webkit:
+
+2010-07-29 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ [Qt] QtTestBrowser: Move WebPage class methods definitions from main.cpp to webpage.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=43199
+
+ There is no sense in keeping WebPage method definitions in main.cpp once
+ webpage.cpp already exists.
+
+ No behavior change.
+
+ * QtTestBrowser/main.cpp:
+ * QtTestBrowser/webpage.cpp:
+ (WebPage::createWindow):
+ (WebPage::createPlugin):
+
+2010-07-29 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ [Qt] Factor out LauncherWindow class out of main.cpp (QtTestBrowser)
+ https://bugs.webkit.org/show_bug.cgi?id=43170
+
+ Moving LauncherWindow class out of main.cpp to its own .cpp and .h files:
+ launcherwindow.{cpp|h}
+
+ No behavior change.
+
+ Also changed all global static variables (named "gXXX") from main.cpp to
+ static public variables of the LauncherWindow class.
+
+ * QtTestBrowser/QtTestBrowser.pro:
+ * QtTestBrowser/launcherwindow.cpp: Added.
+ * QtTestBrowser/launcherwindow.h: Added.
+ * QtTestBrowser/main.cpp:
+ (LauncherApplication::handleUserOptions):
+ (main):
+
+2010-07-29 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Build fix for building against GTK+ 3.x. GSEAL requires that we
+ access internals of the GdkDragContext via methods. For older versions
+ of GTK+, define those methods.
+
+ * DumpRenderTree/gtk/EventSender.cpp:
+ (gdk_drag_context_get_selected_action): Added.
+ (gdk_drag_context_get_actions): Added.
+ (dispatchEvent): Use the two new accessor methods.
+
+2010-07-29 Adam Roben <aroben@apple.com>
+
+ Always say "plugins directory" when referring to a directory
+ containing one or more plugins
+
+ Fixes <http://webkit.org/b/43197> WebKit2 often says "plugin
+ directory" when it means "plugins directory"
+
+ Reviewed by John Sullivan.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize): Updated for rename.
+
+2010-07-29 Adam Roben <aroben@apple.com>
+
+ Always say "directory" when referring to a plugin directory
+
+ Fixes <http://webkit.org/b/43195> WebKit2 often says "plugin path"
+ when it means "plugin directory"
+
+ Reviewed by John Sullivan.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize): Updated for renames.
+
+ * WebKitTestRunner/TestController.h: Renamed m_testPluginPath to
+ m_testPluginDirectory.
+ (WTR::TestController::testPluginDirectory): Renamed from
+ testPluginPath.
+
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::initializeTestPluginDirectory):
+ * WebKitTestRunner/win/TestControllerWin.cpp:
+ (WTR::TestController::initializeTestPluginDirectory):
+ Renamed from initializeTestPluginPath and updated for rename.
+
+2010-07-29 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Antonio Gomes.
+
+ Initialize all members of NPClass struct.
+ https://bugs.webkit.org/show_bug.cgi?id=43193
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+
+2010-07-29 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Antonio Gomes.
+
+ Warning fix on platforms where XP_MACOSX is undefined.
+ https://bugs.webkit.org/show_bug.cgi?id=43192
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
+ Use #if defined(XP_MACOSX) instead of #if XP_MACOSX .
+
+2010-07-29 Adam Roben <aroben@apple.com>
+
+ Give find-included-framework-headers our standard license
+
+ * Scripts/find-included-framework-headers: Used the license from
+ WebCore/LICENSE-APPLE.
+
+2010-07-29 Adam Roben <aroben@apple.com>
+
+ Speed up find-included-framework-headers
+
+ We only do one invocation of find now, no longer pipe to grep, and
+ replace uniq with sort -u.
+
+ Also added a license header.
+
+ * Scripts/find-included-framework-headers:
+
+2010-07-29 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Add LayoutTestController methods to test DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39589
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setMockDeviceOrientationCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::setMockDeviceOrientation):
+ * Scripts/build-webkit:
+
2010-07-28 Kenichi Ishibashi <bashi@google.com>
Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 2ed5daa..c92c704 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -32,10 +32,16 @@
141BF439096A455900E0753C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; };
14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; };
+ 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */; };
+ 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; };
+ 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; };
+ 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; };
1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F024C0BB9B056008CFA34 /* TestObject.h */; };
1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; };
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; };
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; };
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; };
+ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; };
23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; };
3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; };
@@ -185,10 +191,16 @@
141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; };
141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
+ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOpenInDestroyStream.cpp; sourceTree = "<group>"; };
+ 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; };
+ 1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; };
+ 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; };
1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = "<group>"; };
1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; };
1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; };
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; };
+ 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; };
23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
3713EDDF115BE16F00705720 /* ColorBits-A.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ColorBits-A.png"; path = "fonts/ColorBits-A.png"; sourceTree = "<group>"; };
@@ -357,11 +369,14 @@
141BF1F5096A439800E0753C /* TestNetscapePlugIn */ = {
isa = PBXGroup;
children = (
+ 1A215A6E11F25FF1008AD0F5 /* Tests */,
141BF448096A45C800E0753C /* Info.plist */,
1AC6C77F0D07589B00CD3161 /* main.cpp */,
1AC6C7800D07589B00CD3161 /* PluginObject.cpp */,
0F37A4A611E6628700275F54 /* PluginObjectMac.mm */,
141BF447096A45C800E0753C /* PluginObject.h */,
+ 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */,
+ 1A215A8011F2609C008AD0F5 /* PluginTest.h */,
1AC6C7810D07589B00CD3161 /* TestObject.cpp */,
1A8F024C0BB9B056008CFA34 /* TestObject.h */,
);
@@ -421,6 +436,17 @@
name = Delegates;
sourceTree = "<group>";
};
+ 1A215A6E11F25FF1008AD0F5 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
+ 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */,
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */,
+ 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */,
+ );
+ path = Tests;
+ sourceTree = "<group>";
+ };
9340995508540CAF007F3BC8 /* Products */ = {
isa = PBXGroup;
children = (
@@ -521,6 +547,7 @@
files = (
141BF453096A45EB00E0753C /* PluginObject.h in Headers */,
1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */,
+ 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -684,6 +711,11 @@
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */,
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */,
0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */,
+ 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */,
+ 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */,
+ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */,
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */,
+ 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 6a957c1..d98164b 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -970,6 +970,27 @@ static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef
return JSValueMakeUndefined(context);
}
+static JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 6)
+ return JSValueMakeUndefined(context);
+
+ bool canProvideAlpha = JSValueToBoolean(context, arguments[0]);
+ double alpha = JSValueToNumber(context, arguments[1], exception);
+ ASSERT(!*exception);
+ bool canProvideBeta = JSValueToBoolean(context, arguments[2]);
+ double beta = JSValueToNumber(context, arguments[3], exception);
+ ASSERT(!*exception);
+ bool canProvideGamma = JSValueToBoolean(context, arguments[4]);
+ double gamma = JSValueToNumber(context, arguments[5], exception);
+ ASSERT(!*exception);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 3)
@@ -1824,6 +1845,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 30eb9bd..39cc3fb 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -88,6 +88,7 @@ public:
void setJavaScriptProfilingEnabled(bool profilingEnabled);
void setJavaScriptCanAccessClipboard(bool flag);
void setMainFrameIsFirstResponder(bool flag);
+ void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
void setMockGeolocationError(int code, JSStringRef message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setPersistentUserStyleSheetLocation(JSStringRef path);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index 671069e..0d556b1 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -99,7 +99,6 @@ static bool pluginHasMethod(NPObject*, NPIdentifier name);
static bool pluginGetProperty(NPObject*, NPIdentifier name, NPVariant*);
static bool pluginSetProperty(NPObject*, NPIdentifier name, const NPVariant*);
static bool pluginInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool pluginInvokeDefault(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result);
static NPObject* pluginAllocate(NPP npp, NPClass*);
static void pluginDeallocate(NPObject*);
@@ -112,10 +111,13 @@ static NPClass pluginClass = {
pluginInvalidate,
pluginHasMethod,
pluginInvoke,
- pluginInvokeDefault,
+ 0, // NPClass::invokeDefault,
pluginHasProperty,
pluginGetProperty,
pluginSetProperty,
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
};
NPClass *getPluginClass(void)
@@ -158,7 +160,6 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
enum {
ID_TEST_CALLBACK_METHOD = 0,
ID_TEST_GETURL,
- ID_REMOVE_DEFAULT_METHOD,
ID_TEST_DOM_ACCESS,
ID_TEST_GET_URL_NOTIFY,
ID_TEST_INVOKE_DEFAULT,
@@ -195,7 +196,6 @@ static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallback",
"getURL",
- "removeDefaultMethod",
"testDOMAccess",
"getURLNotify",
"testInvokeDefault",
@@ -462,13 +462,6 @@ static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount,
return false;
}
-static bool removeDefaultMethod(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- pluginClass.invokeDefault = 0;
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 3 || !NPVARIANT_IS_STRING(args[0])
@@ -857,8 +850,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return testCallback(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GETURL])
return getURL(plugin, args, argCount, result);
- else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD])
- return removeDefaultMethod(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS])
return testDOMAccess(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY])
@@ -941,12 +932,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return false;
}
-static bool pluginInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- INT32_TO_NPVARIANT(1, *result);
- return true;
-}
-
static void pluginInvalidate(NPObject* header)
{
PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
@@ -963,6 +948,7 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
initializeIdentifiers();
}
+ newInstance->pluginTest = 0;
newInstance->npp = npp;
newInstance->testObject = browser->createobject(npp, getTestClass());
newInstance->rememberedObject = 0;
@@ -984,7 +970,6 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
newInstance->lastHeaders = NULL;
newInstance->testGetURLOnDestroy = FALSE;
- newInstance->testDocumentOpenInDestroyStream = FALSE;
newInstance->testWindowOpen = FALSE;
newInstance->testKeyboardFocusForPlugins = FALSE;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
index 03befb0..2c1d325 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
@@ -25,7 +25,7 @@
#include <WebKit/npfunctions.h>
-#if XP_MACOSX
+#if defined(XP_MACOSX)
#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#define BUILDING_ON_TIGER 1
#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
@@ -35,11 +35,15 @@
#endif
#endif // XP_MACOSX
+class PluginTest;
+
extern NPNetscapeFuncs *browser;
typedef struct {
NPObject header;
+ PluginTest* pluginTest;
+
NPP npp;
NPBool eventLogging;
NPBool logSetWindow;
@@ -50,7 +54,6 @@ typedef struct {
NPObject* testObject;
NPObject* rememberedObject;
NPStream* stream;
- NPBool testDocumentOpenInDestroyStream;
NPBool testGetURLOnDestroy;
NPBool testWindowOpen;
NPBool testKeyboardFocusForPlugins;
@@ -66,7 +69,7 @@ typedef struct {
#ifdef XP_MACOSX
NPEventModel eventModel;
#endif
-#if XP_MACOSX && !defined(BUILDING_ON_TIGER)
+#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
void* coreAnimationLayer;
#endif
NPWindow lastWindow;
@@ -80,7 +83,7 @@ extern void pluginLog(NPP instance, const char* format, ...);
extern bool testDocumentOpen(NPP npp);
extern bool testWindowOpen(NPP npp);
-#if XP_MACOSX && !defined(BUILDING_ON_TIGER)
+#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
extern void* createCoreAnimationLayer();
#endif
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
new file mode 100644
index 0000000..0ff7029
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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 <assert.h>
+
+using namespace std;
+extern NPNetscapeFuncs *browser;
+
+PluginTest* PluginTest::create(NPP npp, const string& identifier)
+{
+ CreateTestFunction createTestFunction = createTestFunctions()[identifier];
+ if (createTestFunction)
+ return createTestFunction(npp, identifier);
+
+ return new PluginTest(npp, identifier);
+}
+
+PluginTest::PluginTest(NPP npp, const string& identifier)
+ : m_npp(npp)
+ , m_identifier(identifier)
+{
+}
+
+PluginTest::~PluginTest()
+{
+}
+
+NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
+{
+ // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR.
+ return NPERR_GENERIC_ERROR;
+}
+
+NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
+{
+ return browser->getstringidentifier(name);
+}
+
+NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid)
+{
+ return browser->getintidentifier(intid);
+}
+
+NPObject* PluginTest::NPN_CreateObject(NPClass* npClass)
+{
+ return browser->createobject(m_npp, npClass);
+}
+
+bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName)
+{
+ return browser->removeproperty(m_npp, npObject, propertyName);
+}
+
+void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
+{
+ assert(!createTestFunctions().count(identifier));
+
+ createTestFunctions()[identifier] = createTestFunction;
+}
+
+std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
+{
+ static std::map<std::string, CreateTestFunction> testFunctions;
+
+ return testFunctions;
+}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
new file mode 100644
index 0000000..ecc0185
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -0,0 +1,212 @@
+/*
+ * 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 PluginTest_h
+#define PluginTest_h
+
+#include <WebKit/npfunctions.h>
+#include <assert.h>
+#include <map>
+#include <string>
+
+// Helper classes for implementing has_member
+typedef char (&no_tag)[1];
+typedef char (&yes_tag)[2];
+
+#define DEFINE_HAS_MEMBER_CHECK(member, returnType, argumentTypes) \
+template<typename T, returnType (T::*member) argumentTypes> struct pmf_##member##_helper {}; \
+template<typename T> no_tag has_member_##member##_helper(...); \
+template<typename T> yes_tag has_member_##member##_helper(pmf_##member##_helper<T, &T::member >*); \
+template<typename T> struct has_member_##member { \
+static const bool value = sizeof(has_member_##member##_helper<T>(0)) == sizeof(yes_tag); \
+};
+
+DEFINE_HAS_MEMBER_CHECK(hasMethod, bool, (NPIdentifier methodName));
+DEFINE_HAS_MEMBER_CHECK(invoke, bool, (NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(invokeDefault, bool, (const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(hasProperty, bool, (NPIdentifier propertyName));
+DEFINE_HAS_MEMBER_CHECK(getProperty, bool, (NPIdentifier propertyName, NPVariant* result));
+
+class PluginTest {
+public:
+ static PluginTest* create(NPP, const std::string& identifier);
+ virtual ~PluginTest();
+
+ // NPP functions.
+ virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
+ virtual NPError NPP_GetValue(NPPVariable, void* value);
+
+ // NPN functions.
+ NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
+ NPIdentifier NPN_GetIntIdentifier(int32_t intid);
+ NPObject* NPN_CreateObject(NPClass*);
+ bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
+
+ template<typename TestClassTy> class Register {
+ public:
+ Register(const std::string& identifier)
+ {
+ registerCreateTestFunction(identifier, Register::create);
+ }
+
+ private:
+ static PluginTest* create(NPP npp, const std::string& identifier)
+ {
+ return new TestClassTy(npp, identifier);
+ }
+ };
+
+protected:
+ PluginTest(NPP npp, const std::string& identifier);
+
+ // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this private.
+ NPP m_npp;
+
+ const std::string& identifier() const { return m_identifier; }
+
+ // NPObject helper template.
+ template<typename T> struct Object : NPObject {
+ public:
+ static NPObject* create(PluginTest* pluginTest)
+ {
+ Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(npClass()));
+
+ object->m_pluginTest = pluginTest;
+ return object;
+ }
+
+ // These should never be called.
+ bool hasMethod(NPIdentifier methodName)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ protected:
+ Object()
+ : m_pluginTest(0)
+ {
+ }
+
+ virtual ~Object()
+ {
+ }
+
+ PluginTest* pluginTest() const { return m_pluginTest; }
+
+ private:
+ static NPObject* NP_Allocate(NPP npp, NPClass* aClass)
+ {
+ return new T;
+ }
+
+ static void NP_Deallocate(NPObject* npObject)
+ {
+ delete static_cast<T*>(npObject);
+ }
+
+ static bool NP_HasMethod(NPObject* npObject, NPIdentifier methodName)
+ {
+ return static_cast<T*>(npObject)->hasMethod(methodName);
+ }
+
+ static bool NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->invoke(methodName, arguments, argumentCount, result);
+ }
+
+ static bool NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->invokeDefault(arguments, argumentCount, result);
+ }
+
+ static bool NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
+ {
+ return static_cast<T*>(npObject)->hasProperty(propertyName);
+ }
+
+ static bool NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->getProperty(propertyName, result);
+ }
+
+ static NPClass* npClass()
+ {
+ static NPClass npClass = {
+ NP_CLASS_STRUCT_VERSION,
+ NP_Allocate,
+ NP_Deallocate,
+ 0, // NPClass::invalidate
+ has_member_hasMethod<T>::value ? NP_HasMethod : 0,
+ has_member_invoke<T>::value ? NP_Invoke : 0,
+ has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0,
+ has_member_hasProperty<T>::value ? NP_HasProperty : 0,
+ has_member_getProperty<T>::value ? NP_GetProperty : 0,
+ 0, // NPClass::setProperty
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
+ };
+
+ return &npClass;
+ };
+
+ PluginTest* m_pluginTest;
+ };
+
+private:
+ typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&);
+
+ static void registerCreateTestFunction(const std::string&, CreateTestFunction);
+ static std::map<std::string, CreateTestFunction>& createTestFunctions();
+
+ std::string m_identifier;
+};
+
+#endif // PluginTest_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
new file mode 100644
index 0000000..69e706e
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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"
+
+using namespace std;
+
+extern bool testDocumentOpen(NPP npp);
+
+// Call document.open from NPP_DestroyStream.
+
+class DocumentOpenInDestroyStream : public PluginTest {
+public:
+ DocumentOpenInDestroyStream(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ , m_shouldOpen(true)
+ {
+ }
+
+private:
+ virtual NPError NPP_DestroyStream(NPStream*, NPReason)
+ {
+ if (m_shouldOpen) {
+ testDocumentOpen(m_npp);
+ m_shouldOpen = false;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ bool m_shouldOpen;
+};
+
+static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
new file mode 100644
index 0000000..38236e3
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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"
+
+using namespace std;
+
+class NPRuntimeObjectFromDestroyedPlugin : public PluginTest {
+public:
+ NPRuntimeObjectFromDestroyedPlugin(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ // This is the test object.
+ class TestObject : public Object<TestObject> { };
+
+ // This is the scriptable object. It has a single "testObject" property.
+ class ScriptableObject : public Object<ScriptableObject> {
+ public:
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject");
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject"))
+ return false;
+
+ NPObject* testObject = TestObject::create(pluginTest());
+ OBJECT_TO_NPVARIANT(testObject, *result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = ScriptableObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+};
+
+static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin");
+
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
new file mode 100644
index 0000000..4d417d1
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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"
+
+using namespace std;
+
+
+class NPRuntimeRemoveProperty : public PluginTest {
+public:
+ NPRuntimeRemoveProperty(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ struct TestObject : Object<TestObject> {
+ public:
+ bool hasMethod(NPIdentifier methodName)
+ {
+ return methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty");
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ assert(methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"));
+
+ if (argumentCount != 2)
+ return false;
+
+ if (!NPVARIANT_IS_OBJECT(arguments[0]))
+ return false;
+
+ if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(arguments[1]))
+ return false;
+
+ NPIdentifier propertyName;
+ if (NPVARIANT_IS_STRING(arguments[1])) {
+ string propertyNameString(arguments[1].value.stringValue.UTF8Characters,
+ arguments[1].value.stringValue.UTF8Length);
+
+ propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNameString.c_str());
+ } else {
+ int32_t number = arguments[1].value.doubleValue;
+ propertyName = pluginTest()->NPN_GetIntIdentifier(number);
+ }
+
+ pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName);
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = TestObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+
+};
+
+static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("npruntime-remove-property");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
new file mode 100644
index 0000000..959e182
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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"
+
+using namespace std;
+
+// A test where the plug-ins scriptable object either has or doesn't have an invokeDefault function.
+class PluginScriptableNPObjectInvokeDefault : public PluginTest {
+public:
+ PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> { };
+
+ struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> {
+ public:
+ bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
+ {
+ INT32_TO_NPVARIANT(1, *result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ NPObject* object;
+ if (identifier() == "plugin-scriptable-npobject-invoke-default")
+ object = NPObjectWithInvokeDefault::create(this);
+ else
+ object = NPObjectWithoutInvokeDefault::create(this);
+
+ *(NPObject**)value = object;
+
+ return NPERR_NO_ERROR;
+ }
+};
+
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default");
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 82a6e3a..fcda50b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -25,6 +25,12 @@
#include "PluginObject.h"
+#include "PluginTest.h"
+
+#include <string>
+
+using namespace std;
+
#if XP_WIN
#define STDCALL __stdcall
@@ -132,7 +138,11 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
#endif
#endif // XP_MACOSX
+ string testIdentifier;
+
for (int i = 0; i < argc; i++) {
+ if (strcasecmp(argn[i], "test") == 0)
+ testIdentifier = argv[i];
if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
@@ -158,8 +168,6 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0)
- obj->testDocumentOpenInDestroyStream = TRUE;
else if (strcasecmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
else if (strcasecmp(argn[i], "drawingmodel") == 0) {
@@ -196,7 +204,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
#endif
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
-
+
+ obj->pluginTest = PluginTest::create(instance, testIdentifier);
+
return NPERR_NO_ERROR;
}
@@ -325,12 +335,7 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
}
}
- if (obj->testDocumentOpenInDestroyStream) {
- testDocumentOpen(instance);
- obj->testDocumentOpenInDestroyStream = FALSE;
- }
-
- return NPERR_NO_ERROR;
+ return obj->pluginTest->NPP_DestroyStream(stream, reason);
}
int32_t NPP_WriteReady(NPP instance, NPStream *stream)
@@ -524,6 +529,10 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+ // First, check if the PluginTest object supports getting this value.
+ if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
// Return value is expected to be retained
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 34d2f08..c36666f 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -109,7 +109,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -178,7 +178,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -248,7 +248,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -317,7 +317,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -425,6 +425,14 @@
>
</File>
<File
+ RelativePath="..\PluginTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PluginTest.h"
+ >
+ </File>
+ <File
RelativePath=".\resource.h"
>
</File>
@@ -448,6 +456,26 @@
RelativePath="..\TestObject.h"
>
</File>
+ <Filter
+ Name="Tests"
+ >
+ <File
+ RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 7194279..2885cf6 100644
--- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -84,7 +84,7 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName
int main(int argc, char* argv[])
{
webkit_support::SetUpTestEnvironment();
- platformInit();
+ platformInit(&argc, &argv);
TestParams params;
Vector<string> tests;
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index fd7ba2d..4e84c96 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -541,6 +541,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
code = base::VKEY_LEFT;
else if ("upArrow" == codeStr)
code = base::VKEY_UP;
+ else if ("insert" == codeStr)
+ code = base::VKEY_INSERT;
else if ("delete" == codeStr)
code = base::VKEY_DELETE;
else if ("pageUp" == codeStr)
@@ -551,6 +553,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
code = base::VKEY_HOME;
else if ("end" == codeStr)
code = base::VKEY_END;
+ else if ("printScreen" == codeStr)
+ code = base::VKEY_SNAPSHOT;
else {
// Compare the input string with the function-key names defined by the
// DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index ea1fd01..cd27c18 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -35,7 +35,6 @@
#include "DRTDevToolsAgent.h"
#include "TestShell.h"
#include "WebViewHost.h"
-#include "base/string_util.h"
#include "public/WebAnimationController.h"
#include "public/WebConsoleMessage.h"
#include "public/WebDocument.h"
@@ -51,6 +50,9 @@
#include "public/WebURL.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
+#include <algorithm>
+#include <cstdlib>
+#include <limits>
#include <wtf/text/WTFString.h>
#if OS(WINDOWS)
@@ -164,6 +166,8 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
+ bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation);
+
bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
@@ -702,7 +706,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
string url = arguments[0].toString();
#if OS(WINDOWS)
- if (StartsWithASCII(url, "/tmp/", true)) {
+ if (!url.find("/tmp/")) {
// We want a temp file.
const unsigned tempPrefixLength = 5;
size_t bufferSize = MAX_PATH;
@@ -714,7 +718,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
tempLength = GetTempPathW(bufferSize, tempPath.get());
ASSERT(tempLength < bufferSize);
}
- std::string resultPath(WebString(tempPath.get(), tempLength).utf8());
+ string resultPath(WebString(tempPath.get(), tempLength).utf8());
resultPath.append(url.substr(tempPrefixLength));
result->set(resultPath);
return;
@@ -723,8 +727,12 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
// Some layout tests use file://// which we resolve as a UNC path. Normalize
// them to just file:///.
- while (StartsWithASCII(url, "file:////", false))
+ string lowerUrl = url;
+ transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower);
+ while (!lowerUrl.find("file:////")) {
url = url.substr(0, 8) + url.substr(9);
+ lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9);
+ }
result->set(webkit_support::RewriteLayoutTestsURL(url).spec());
}
@@ -1022,9 +1030,12 @@ int32_t LayoutTestController::cppVariantToInt32(const CppVariant& value)
if (value.isInt32())
return value.toInt32();
if (value.isString()) {
- int number;
- if (StringToInt(value.toString(), &number))
- return number;
+ string stringSource = value.toString();
+ const char* source = stringSource.data();
+ char* end;
+ long number = strtol(source, &end, 10);
+ if (end == source + stringSource.length() && number >= numeric_limits<int32_t>::min() && number <= numeric_limits<int32_t>::max())
+ return static_cast<int32_t>(number);
}
logErrorToConsole("Invalid value for preference. Expected integer value.");
return 0;
@@ -1310,6 +1321,12 @@ void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments,
logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
}
+void LayoutTestController::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 46a14de..6748352 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -282,6 +282,9 @@ public:
void addUserScript(const CppArgumentList&, CppVariant*);
void addUserStyleSheet(const CppArgumentList&, CppVariant*);
+ // DeviceOrientation related functions
+ void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
+
// Geolocation related functions.
void setGeolocationPermission(const CppArgumentList&, CppVariant*);
void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index 0f74ee1..0615552 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -184,6 +184,6 @@ private:
#endif
};
-void platformInit();
+void platformInit(int*, char***);
#endif // TestShell_h
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
index 4f3eefd..a9d374c 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
@@ -33,6 +33,7 @@
#include "webkit/support/webkit_support.h"
#include <fontconfig/fontconfig.h>
+#include <gtk/gtk.h>
#include <signal.h>
static void AlarmHandler(int signatl)
@@ -185,7 +186,11 @@ void TestShell::waitTestFinished()
signal(SIGALRM, SIG_DFL);
}
-void platformInit()
+void platformInit(int* argc, char*** argv)
{
+ // FIXME: It's better call gtk_init() only when we run plugin tests.
+ // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca#
+ gtk_init(argc, argv);
+
setupFontconfig();
}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
index 218b6d0..19cfd07 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
@@ -124,6 +124,6 @@ void TestShell::waitTestFinished()
[thread release];
}
-void platformInit()
+void platformInit(int*, char***)
{
}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
index a9ca6a9..72f800c 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -103,7 +103,7 @@ void TestShell::waitTestFinished()
WaitForSingleObject(threadHandle, 1000);
}
-void platformInit()
+void platformInit(int*, char***)
{
// Set stdout/stderr binary mode.
_setmode(_fileno(stdout), _O_BINARY);
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index b95fec2..4f4246f 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -103,6 +103,20 @@ static GdkWindow* gtk_widget_get_window(GtkWidget* widget)
}
#endif
+#if !GTK_CHECK_VERSION(2, 21, 2)
+static GdkDragAction gdk_drag_context_get_selected_action(GdkDragContext* context)
+{
+ g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), static_cast<GdkDragAction>(0));
+ return context->action;
+}
+
+static GdkDragAction gdk_drag_context_get_actions(GdkDragContext* context)
+{
+ g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), GDK_ACTION_DEFAULT);
+ return context->actions;
+}
+#endif
+
static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
return JSValueMakeBoolean(context, dragMode);
@@ -371,10 +385,12 @@ static void dispatchEvent(GdkEvent event)
// Simulate a drag motion on the top-level GDK window.
GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view));
- GdkWindow* parentWidgetWindow = parentWidget->window;
+ GdkWindow* parentWidgetWindow = gtk_widget_get_window(parentWidget);
gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND,
event.motion.x_root, event.motion.y_root,
- currentDragSourceContext->action, currentDragSourceContext->actions, GDK_CURRENT_TIME);
+ gdk_drag_context_get_selected_action(currentDragSourceContext),
+ gdk_drag_context_get_actions(currentDragSourceContext),
+ GDK_CURRENT_TIME);
} else if (currentDragSourceContext && event.type == GDK_BUTTON_RELEASE) {
// We've released the mouse button, we should just be able to spin the
@@ -456,9 +472,13 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
gdkKeySym = GDK_KP_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_KP_End;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ gdkKeySym = GDK_KP_Insert;
+ else if (JSStringIsEqualToUTF8CString(character, "delete"))
+ gdkKeySym = GDK_KP_Delete;
else
- // Assume we only get arrow/pgUp/pgDn/home/end keys with
- // location=NUMPAD for now.
+ // If we get some other key specified with the numpad location,
+ // crash here, so we add it sooner rather than later.
g_assert_not_reached();
} else {
if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
@@ -477,8 +497,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
gdkKeySym = GDK_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_End;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ gdkKeySym = GDK_Insert;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
gdkKeySym = GDK_Delete;
+ else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
+ gdkKeySym = GDK_Print;
else if (JSStringIsEqualToUTF8CString(character, "F1"))
gdkKeySym = GDK_F1;
else if (JSStringIsEqualToUTF8CString(character, "F2"))
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 5c942d3..2aece10 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -442,6 +442,12 @@ void LayoutTestController::disableImageLoading()
// Also need to make sure image loading is re-enabled for each new test.
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
index 9d2fc75..77999bd 100644
--- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
+++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
@@ -597,10 +597,18 @@ static int buildModifierFlags(const WebScriptObject* modifiers)
const unichar ch = NSEndFunctionKey;
eventCharacter = [NSString stringWithCharacters:&ch length:1];
keyCode = 0x77;
+ } else if ([character isEqualToString:@"insert"]) {
+ const unichar ch = NSInsertFunctionKey;
+ eventCharacter = [NSString stringWithCharacters:&ch length:1];
+ keyCode = 0x72;
} else if ([character isEqualToString:@"delete"]) {
const unichar ch = NSDeleteFunctionKey;
eventCharacter = [NSString stringWithCharacters:&ch length:1];
keyCode = 0x75;
+ } else if ([character isEqualToString:@"printScreen"]) {
+ const unichar ch = NSPrintScreenFunctionKey;
+ eventCharacter = [NSString stringWithCharacters:&ch length:1];
+ keyCode = 0x0; // There is no known virtual key code for PrintScreen.
}
// Compare the input string with the function-key names defined by the DOM spec (i.e. "F1",...,"F24").
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 6b921f0..7db7fff 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -320,6 +320,13 @@ void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidd
[WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:0 latitude:latitude longitude:longitude accuracy:accuracy];
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
index 1e495b1..63dbd2a 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -334,9 +334,15 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u
} else if (string == QLatin1String("end")) {
s = QString();
code = Qt::Key_End;
+ } else if (string == QLatin1String("insert")) {
+ s = QString();
+ code = Qt::Key_Insert;
} else if (string == QLatin1String("delete")) {
s = QString();
code = Qt::Key_Delete;
+ } else if (string == QLatin1String("printScreen")) {
+ s = QString();
+ code = Qt::Key_Print;
}
}
QKeyEvent event(QEvent::KeyPress, code, modifs, s);
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 8ebdbae..ca51f1b 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -683,6 +683,12 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
DumpRenderTreeSupportQt::setEditingBehavior(m_drt->webPage(), editingBehavior);
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setGeolocationPermission(bool allow)
{
m_isGeolocationPermissionSet = true;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 4ebf99d..1dee6ce 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -197,6 +197,8 @@ public slots:
// which is a Mac-specific test.
void addDisallowedURL(const QString&) {}
+ void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
+
void setMockGeolocationError(int code, const QString& message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setGeolocationPermission(bool allow);
diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index 6ab22fc..e48b035 100644
--- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -26,7 +26,12 @@ INCLUDEPATH += ../../../../JavaScriptCore \
../../TestNetscapePlugIn
SOURCES = PluginObject.cpp \
- TestObject.cpp
+ PluginTest.cpp \
+ TestObject.cpp \
+ Tests/DocumentOpenInDestroyStream.cpp \
+ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
+ Tests/NPRuntimeRemoveProperty.cpp \
+ Tests/PluginScriptableNPObjectInvokeDefault.cpp
mac {
SOURCES += ../../TestNetscapePlugIn/main.cpp
diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
index ca868be..8216f7a 100644
--- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
+++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "PluginObject.h"
+#include "PluginTest.h"
#include "npapi.h"
#include "npruntime.h"
@@ -37,7 +38,10 @@
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
+#include <string>
+using namespace std;
+
extern "C" {
NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable);
NPError NP_Shutdown(void);
@@ -60,8 +64,12 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
instance->pdata = obj;
+ string testIdentifier;
+
for (int i = 0; i < argc; i++) {
- if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
+ if (strcasecmp(argn[i], "test") == 0)
+ testIdentifier = argv[i];
+ else if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
obj->onStreamDestroy = strdup(argv[i]);
@@ -82,8 +90,6 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0)
- obj->testDocumentOpenInDestroyStream = TRUE;
else if (strcasecmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
@@ -91,6 +97,8 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
}
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
+
+ obj->pluginTest = PluginTest::create(instance, testIdentifier);
}
return NPERR_NO_ERROR;
@@ -190,7 +198,7 @@ webkit_test_plugin_new_stream(NPP instance,
}
static NPError
-webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError reason)
+webkit_test_plugin_destroy_stream(NPP instance, NPStream* stream, NPError reason)
{
PluginObject* obj = (PluginObject*)instance->pdata;
@@ -217,12 +225,7 @@ webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError re
}
}
- if (obj->testDocumentOpenInDestroyStream) {
- testDocumentOpen(instance);
- obj->testDocumentOpenInDestroyStream = FALSE;
- }
-
- return NPERR_NO_ERROR;
+ return obj->pluginTest->NPP_DestroyStream(stream, reason);
}
static void
@@ -283,6 +286,14 @@ webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, vo
static NPError
webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
{
+ PluginObject* obj = 0;
+ if (instance)
+ obj = static_cast<PluginObject*>(instance->pdata);
+
+ // First, check if the PluginTest object supports getting this value.
+ if (obj && obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
NPError err = NPERR_NO_ERROR;
switch (variable) {
@@ -308,7 +319,6 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
browser->retainobject((NPObject *)obj);
*v = obj;
err = NPERR_NO_ERROR;
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp
index c9749e7..94f0945 100644
--- a/WebKitTools/DumpRenderTree/win/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp
@@ -467,8 +467,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
virtualKeyCode = VK_HOME;
else if (JSStringIsEqualToUTF8CString(character, "end"))
virtualKeyCode = VK_END;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ virtualKeyCode = VK_INSERT;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
virtualKeyCode = VK_DELETE;
+ else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
+ virtualKeyCode = VK_SNAPSHOT;
else {
charCode = JSStringGetCharactersPtr(character)[0];
virtualKeyCode = LOBYTE(VkKeyScan(charCode));
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index a29623e..6519a97 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -375,6 +375,12 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis
webView->setPolicyDelegate(0);
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 905463a..fd6b2d2 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -271,6 +271,12 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop
return false;
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am
index ef0d735..33d4614 100644
--- a/WebKitTools/GNUmakefile.am
+++ b/WebKitTools/GNUmakefile.am
@@ -158,6 +158,12 @@ TestNetscapePlugin_libtestnetscapeplugin_la_SOURCES = \
WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h \
WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h \
WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp \
diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m
index ccbf176..ffb6363 100644
--- a/WebKitTools/MiniBrowser/mac/AppDelegate.m
+++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m
@@ -36,15 +36,28 @@ static NSString *defaultURL = @"http://www.webkit.org/";
@implementation BrowserAppDelegate
-void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo)
+void didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- LOG(@"ContextInjectedBundleClient - didRecieveMessage - message: %@", cfMessage);
- CFRelease(cfMessage);
+ CFStringRef cfMessageName = WKStringCopyCFString(0, messageName);
+
+ WKTypeID typeID = WKGetTypeID(messageBody);
+ if (typeID == WKStringGetTypeID()) {
+ CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody);
+ LOG(@"ContextInjectedBundleClient - didRecieveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody);
+ CFRelease(cfMessageBody);
+ } else {
+ LOG(@"ContextInjectedBundleClient - didRecieveMessage - MessageName: %@ (MessageBody Unhandeled)\n", cfMessageName);
+ }
+
+ CFRelease(cfMessageName);
- WKStringRef newMessage = WKStringCreateWithCFString(CFSTR("Roger that!"));
- WKContextPostMessageToInjectedBundle(context, newMessage);
- WKStringRelease(newMessage);
+ WKStringRef newMessageName = WKStringCreateWithCFString(CFSTR("Response"));
+ WKStringRef newMessageBody = WKStringCreateWithCFString(CFSTR("Roger that!"));
+
+ WKContextPostMessageToInjectedBundle(context, newMessageName, newMessageBody);
+
+ WKStringRelease(newMessageName);
+ WKStringRelease(newMessageBody);
}
#pragma mark History Client Callbacks
@@ -128,7 +141,7 @@ static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
WKContextInjectedBundleClient bundleClient = {
0, /* version */
0, /* clientInfo */
- _didRecieveMessageFromInjectedBundle
+ didRecieveMessageFromInjectedBundle
};
WKContextSetInjectedBundleClient(processContext, &bundleClient);
WKContextSetHistoryClient(processContext, &historyClient);
diff --git a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch
index cb8ceae..0670cf4 100644
--- a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch
+++ b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch
@@ -29,6 +29,8 @@
#import <WebKit2/WebKit2.h>
+#define ENABLE_LOGGING 1
+
#if ENABLE_LOGGING
#define LOG NSLog
#else
diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
index cd5ee00..c4f4a68 100644
--- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
+++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
@@ -37,80 +37,91 @@ static WKBundleRef globalBundle;
// WKBundlePageClient
-void _didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
+void didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo)
+void didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo)
{
}
-void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
+void didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
{
WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page));
CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
WKURLRelease(wkURL);
- LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]);
+ LOG(@"WKBundlePageClient - didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]);
CFRelease(cfURL);
- WKStringRef message = WKStringCreateWithCFString(CFSTR("Window was cleared"));
- WKBundlePostMessage(globalBundle, message);
- WKStringRelease(message);
+ WKStringRef messageName = WKStringCreateWithCFString(CFSTR("Callback"));
+ WKStringRef messageBody = WKStringCreateWithCFString(CFSTR("Window was cleared"));
+ WKBundlePostMessage(globalBundle, messageName, messageBody);
+ WKStringRelease(messageName);
+ WKStringRelease(messageBody);
}
// WKBundleClient
-void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
{
LOG(@"WKBundleClient - didCreatePage\n");
WKBundlePageLoaderClient client = {
0,
0,
- _didStartProvisionalLoadForFrame,
- _didReceiveServerRedirectForProvisionalLoadForFrame,
- _didFailProvisionalLoadWithErrorForFrame,
- _didCommitLoadForFrame,
- _didFinishLoadForFrame,
- _didFailLoadWithErrorForFrame,
- _didReceiveTitleForFrame,
- _didClearWindowForFrame
+ didStartProvisionalLoadForFrame,
+ didReceiveServerRedirectForProvisionalLoadForFrame,
+ didFailProvisionalLoadWithErrorForFrame,
+ didCommitLoadForFrame,
+ didFinishLoadForFrame,
+ didFailLoadWithErrorForFrame,
+ didReceiveTitleForFrame,
+ didClearWindowForFrame
};
WKBundlePageSetLoaderClient(page, &client);
}
-void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
{
LOG(@"WKBundleClient - willDestroyPage\n");
}
-void _didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo)
+void didRecieveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- LOG(@"WKBundleClient - didRecieveMessage %@\n", cfMessage);
- CFRelease(cfMessage);
+ CFStringRef cfMessageName = WKStringCopyCFString(0, messageName);
+
+ WKTypeID typeID = WKGetTypeID(messageBody);
+ if (typeID == WKStringGetTypeID()) {
+ CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody);
+ LOG(@"WKBundleClient - didRecieveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody);
+ CFRelease(cfMessageBody);
+ } else {
+ LOG(@"WKBundleClient - didRecieveMessage - MessageName: %@ (MessageBody Unhandeled)\n", cfMessageName);
+ }
+
+ CFRelease(cfMessageName);
}
void WKBundleInitialize(WKBundleRef bundle)
@@ -120,9 +131,9 @@ void WKBundleInitialize(WKBundleRef bundle)
WKBundleClient client = {
0,
0,
- _didCreatePage,
- _willDestroyPage,
- _didRecieveMessage
+ didCreatePage,
+ willDestroyPage,
+ didRecieveMessage
};
WKBundleSetClient(bundle, &client);
}
diff --git a/WebKitTools/QtTestBrowser/QtTestBrowser.pro b/WebKitTools/QtTestBrowser/QtTestBrowser.pro
index fa16c82..08e0fb8 100644
--- a/WebKitTools/QtTestBrowser/QtTestBrowser.pro
+++ b/WebKitTools/QtTestBrowser/QtTestBrowser.pro
@@ -2,6 +2,7 @@ TEMPLATE = app
SOURCES += \
locationedit.cpp \
+ launcherwindow.cpp \
main.cpp \
mainwindow.cpp \
urlloader.cpp \
@@ -12,6 +13,7 @@ SOURCES += \
HEADERS += \
locationedit.h \
+ launcherwindow.h \
mainwindow.h \
urlloader.h \
utils.h \
@@ -46,7 +48,7 @@ linux-* {
symbian {
TARGET.UID3 = 0xA000E543
- TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
+ TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices Location
}
contains(QT_CONFIG, opengl) {
diff --git a/WebKitTools/QtTestBrowser/launcherwindow.cpp b/WebKitTools/QtTestBrowser/launcherwindow.cpp
new file mode 100644
index 0000000..177adea
--- /dev/null
+++ b/WebKitTools/QtTestBrowser/launcherwindow.cpp
@@ -0,0 +1,881 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "launcherwindow.h"
+
+bool LauncherWindow::gUseGraphicsView = false;
+bool LauncherWindow::gUseCompositing = true;
+bool LauncherWindow::gCacheWebView = false;
+bool LauncherWindow::gShowFrameRate = false;
+bool LauncherWindow::gResizesToContents = false;
+bool LauncherWindow::gUseTiledBackingStore = false;
+QGraphicsView::ViewportUpdateMode LauncherWindow::gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate;
+QUrl LauncherWindow::gInspectorUrl;
+
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_S60)
+bool LauncherWindow::gUseFrameFlattening = true;
+#else
+bool LauncherWindow::gUseFrameFlattening = false;
+#endif
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+bool LauncherWindow::gUseQGLWidgetViewport = false;
+#endif
+
+LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene)
+ : MainWindow()
+ , m_currentZoom(100)
+ , m_view(0)
+ , m_inspector(0)
+ , m_formatMenuAction(0)
+ , m_flipAnimated(0)
+ , m_flipYAnimated(0)
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ , m_zoomAnimation(0)
+#endif
+{
+ if (other) {
+ init(other->isGraphicsBased());
+ applyPrefs(other);
+ if (shareScene && other->isGraphicsBased()) {
+ QGraphicsView* otherView = static_cast<QGraphicsView*>(other->m_view);
+ static_cast<QGraphicsView*>(m_view)->setScene(otherView->scene());
+ }
+ } else {
+ init(gUseGraphicsView);
+ applyPrefs();
+ }
+
+ createChrome();
+}
+
+LauncherWindow::~LauncherWindow()
+{
+ grabZoomKeys(false);
+}
+
+void LauncherWindow::init(bool useGraphicsView)
+{
+ QSplitter* splitter = new QSplitter(Qt::Vertical, this);
+ setCentralWidget(splitter);
+
+#if defined(Q_WS_S60)
+ setWindowState(Qt::WindowMaximized);
+#else
+ setWindowState(Qt::WindowNoState);
+ resize(800, 600);
+#endif
+
+ initializeView(useGraphicsView);
+
+ connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));
+ connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
+ connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+ this, SLOT(showLinkHover(const QString&, const QString&)));
+ connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool)));
+
+ m_inspector = new WebInspector(splitter);
+#ifndef QT_NO_PROPERTIES
+ if (!gInspectorUrl.isEmpty())
+ m_inspector->setProperty("_q_inspectorUrl", gInspectorUrl);
+#endif
+ m_inspector->setPage(page());
+ m_inspector->hide();
+ connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater()));
+
+ // the zoom values are chosen to be like in Mozilla Firefox 3
+ m_zoomLevels << 30 << 50 << 67 << 80 << 90;
+ m_zoomLevels << 100;
+ m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
+
+ grabZoomKeys(true);
+}
+
+void LauncherWindow::initializeView(bool useGraphicsView)
+{
+ delete m_view;
+
+ QSplitter* splitter = static_cast<QSplitter*>(centralWidget());
+
+ if (!useGraphicsView) {
+ WebViewTraditional* view = new WebViewTraditional(splitter);
+ view->setPage(page());
+
+ view->installEventFilter(this);
+
+ m_view = view;
+ } else {
+ WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter);
+ view->setPage(page());
+
+ if (m_flipAnimated)
+ connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));
+
+ if (m_flipYAnimated)
+ connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));
+
+ connect(view, SIGNAL(currentFPSUpdated(int)), this, SLOT(updateFPS(int)));
+
+ view->installEventFilter(this);
+ // The implementation of QAbstractScrollArea::eventFilter makes us need
+ // to install the event filter also on the viewport of a QGraphicsView.
+ view->viewport()->installEventFilter(this);
+
+ m_view = view;
+ }
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ m_touchMocking = false;
+#endif
+}
+
+void LauncherWindow::createChrome()
+{
+ QMenu* fileMenu = menuBar()->addMenu("&File");
+ fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
+ fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open);
+ fileMenu->addAction(tr("Open Location..."), this, SLOT(openLocation()), QKeySequence(Qt::CTRL | Qt::Key_L));
+ fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close);
+ fileMenu->addSeparator();
+ fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot()));
+ fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print);
+ fileMenu->addSeparator();
+ fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q));
+
+ QMenu* editMenu = menuBar()->addMenu("&Edit");
+ editMenu->addAction(page()->action(QWebPage::Undo));
+ editMenu->addAction(page()->action(QWebPage::Redo));
+ editMenu->addSeparator();
+ editMenu->addAction(page()->action(QWebPage::Cut));
+ editMenu->addAction(page()->action(QWebPage::Copy));
+ editMenu->addAction(page()->action(QWebPage::Paste));
+ editMenu->addSeparator();
+ QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool)));
+ setEditable->setCheckable(true);
+
+ QMenu* viewMenu = menuBar()->addMenu("&View");
+ viewMenu->addAction(page()->action(QWebPage::Stop));
+ viewMenu->addAction(page()->action(QWebPage::Reload));
+ viewMenu->addSeparator();
+ QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn()));
+ QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut()));
+ QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom()));
+ QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool)));
+ zoomTextOnly->setCheckable(true);
+ zoomTextOnly->setChecked(false);
+ viewMenu->addSeparator();
+ viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml()));
+ // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins()));
+
+ QMenu* formatMenu = new QMenu("F&ormat", this);
+ m_formatMenuAction = menuBar()->addMenu(formatMenu);
+ m_formatMenuAction->setVisible(false);
+ formatMenu->addAction(page()->action(QWebPage::ToggleBold));
+ formatMenu->addAction(page()->action(QWebPage::ToggleItalic));
+ formatMenu->addAction(page()->action(QWebPage::ToggleUnderline));
+ QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction"));
+ writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault));
+ writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight));
+ writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft));
+
+ zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus));
+ zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
+ resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
+
+ QMenu* windowMenu = menuBar()->addMenu("&Window");
+ QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool)));
+ toggleFullScreen->setCheckable(true);
+ toggleFullScreen->setChecked(false);
+
+ // when exit fullscreen mode by clicking on the exit area (bottom right corner) we must
+ // uncheck the Toggle FullScreen action
+ toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool)));
+
+ QMenu* toolsMenu = menuBar()->addMenu("&Develop");
+
+ QWebSettings* settings = page()->settings();
+
+ QMenu* graphicsViewMenu = toolsMenu->addMenu("QGraphicsView");
+ QAction* toggleGraphicsView = graphicsViewMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool)));
+ toggleGraphicsView->setCheckable(true);
+ toggleGraphicsView->setChecked(isGraphicsBased());
+
+ QAction* toggleWebGL = toolsMenu->addAction("Toggle WebGL", this, SLOT(toggleWebGL(bool)));
+ toggleWebGL->setCheckable(true);
+ toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled));
+
+ QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool)));
+ spatialNavigationAction->setCheckable(true);
+ spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S));
+
+ QAction* toggleFrameFlattening = toolsMenu->addAction("Toggle Frame Flattening", this, SLOT(toggleFrameFlattening(bool)));
+ toggleFrameFlattening->setCheckable(true);
+ toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled));
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool)));
+ touchMockAction->setCheckable(true);
+ touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
+#endif
+
+ toolsMenu->addSeparator();
+
+ QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
+ toggleInterruptingJavaScripteEnabled->setCheckable(true);
+ toggleInterruptingJavaScripteEnabled->setChecked(false);
+
+ QAction* toggleJavascriptCanOpenWindows = toolsMenu->addAction("Enable js popup windows", this, SLOT(toggleJavascriptCanOpenWindows(bool)));
+ toggleJavascriptCanOpenWindows->setCheckable(true);
+ toggleJavascriptCanOpenWindows->setChecked(false);
+
+ toolsMenu->addSeparator();
+
+ QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
+ userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U));
+
+ toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
+
+ QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));
+ showInspectorAction->setCheckable(true);
+ showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool)));
+
+ // GraphicsView sub menu.
+ QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool)));
+ toggleAcceleratedCompositing->setCheckable(true);
+ toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled));
+ toggleAcceleratedCompositing->setEnabled(isGraphicsBased());
+ toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+
+ QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool)));
+ toggleResizesToContents->setCheckable(true);
+ toggleResizesToContents->setChecked(gResizesToContents);
+ toggleResizesToContents->setEnabled(isGraphicsBased());
+ toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+
+ QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool)));
+ toggleTiledBackingStore->setCheckable(true);
+ toggleTiledBackingStore->setChecked(false);
+ toggleTiledBackingStore->setEnabled(isGraphicsBased());
+ toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+ QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool)));
+ toggleQGLWidgetViewport->setCheckable(true);
+ toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport);
+ toggleQGLWidgetViewport->setEnabled(isGraphicsBased());
+ toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+#endif
+
+ QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode");
+ viewportUpdateMenu->setEnabled(isGraphicsBased());
+ viewportUpdateMenu->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+
+ QAction* fullUpdate = viewportUpdateMenu->addAction("FullViewportUpdate");
+ fullUpdate->setCheckable(true);
+ fullUpdate->setChecked((gViewportUpdateMode == QGraphicsView::FullViewportUpdate) ? true : false);
+
+ QAction* minimalUpdate = viewportUpdateMenu->addAction("MinimalViewportUpdate");
+ minimalUpdate->setCheckable(true);
+ minimalUpdate->setChecked((gViewportUpdateMode == QGraphicsView::MinimalViewportUpdate) ? true : false);
+
+ QAction* smartUpdate = viewportUpdateMenu->addAction("SmartViewportUpdate");
+ smartUpdate->setCheckable(true);
+ smartUpdate->setChecked((gViewportUpdateMode == QGraphicsView::SmartViewportUpdate) ? true : false);
+
+ QAction* boundingRectUpdate = viewportUpdateMenu->addAction("BoundingRectViewportUpdate");
+ boundingRectUpdate->setCheckable(true);
+ boundingRectUpdate->setChecked((gViewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) ? true : false);
+
+ QAction* noUpdate = viewportUpdateMenu->addAction("NoViewportUpdate");
+ noUpdate->setCheckable(true);
+ noUpdate->setChecked((gViewportUpdateMode == QGraphicsView::NoViewportUpdate) ? true : false);
+
+ QSignalMapper* signalMapper = new QSignalMapper(viewportUpdateMenu);
+ signalMapper->setMapping(fullUpdate, QGraphicsView::FullViewportUpdate);
+ signalMapper->setMapping(minimalUpdate, QGraphicsView::MinimalViewportUpdate);
+ signalMapper->setMapping(smartUpdate, QGraphicsView::SmartViewportUpdate);
+ signalMapper->setMapping(boundingRectUpdate, QGraphicsView::BoundingRectViewportUpdate);
+ signalMapper->setMapping(noUpdate, QGraphicsView::NoViewportUpdate);
+
+ connect(fullUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(minimalUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(smartUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(boundingRectUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(noUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
+
+ connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(changeViewportUpdateMode(int)));
+
+ QActionGroup* viewportUpdateModeActions = new QActionGroup(viewportUpdateMenu);
+ viewportUpdateModeActions->addAction(fullUpdate);
+ viewportUpdateModeActions->addAction(minimalUpdate);
+ viewportUpdateModeActions->addAction(smartUpdate);
+ viewportUpdateModeActions->addAction(boundingRectUpdate);
+ viewportUpdateModeActions->addAction(noUpdate);
+
+ graphicsViewMenu->addSeparator();
+
+ m_flipAnimated = graphicsViewMenu->addAction("Animated Flip");
+ m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+ m_flipAnimated->setEnabled(isGraphicsBased());
+
+ m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip");
+ m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+ m_flipYAnimated->setEnabled(isGraphicsBased());
+
+ if (isGraphicsBased()) {
+ WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
+ connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));
+ connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));
+ }
+
+ QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow()));
+ cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+ cloneWindow->setEnabled(isGraphicsBased());
+
+ graphicsViewMenu->addSeparator();
+
+ QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool)));
+ showFPS->setCheckable(true);
+ showFPS->setEnabled(isGraphicsBased());
+ showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+ showFPS->setChecked(gShowFrameRate);
+}
+
+bool LauncherWindow::isGraphicsBased() const
+{
+ return bool(qobject_cast<QGraphicsView*>(m_view));
+}
+
+inline void applySetting(QWebSettings::WebAttribute type, QWebSettings* settings, QWebSettings* other, bool defaultValue)
+{
+ settings->setAttribute(type, other ? other->testAttribute(type) : defaultValue);
+}
+
+void LauncherWindow::applyPrefs(LauncherWindow* source)
+{
+ QWebSettings* other = source ? source->page()->settings() : 0;
+ QWebSettings* settings = page()->settings();
+
+ applySetting(QWebSettings::AcceleratedCompositingEnabled, settings, other, gUseCompositing);
+ applySetting(QWebSettings::TiledBackingStoreEnabled, settings, other, gUseTiledBackingStore);
+ applySetting(QWebSettings::WebGLEnabled, settings, other, false);
+ applySetting(QWebSettings::FrameFlatteningEnabled, settings, other, gUseFrameFlattening);
+
+ if (!isGraphicsBased())
+ return;
+
+ WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
+ WebViewGraphicsBased* otherView = source ? qobject_cast<WebViewGraphicsBased*>(source->m_view) : 0;
+
+ view->setViewportUpdateMode(otherView ? otherView->viewportUpdateMode() : gViewportUpdateMode);
+ view->setFrameRateMeasurementEnabled(otherView ? otherView->frameRateMeasurementEnabled() : gShowFrameRate);
+
+ if (otherView) {
+ view->setItemCacheMode(otherView->itemCacheMode());
+ view->setResizesToContents(otherView->resizesToContents());
+ } else {
+ view->setItemCacheMode(gCacheWebView ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache);
+ view->setResizesToContents(gResizesToContents);
+ }
+}
+
+void LauncherWindow::keyPressEvent(QKeyEvent* event)
+{
+#ifdef Q_WS_MAEMO_5
+ switch (event->key()) {
+ case Qt::Key_F7:
+ zoomIn();
+ event->accept();
+ break;
+ case Qt::Key_F8:
+ zoomOut();
+ event->accept();
+ break;
+ }
+#endif
+ MainWindow::keyPressEvent(event);
+}
+
+void LauncherWindow::grabZoomKeys(bool grab)
+{
+#ifdef Q_WS_MAEMO_5
+ if (!winId()) {
+ qWarning("Can't grab keys unless we have a window id");
+ return;
+ }
+
+ Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
+ if (!atom) {
+ qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
+ return;
+ }
+
+ unsigned long val = (grab) ? 1 : 0;
+ XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
+#endif
+}
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+void LauncherWindow::sendTouchEvent()
+{
+ if (m_touchPoints.isEmpty())
+ return;
+
+ QEvent::Type type = QEvent::TouchUpdate;
+ if (m_touchPoints.size() == 1) {
+ if (m_touchPoints[0].state() == Qt::TouchPointReleased)
+ type = QEvent::TouchEnd;
+ else if (m_touchPoints[0].state() == Qt::TouchPointPressed)
+ type = QEvent::TouchBegin;
+ }
+
+ QTouchEvent touchEv(type);
+ touchEv.setTouchPoints(m_touchPoints);
+ QCoreApplication::sendEvent(page(), &touchEv);
+
+ // After sending the event, remove all touchpoints that were released
+ if (m_touchPoints[0].state() == Qt::TouchPointReleased)
+ m_touchPoints.removeAt(0);
+ if (m_touchPoints.size() > 1 && m_touchPoints[1].state() == Qt::TouchPointReleased)
+ m_touchPoints.removeAt(1);
+}
+#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+
+bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
+{
+ // If click pos is the bottom right corner (square with size defined by gExitClickArea)
+ // and the window is on FullScreen, the window must return to its original state.
+ if (event->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent* ev = static_cast<QMouseEvent*>(event);
+ if (windowState() == Qt::WindowFullScreen
+ && ev->pos().x() > (width() - gExitClickArea)
+ && ev->pos().y() > (height() - gExitClickArea)) {
+
+ emit enteredFullScreenMode(false);
+ }
+ }
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ if (!m_touchMocking)
+ return QObject::eventFilter(obj, event);
+
+ if (event->type() == QEvent::MouseButtonPress
+ || event->type() == QEvent::MouseButtonRelease
+ || event->type() == QEvent::MouseButtonDblClick
+ || event->type() == QEvent::MouseMove) {
+
+ QMouseEvent* ev = static_cast<QMouseEvent*>(event);
+ if (ev->type() == QEvent::MouseMove
+ && !(ev->buttons() & Qt::LeftButton))
+ return false;
+
+ QTouchEvent::TouchPoint touchPoint;
+ touchPoint.setState(Qt::TouchPointMoved);
+ if ((ev->type() == QEvent::MouseButtonPress
+ || ev->type() == QEvent::MouseButtonDblClick))
+ touchPoint.setState(Qt::TouchPointPressed);
+ else if (ev->type() == QEvent::MouseButtonRelease)
+ touchPoint.setState(Qt::TouchPointReleased);
+
+ touchPoint.setId(0);
+ touchPoint.setScreenPos(ev->globalPos());
+ touchPoint.setPos(ev->pos());
+ touchPoint.setPressure(1);
+
+ // If the point already exists, update it. Otherwise create it.
+ if (m_touchPoints.size() > 0 && !m_touchPoints[0].id())
+ m_touchPoints[0] = touchPoint;
+ else if (m_touchPoints.size() > 1 && !m_touchPoints[1].id())
+ m_touchPoints[1] = touchPoint;
+ else
+ m_touchPoints.append(touchPoint);
+
+ sendTouchEvent();
+ } else if (event->type() == QEvent::KeyPress
+ && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F
+ && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) {
+
+ // If the keyboard point is already pressed, release it.
+ // Otherwise create it and append to m_touchPoints.
+ if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) {
+ m_touchPoints[0].setState(Qt::TouchPointReleased);
+ sendTouchEvent();
+ } else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) {
+ m_touchPoints[1].setState(Qt::TouchPointReleased);
+ sendTouchEvent();
+ } else {
+ QTouchEvent::TouchPoint touchPoint;
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setId(1);
+ touchPoint.setScreenPos(QCursor::pos());
+ touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos()));
+ touchPoint.setPressure(1);
+ m_touchPoints.append(touchPoint);
+ sendTouchEvent();
+
+ // After sending the event, change the touchpoint state to stationary
+ m_touchPoints.last().setState(Qt::TouchPointStationary);
+ }
+ }
+#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+
+ return false;
+}
+
+void LauncherWindow::loadStarted()
+{
+ m_view->setFocus(Qt::OtherFocusReason);
+}
+
+void LauncherWindow::loadFinished()
+{
+ QUrl url = page()->mainFrame()->url();
+ setAddressUrl(url.toString(QUrl::RemoveUserInfo));
+ addCompleterEntry(url);
+}
+
+void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip)
+{
+#ifndef Q_WS_MAEMO_5
+ statusBar()->showMessage(link);
+#endif
+#ifndef QT_NO_TOOLTIP
+ if (!toolTip.isEmpty())
+ QToolTip::showText(QCursor::pos(), toolTip);
+#endif
+}
+
+void LauncherWindow::zoomAnimationFinished()
+{
+ if (!isGraphicsBased())
+ return;
+ QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView();
+ view->setTiledBackingStoreFrozen(false);
+}
+
+void LauncherWindow::applyZoom()
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ if (isGraphicsBased() && page()->settings()->testAttribute(QWebSettings::TiledBackingStoreEnabled)) {
+ QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView();
+ view->setTiledBackingStoreFrozen(true);
+ if (!m_zoomAnimation) {
+ m_zoomAnimation = new QPropertyAnimation(view, "scale");
+ m_zoomAnimation->setStartValue(view->scale());
+ connect(m_zoomAnimation, SIGNAL(finished()), this, SLOT(zoomAnimationFinished()));
+ } else {
+ m_zoomAnimation->stop();
+ m_zoomAnimation->setStartValue(m_zoomAnimation->currentValue());
+ }
+
+ m_zoomAnimation->setDuration(300);
+ m_zoomAnimation->setEndValue(qreal(m_currentZoom) / 100.);
+ m_zoomAnimation->start();
+ return;
+ }
+#endif
+ page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0);
+}
+
+void LauncherWindow::zoomIn()
+{
+ int i = m_zoomLevels.indexOf(m_currentZoom);
+ Q_ASSERT(i >= 0);
+ if (i < m_zoomLevels.count() - 1)
+ m_currentZoom = m_zoomLevels[i + 1];
+
+ applyZoom();
+}
+
+void LauncherWindow::zoomOut()
+{
+ int i = m_zoomLevels.indexOf(m_currentZoom);
+ Q_ASSERT(i >= 0);
+ if (i > 0)
+ m_currentZoom = m_zoomLevels[i - 1];
+
+ applyZoom();
+}
+
+void LauncherWindow::resetZoom()
+{
+ m_currentZoom = 100;
+ page()->mainFrame()->setZoomFactor(1.0);
+}
+
+void LauncherWindow::toggleZoomTextOnly(bool b)
+{
+ page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b);
+}
+
+void LauncherWindow::print()
+{
+#if !defined(QT_NO_PRINTER)
+ QPrintPreviewDialog dlg(this);
+ connect(&dlg, SIGNAL(paintRequested(QPrinter*)),
+ page()->mainFrame(), SLOT(print(QPrinter*)));
+ dlg.exec();
+#endif
+}
+
+void LauncherWindow::screenshot()
+{
+ QPixmap pixmap = QPixmap::grabWidget(m_view);
+ QLabel* label = new QLabel;
+ label->setAttribute(Qt::WA_DeleteOnClose);
+ label->setWindowTitle("Screenshot - Preview");
+ label->setPixmap(pixmap);
+ label->show();
+
+ QString fileName = QFileDialog::getSaveFileName(label, "Screenshot");
+ if (!fileName.isEmpty()) {
+ pixmap.save(fileName, "png");
+ label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
+ }
+}
+
+void LauncherWindow::setEditable(bool on)
+{
+ page()->setContentEditable(on);
+ m_formatMenuAction->setVisible(on);
+}
+
+/*
+void LauncherWindow::dumpPlugins() {
+ QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins();
+ foreach (const QWebPluginInfo plugin, plugins) {
+ qDebug() << "Plugin:" << plugin.name();
+ foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) {
+ qDebug() << " " << mime.name;
+ }
+ }
+}
+*/
+
+void LauncherWindow::dumpHtml()
+{
+ qDebug() << "HTML: " << page()->mainFrame()->toHtml();
+}
+
+void LauncherWindow::selectElements()
+{
+ bool ok;
+ QString str = QInputDialog::getText(this, "Select elements", "Choose elements",
+ QLineEdit::Normal, "a", &ok);
+
+ if (ok && !str.isEmpty()) {
+ QWebElementCollection result = page()->mainFrame()->findAllElements(str);
+ foreach (QWebElement e, result)
+ e.setStyleProperty("background-color", "yellow");
+#ifndef Q_WS_MAEMO_5
+ statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000);
+#endif
+ }
+}
+
+void LauncherWindow::setTouchMocking(bool on)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ m_touchMocking = on;
+#endif
+}
+
+void LauncherWindow::toggleAcceleratedCompositing(bool toggle)
+{
+ gUseCompositing = toggle;
+ page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle);
+}
+
+void LauncherWindow::toggleTiledBackingStore(bool toggle)
+{
+ page()->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, toggle);
+}
+
+void LauncherWindow::toggleResizesToContents(bool toggle)
+{
+ gResizesToContents = toggle;
+ static_cast<WebViewGraphicsBased*>(m_view)->setResizesToContents(toggle);
+}
+
+void LauncherWindow::toggleWebGL(bool toggle)
+{
+ page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle);
+}
+
+void LauncherWindow::toggleSpatialNavigation(bool b)
+{
+ page()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, b);
+}
+
+void LauncherWindow::toggleFullScreenMode(bool enable)
+{
+ if (enable)
+ setWindowState(Qt::WindowFullScreen);
+ else {
+#if defined(Q_WS_S60)
+ setWindowState(Qt::WindowMaximized);
+#else
+ setWindowState(Qt::WindowNoState);
+#endif
+ }
+}
+
+void LauncherWindow::toggleFrameFlattening(bool toggle)
+{
+ gUseFrameFlattening = toggle;
+ page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle);
+}
+
+void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable)
+{
+ page()->setInterruptingJavaScriptEnabled(enable);
+}
+
+void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable)
+{
+ page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable);
+}
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+void LauncherWindow::toggleQGLWidgetViewport(bool enable)
+{
+ if (!isGraphicsBased())
+ return;
+
+ gUseQGLWidgetViewport = enable;
+ WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
+
+ view->setViewport(enable ? new QGLWidget() : 0);
+}
+#endif
+
+void LauncherWindow::changeViewportUpdateMode(int mode)
+{
+ gViewportUpdateMode = QGraphicsView::ViewportUpdateMode(mode);
+
+ if (!isGraphicsBased())
+ return;
+
+ WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
+ view->setViewportUpdateMode(gViewportUpdateMode);
+}
+
+void LauncherWindow::showFPS(bool enable)
+{
+ if (!isGraphicsBased())
+ return;
+
+ gShowFrameRate = enable;
+ WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
+ view->setFrameRateMeasurementEnabled(enable);
+
+ if (!enable) {
+#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60)
+ setWindowTitle("");
+#else
+ statusBar()->clearMessage();
+#endif
+ }
+}
+
+void LauncherWindow::showUserAgentDialog()
+{
+ QStringList items;
+ QFile file(":/useragentlist.txt");
+ if (file.open(QIODevice::ReadOnly)) {
+ while (!file.atEnd())
+ items << file.readLine().trimmed();
+ file.close();
+ }
+
+ QSettings settings;
+ QString customUserAgent = settings.value("CustomUserAgent").toString();
+ if (!items.contains(customUserAgent) && !customUserAgent.isEmpty())
+ items << customUserAgent;
+
+ QDialog* dialog = new QDialog(this);
+ dialog->resize(size().width() * 0.7, dialog->size().height());
+ dialog->setMaximumHeight(dialog->size().height());
+ dialog->setWindowTitle("Change User Agent");
+
+ QVBoxLayout* layout = new QVBoxLayout(dialog);
+ dialog->setLayout(layout);
+
+ QComboBox* combo = new QComboBox(dialog);
+ combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
+ combo->setEditable(true);
+ combo->insertItems(0, items);
+ layout->addWidget(combo);
+
+ int index = combo->findText(page()->userAgentForUrl(QUrl()));
+ combo->setCurrentIndex(index);
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
+ | QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
+ connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+ layout->addWidget(buttonBox);
+
+ if (dialog->exec() && !combo->currentText().isEmpty()) {
+ page()->setUserAgent(combo->currentText());
+ if (!items.contains(combo->currentText()))
+ settings.setValue("CustomUserAgent", combo->currentText());
+ }
+
+ delete dialog;
+}
+
+void LauncherWindow::updateFPS(int fps)
+{
+ QString fpsStatusText = QString("Current FPS: %1").arg(fps);
+
+#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60)
+ setWindowTitle(fpsStatusText);
+#else
+ statusBar()->showMessage(fpsStatusText);
+#endif
+}
+
+LauncherWindow* LauncherWindow::newWindow()
+{
+ LauncherWindow* mw = new LauncherWindow(this, false);
+ mw->show();
+ return mw;
+}
+
+LauncherWindow* LauncherWindow::cloneWindow()
+{
+ LauncherWindow* mw = new LauncherWindow(this, true);
+ mw->show();
+ return mw;
+}
+
diff --git a/WebKitTools/QtTestBrowser/launcherwindow.h b/WebKitTools/QtTestBrowser/launcherwindow.h
new file mode 100644
index 0000000..f9f157d
--- /dev/null
+++ b/WebKitTools/QtTestBrowser/launcherwindow.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 launcherwindow_h
+#define launcherwindow_h
+
+#include <QtGui>
+#include <QtNetwork/QNetworkRequest>
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+#include <QtOpenGL/QGLWidget>
+#endif
+
+#if !defined(QT_NO_PRINTER)
+#include <QPrintPreviewDialog>
+#endif
+
+#ifndef QT_NO_UITOOLS
+#include <QtUiTools/QUiLoader>
+#endif
+
+#include <QDebug>
+
+#include <cstdio>
+#include <qevent.h>
+#include <qwebelement.h>
+#include <qwebframe.h>
+#include <qwebinspector.h>
+#include <qwebsettings.h>
+
+#ifdef Q_WS_MAEMO_5
+#include <qx11info_x11.h>
+#endif
+
+#include "mainwindow.h"
+#include "urlloader.h"
+#include "utils.h"
+#include "webinspector.h"
+#include "webpage.h"
+#include "webview.h"
+#include "../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+
+#ifdef Q_WS_MAEMO_5
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#undef KeyPress
+#endif
+
+class LauncherWindow : public MainWindow {
+ Q_OBJECT
+
+public:
+ LauncherWindow(LauncherWindow* other = 0, bool shareScene = false);
+ virtual ~LauncherWindow();
+
+ virtual void keyPressEvent(QKeyEvent* event);
+ void grabZoomKeys(bool grab);
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ void sendTouchEvent();
+#endif
+
+ bool eventFilter(QObject* obj, QEvent* event);
+
+public:
+ static const int gExitClickArea = 80;
+ static bool gUseGraphicsView;
+ static bool gUseCompositing;
+ static bool gCacheWebView;
+ static bool gShowFrameRate;
+ static bool gResizesToContents;
+ static bool gUseTiledBackingStore;
+ static bool gUseFrameFlattening;
+ static QGraphicsView::ViewportUpdateMode gViewportUpdateMode;
+ static QUrl gInspectorUrl;
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+ static bool gUseQGLWidgetViewport;
+#endif
+
+protected slots:
+ void loadStarted();
+ void loadFinished();
+
+ void showLinkHover(const QString &link, const QString &toolTip);
+
+ void zoomIn();
+ void zoomOut();
+ void resetZoom();
+ void toggleZoomTextOnly(bool on);
+ void zoomAnimationFinished();
+
+ void print();
+ void screenshot();
+
+ void setEditable(bool on);
+
+ /* void dumpPlugins() */
+ void dumpHtml();
+
+ void initializeView(bool useGraphicsView = false);
+
+ void setTouchMocking(bool on);
+ void toggleAcceleratedCompositing(bool toggle);
+ void toggleTiledBackingStore(bool toggle);
+ void toggleResizesToContents(bool toggle);
+ void toggleWebGL(bool toggle);
+ void toggleSpatialNavigation(bool b);
+ void toggleFullScreenMode(bool enable);
+ void toggleFrameFlattening(bool toggle);
+ void toggleInterruptingJavaScriptEnabled(bool enable);
+ void toggleJavascriptCanOpenWindows(bool enable);
+
+#if defined(QT_CONFIGURED_WITH_OPENGL)
+ void toggleQGLWidgetViewport(bool enable);
+#endif
+
+ void changeViewportUpdateMode(int mode);
+ void selectElements();
+ void showFPS(bool enable);
+ void showUserAgentDialog();
+
+public slots:
+ LauncherWindow* newWindow();
+ LauncherWindow* cloneWindow();
+ void updateFPS(int fps);
+
+signals:
+ void enteredFullScreenMode(bool on);
+
+private:
+ void init(bool useGraphicsView = false);
+ bool isGraphicsBased() const;
+ void createChrome();
+ void applyPrefs(LauncherWindow* other = 0);
+ void applyZoom();
+
+private:
+ QVector<int> m_zoomLevels;
+ int m_currentZoom;
+
+ QWidget* m_view;
+ WebInspector* m_inspector;
+
+ QAction* m_formatMenuAction;
+ QAction* m_flipAnimated;
+ QAction* m_flipYAnimated;
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QPropertyAnimation* m_zoomAnimation;
+ QList<QTouchEvent::TouchPoint> m_touchPoints;
+ bool m_touchMocking;
+#endif
+};
+
+#endif
diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp
index 288472c..33a6416 100644
--- a/WebKitTools/QtTestBrowser/main.cpp
+++ b/WebKitTools/QtTestBrowser/main.cpp
@@ -30,1011 +30,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <QtGui>
-#include <QtNetwork/QNetworkRequest>
-
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-#include <QtOpenGL/QGLWidget>
-#endif
-
-#if !defined(QT_NO_PRINTER)
-#include <QPrintPreviewDialog>
-#endif
-
-#ifndef QT_NO_UITOOLS
-#include <QtUiTools/QUiLoader>
-#endif
-
-#include <QDebug>
-
-#include <cstdio>
-#include <qevent.h>
-#include <qwebelement.h>
-#include <qwebframe.h>
-#include <qwebinspector.h>
-#include <qwebsettings.h>
-
-#ifdef Q_WS_MAEMO_5
-#include <qx11info_x11.h>
-#endif
-
-#include "mainwindow.h"
+#include "launcherwindow.h"
#include "urlloader.h"
-#include "utils.h"
-#include "webinspector.h"
-#include "webpage.h"
-#include "webview.h"
-#include "../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
-
-#ifdef Q_WS_MAEMO_5
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#undef KeyPress
-#endif
-
-static const int gExitClickArea = 80;
-static bool gUseGraphicsView = false;
-static bool gUseCompositing = true;
-static bool gCacheWebView = false;
-static bool gShowFrameRate = false;
-static QGraphicsView::ViewportUpdateMode gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate;
-static QUrl gInspectorUrl;
-static bool gResizesToContents = false;
-static bool gUseTiledBackingStore = false;
-
-#if defined(Q_WS_MAEMO_5) || defined(Q_WS_S60)
-static bool gUseFrameFlattening = true;
-#else
-static bool gUseFrameFlattening = false;
-#endif
-
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-static bool gUseQGLWidgetViewport = false;
-#endif
-
-class LauncherWindow : public MainWindow {
- Q_OBJECT
-
-public:
- LauncherWindow(LauncherWindow* other = 0, bool shareScene = false);
- virtual ~LauncherWindow();
-
- virtual void keyPressEvent(QKeyEvent* event);
- void grabZoomKeys(bool grab);
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- void sendTouchEvent();
-#endif
-
- bool eventFilter(QObject* obj, QEvent* event);
-
-protected slots:
- void loadStarted();
- void loadFinished();
-
- void showLinkHover(const QString &link, const QString &toolTip);
-
- void zoomIn();
- void zoomOut();
- void resetZoom();
- void toggleZoomTextOnly(bool on);
- void zoomAnimationFinished();
-
- void print();
- void screenshot();
-
- void setEditable(bool on);
-
- /* void dumpPlugins() */
- void dumpHtml();
-
- void selectElements();
-
- void setTouchMocking(bool on);
- void toggleAcceleratedCompositing(bool toggle);
- void toggleTiledBackingStore(bool toggle);
- void toggleResizesToContents(bool toggle);
-
- void toggleWebGL(bool toggle);
- void initializeView(bool useGraphicsView = false);
- void toggleSpatialNavigation(bool b);
- void toggleFullScreenMode(bool enable);
- void showFPS(bool enable);
- void changeViewportUpdateMode(int mode);
- void toggleFrameFlattening(bool toggle);
- void toggleInterruptingJavaScriptEnabled(bool enable);
- void toggleJavascriptCanOpenWindows(bool enable);
-
-#if defined(QT_CONFIGURED_WITH_OPENGL)
- void toggleQGLWidgetViewport(bool enable);
-#endif
-
- void showUserAgentDialog();
-
-public slots:
- LauncherWindow* newWindow();
- LauncherWindow* cloneWindow();
- void updateFPS(int fps);
-
-signals:
- void enteredFullScreenMode(bool on);
-
-private:
- void createChrome();
- void applyZoom();
-
-private:
- QVector<int> m_zoomLevels;
- int m_currentZoom;
-
- QWidget* m_view;
- WebInspector* m_inspector;
-
- QAction* m_formatMenuAction;
- QAction* m_flipAnimated;
- QAction* m_flipYAnimated;
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- QPropertyAnimation* m_zoomAnimation;
- QList<QTouchEvent::TouchPoint> m_touchPoints;
- bool m_touchMocking;
-#endif
-
- void init(bool useGraphicsView = false);
- bool isGraphicsBased() const;
- void applyPrefs(LauncherWindow* other = 0);
-};
-
-LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene)
- : MainWindow()
- , m_currentZoom(100)
- , m_view(0)
- , m_inspector(0)
- , m_formatMenuAction(0)
- , m_flipAnimated(0)
- , m_flipYAnimated(0)
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- , m_zoomAnimation(0)
-#endif
-{
- if (other) {
- init(other->isGraphicsBased());
- applyPrefs(other);
- if (shareScene && other->isGraphicsBased()) {
- QGraphicsView* otherView = static_cast<QGraphicsView*>(other->m_view);
- static_cast<QGraphicsView*>(m_view)->setScene(otherView->scene());
- }
- } else {
- init(gUseGraphicsView);
- applyPrefs();
- }
-
- createChrome();
-}
-
-LauncherWindow::~LauncherWindow()
-{
- grabZoomKeys(false);
-}
-
-void LauncherWindow::init(bool useGraphicsView)
-{
- QSplitter* splitter = new QSplitter(Qt::Vertical, this);
- setCentralWidget(splitter);
-
-#if defined(Q_WS_S60)
- setWindowState(Qt::WindowMaximized);
-#else
- setWindowState(Qt::WindowNoState);
- resize(800, 600);
-#endif
-
- initializeView(useGraphicsView);
-
- connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));
- connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
- connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
- this, SLOT(showLinkHover(const QString&, const QString&)));
- connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool)));
-
- m_inspector = new WebInspector(splitter);
-#ifndef QT_NO_PROPERTIES
- if (!gInspectorUrl.isEmpty())
- m_inspector->setProperty("_q_inspectorUrl", gInspectorUrl);
-#endif
- m_inspector->setPage(page());
- m_inspector->hide();
- connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater()));
-
- // the zoom values are chosen to be like in Mozilla Firefox 3
- m_zoomLevels << 30 << 50 << 67 << 80 << 90;
- m_zoomLevels << 100;
- m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
-
- grabZoomKeys(true);
-}
-
-bool LauncherWindow::isGraphicsBased() const
-{
- return bool(qobject_cast<QGraphicsView*>(m_view));
-}
-
-inline void applySetting(QWebSettings::WebAttribute type, QWebSettings* settings, QWebSettings* other, bool defaultValue)
-{
- settings->setAttribute(type, other ? other->testAttribute(type) : defaultValue);
-}
-
-void LauncherWindow::applyPrefs(LauncherWindow* source)
-{
- QWebSettings* other = source ? source->page()->settings() : 0;
- QWebSettings* settings = page()->settings();
-
- applySetting(QWebSettings::AcceleratedCompositingEnabled, settings, other, gUseCompositing);
- applySetting(QWebSettings::TiledBackingStoreEnabled, settings, other, gUseTiledBackingStore);
- applySetting(QWebSettings::WebGLEnabled, settings, other, false);
- applySetting(QWebSettings::FrameFlatteningEnabled, settings, other, gUseFrameFlattening);
-
- if (!isGraphicsBased())
- return;
-
- WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
- WebViewGraphicsBased* otherView = source ? qobject_cast<WebViewGraphicsBased*>(source->m_view) : 0;
-
- view->setViewportUpdateMode(otherView ? otherView->viewportUpdateMode() : gViewportUpdateMode);
- view->setFrameRateMeasurementEnabled(otherView ? otherView->frameRateMeasurementEnabled() : gShowFrameRate);
-
- if (otherView)
- view->setItemCacheMode(otherView->itemCacheMode());
- else
- view->setItemCacheMode(gCacheWebView ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache);
-}
-
-void LauncherWindow::keyPressEvent(QKeyEvent* event)
-{
-#ifdef Q_WS_MAEMO_5
- switch (event->key()) {
- case Qt::Key_F7:
- zoomIn();
- event->accept();
- break;
- case Qt::Key_F8:
- zoomOut();
- event->accept();
- break;
- }
-#endif
- MainWindow::keyPressEvent(event);
-}
-
-void LauncherWindow::grabZoomKeys(bool grab)
-{
-#ifdef Q_WS_MAEMO_5
- if (!winId()) {
- qWarning("Can't grab keys unless we have a window id");
- return;
- }
-
- Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
- if (!atom) {
- qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
- return;
- }
-
- unsigned long val = (grab) ? 1 : 0;
- XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
-#endif
-}
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-void LauncherWindow::sendTouchEvent()
-{
- if (m_touchPoints.isEmpty())
- return;
-
- QEvent::Type type = QEvent::TouchUpdate;
- if (m_touchPoints.size() == 1) {
- if (m_touchPoints[0].state() == Qt::TouchPointReleased)
- type = QEvent::TouchEnd;
- else if (m_touchPoints[0].state() == Qt::TouchPointPressed)
- type = QEvent::TouchBegin;
- }
-
- QTouchEvent touchEv(type);
- touchEv.setTouchPoints(m_touchPoints);
- QCoreApplication::sendEvent(page(), &touchEv);
-
- // After sending the event, remove all touchpoints that were released
- if (m_touchPoints[0].state() == Qt::TouchPointReleased)
- m_touchPoints.removeAt(0);
- if (m_touchPoints.size() > 1 && m_touchPoints[1].state() == Qt::TouchPointReleased)
- m_touchPoints.removeAt(1);
-}
-#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-
-bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
-{
- // If click pos is the bottom right corner (square with size defined by gExitClickArea)
- // and the window is on FullScreen, the window must return to its original state.
- if (event->type() == QEvent::MouseButtonRelease) {
- QMouseEvent* ev = static_cast<QMouseEvent*>(event);
- if (windowState() == Qt::WindowFullScreen
- && ev->pos().x() > (width() - gExitClickArea)
- && ev->pos().y() > (height() - gExitClickArea)) {
-
- emit enteredFullScreenMode(false);
- }
- }
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- if (!m_touchMocking)
- return QObject::eventFilter(obj, event);
-
- if (event->type() == QEvent::MouseButtonPress
- || event->type() == QEvent::MouseButtonRelease
- || event->type() == QEvent::MouseButtonDblClick
- || event->type() == QEvent::MouseMove) {
-
- QMouseEvent* ev = static_cast<QMouseEvent*>(event);
- if (ev->type() == QEvent::MouseMove
- && !(ev->buttons() & Qt::LeftButton))
- return false;
-
- QTouchEvent::TouchPoint touchPoint;
- touchPoint.setState(Qt::TouchPointMoved);
- if ((ev->type() == QEvent::MouseButtonPress
- || ev->type() == QEvent::MouseButtonDblClick))
- touchPoint.setState(Qt::TouchPointPressed);
- else if (ev->type() == QEvent::MouseButtonRelease)
- touchPoint.setState(Qt::TouchPointReleased);
-
- touchPoint.setId(0);
- touchPoint.setScreenPos(ev->globalPos());
- touchPoint.setPos(ev->pos());
- touchPoint.setPressure(1);
-
- // If the point already exists, update it. Otherwise create it.
- if (m_touchPoints.size() > 0 && !m_touchPoints[0].id())
- m_touchPoints[0] = touchPoint;
- else if (m_touchPoints.size() > 1 && !m_touchPoints[1].id())
- m_touchPoints[1] = touchPoint;
- else
- m_touchPoints.append(touchPoint);
-
- sendTouchEvent();
- } else if (event->type() == QEvent::KeyPress
- && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F
- && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) {
-
- // If the keyboard point is already pressed, release it.
- // Otherwise create it and append to m_touchPoints.
- if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) {
- m_touchPoints[0].setState(Qt::TouchPointReleased);
- sendTouchEvent();
- } else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) {
- m_touchPoints[1].setState(Qt::TouchPointReleased);
- sendTouchEvent();
- } else {
- QTouchEvent::TouchPoint touchPoint;
- touchPoint.setState(Qt::TouchPointPressed);
- touchPoint.setId(1);
- touchPoint.setScreenPos(QCursor::pos());
- touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos()));
- touchPoint.setPressure(1);
- m_touchPoints.append(touchPoint);
- sendTouchEvent();
-
- // After sending the event, change the touchpoint state to stationary
- m_touchPoints.last().setState(Qt::TouchPointStationary);
- }
- }
-#endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-
- return false;
-}
-
-void LauncherWindow::loadStarted()
-{
- m_view->setFocus(Qt::OtherFocusReason);
-}
-
-void LauncherWindow::loadFinished()
-{
- QUrl url = page()->mainFrame()->url();
- setAddressUrl(url.toString(QUrl::RemoveUserInfo));
- addCompleterEntry(url);
-}
-
-void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip)
-{
-#ifndef Q_WS_MAEMO_5
- statusBar()->showMessage(link);
-#endif
-#ifndef QT_NO_TOOLTIP
- if (!toolTip.isEmpty())
- QToolTip::showText(QCursor::pos(), toolTip);
-#endif
-}
-
-void LauncherWindow::zoomAnimationFinished()
-{
- if (!isGraphicsBased())
- return;
- QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView();
- view->setTiledBackingStoreFrozen(false);
-}
-
-void LauncherWindow::applyZoom()
-{
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- if (isGraphicsBased() && page()->settings()->testAttribute(QWebSettings::TiledBackingStoreEnabled)) {
- QGraphicsWebView* view = static_cast<WebViewGraphicsBased*>(m_view)->graphicsWebView();
- view->setTiledBackingStoreFrozen(true);
- if (!m_zoomAnimation) {
- m_zoomAnimation = new QPropertyAnimation(view, "scale");
- m_zoomAnimation->setStartValue(view->scale());
- connect(m_zoomAnimation, SIGNAL(finished()), this, SLOT(zoomAnimationFinished()));
- } else {
- m_zoomAnimation->stop();
- m_zoomAnimation->setStartValue(m_zoomAnimation->currentValue());
- }
-
- m_zoomAnimation->setDuration(300);
- m_zoomAnimation->setEndValue(qreal(m_currentZoom) / 100.);
- m_zoomAnimation->start();
- return;
- }
-#endif
- page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0);
-}
-
-void LauncherWindow::zoomIn()
-{
- int i = m_zoomLevels.indexOf(m_currentZoom);
- Q_ASSERT(i >= 0);
- if (i < m_zoomLevels.count() - 1)
- m_currentZoom = m_zoomLevels[i + 1];
-
- applyZoom();
-}
-
-void LauncherWindow::zoomOut()
-{
- int i = m_zoomLevels.indexOf(m_currentZoom);
- Q_ASSERT(i >= 0);
- if (i > 0)
- m_currentZoom = m_zoomLevels[i - 1];
-
- applyZoom();
-}
-
-void LauncherWindow::resetZoom()
-{
- m_currentZoom = 100;
- page()->mainFrame()->setZoomFactor(1.0);
-}
-
-void LauncherWindow::toggleZoomTextOnly(bool b)
-{
- page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b);
-}
-
-void LauncherWindow::print()
-{
-#if !defined(QT_NO_PRINTER)
- QPrintPreviewDialog dlg(this);
- connect(&dlg, SIGNAL(paintRequested(QPrinter*)),
- page()->mainFrame(), SLOT(print(QPrinter*)));
- dlg.exec();
-#endif
-}
-
-void LauncherWindow::screenshot()
-{
- QPixmap pixmap = QPixmap::grabWidget(m_view);
- QLabel* label = new QLabel;
- label->setAttribute(Qt::WA_DeleteOnClose);
- label->setWindowTitle("Screenshot - Preview");
- label->setPixmap(pixmap);
- label->show();
-
- QString fileName = QFileDialog::getSaveFileName(label, "Screenshot");
- if (!fileName.isEmpty()) {
- pixmap.save(fileName, "png");
- label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
- }
-}
-
-void LauncherWindow::setEditable(bool on)
-{
- page()->setContentEditable(on);
- m_formatMenuAction->setVisible(on);
-}
-
-/*
-void LauncherWindow::dumpPlugins() {
- QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins();
- foreach (const QWebPluginInfo plugin, plugins) {
- qDebug() << "Plugin:" << plugin.name();
- foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) {
- qDebug() << " " << mime.name;
- }
- }
-}
-*/
-
-void LauncherWindow::dumpHtml()
-{
- qDebug() << "HTML: " << page()->mainFrame()->toHtml();
-}
-
-void LauncherWindow::selectElements()
-{
- bool ok;
- QString str = QInputDialog::getText(this, "Select elements", "Choose elements",
- QLineEdit::Normal, "a", &ok);
-
- if (ok && !str.isEmpty()) {
- QWebElementCollection result = page()->mainFrame()->findAllElements(str);
- foreach (QWebElement e, result)
- e.setStyleProperty("background-color", "yellow");
-#ifndef Q_WS_MAEMO_5
- statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000);
-#endif
- }
-}
-
-void LauncherWindow::setTouchMocking(bool on)
-{
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- m_touchMocking = on;
-#endif
-}
-
-void LauncherWindow::toggleAcceleratedCompositing(bool toggle)
-{
- gUseCompositing = toggle;
- page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle);
-}
-
-void LauncherWindow::toggleTiledBackingStore(bool toggle)
-{
- page()->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, toggle);
-}
-
-void LauncherWindow::toggleResizesToContents(bool toggle)
-{
- static_cast<WebViewGraphicsBased*>(m_view)->setResizesToContents(toggle);
-}
-
-void LauncherWindow::toggleWebGL(bool toggle)
-{
- page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle);
-}
-
-void LauncherWindow::initializeView(bool useGraphicsView)
-{
- delete m_view;
-
- QSplitter* splitter = static_cast<QSplitter*>(centralWidget());
-
- if (!useGraphicsView) {
- WebViewTraditional* view = new WebViewTraditional(splitter);
- view->setPage(page());
-
- view->installEventFilter(this);
-
- m_view = view;
- } else {
- WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter);
- view->setPage(page());
-
- if (m_flipAnimated)
- connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));
-
- if (m_flipYAnimated)
- connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));
-
- connect(view, SIGNAL(currentFPSUpdated(int)), this, SLOT(updateFPS(int)));
-
- view->installEventFilter(this);
- // The implementation of QAbstractScrollArea::eventFilter makes us need
- // to install the event filter also on the viewport of a QGraphicsView.
- view->viewport()->installEventFilter(this);
-
- m_view = view;
- }
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- m_touchMocking = false;
-#endif
-}
-
-void LauncherWindow::toggleSpatialNavigation(bool b)
-{
- page()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, b);
-}
-
-void LauncherWindow::toggleFullScreenMode(bool enable)
-{
- if (enable)
- setWindowState(Qt::WindowFullScreen);
- else {
-#if defined(Q_WS_S60)
- setWindowState(Qt::WindowMaximized);
-#else
- setWindowState(Qt::WindowNoState);
-#endif
- }
-}
-
-void LauncherWindow::showFPS(bool enable)
-{
- if (!isGraphicsBased())
- return;
-
- gShowFrameRate = enable;
- WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
- view->setFrameRateMeasurementEnabled(enable);
-
- if (!enable) {
-#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60)
- setWindowTitle("");
-#else
- statusBar()->clearMessage();
-#endif
- }
-}
-
-void LauncherWindow::changeViewportUpdateMode(int mode)
-{
- gViewportUpdateMode = QGraphicsView::ViewportUpdateMode(mode);
-
- if (!isGraphicsBased())
- return;
-
- WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
- view->setViewportUpdateMode(gViewportUpdateMode);
-}
-
-void LauncherWindow::toggleFrameFlattening(bool toggle)
-{
- gUseFrameFlattening = toggle;
- page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle);
-}
-
-void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable)
-{
- page()->setInterruptingJavaScriptEnabled(enable);
-}
-
-void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable)
-{
- page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable);
-}
-
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-void LauncherWindow::toggleQGLWidgetViewport(bool enable)
-{
- if (!isGraphicsBased())
- return;
-
- gUseQGLWidgetViewport = enable;
- WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
-
- view->setViewport(enable ? new QGLWidget() : 0);
-}
-#endif
-
-void LauncherWindow::showUserAgentDialog()
-{
- QStringList items;
- QFile file(":/useragentlist.txt");
- if (file.open(QIODevice::ReadOnly)) {
- while (!file.atEnd())
- items << file.readLine().trimmed();
- file.close();
- }
-
- QSettings settings;
- QString customUserAgent = settings.value("CustomUserAgent").toString();
- if (!items.contains(customUserAgent) && !customUserAgent.isEmpty())
- items << customUserAgent;
-
- QDialog* dialog = new QDialog(this);
- dialog->resize(size().width() * 0.7, dialog->size().height());
- dialog->setMaximumHeight(dialog->size().height());
- dialog->setWindowTitle("Change User Agent");
-
- QVBoxLayout* layout = new QVBoxLayout(dialog);
- dialog->setLayout(layout);
-
- QComboBox* combo = new QComboBox(dialog);
- combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
- combo->setEditable(true);
- combo->insertItems(0, items);
- layout->addWidget(combo);
-
- int index = combo->findText(page()->userAgentForUrl(QUrl()));
- combo->setCurrentIndex(index);
-
- QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
- | QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
- connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
- layout->addWidget(buttonBox);
-
- if (dialog->exec() && !combo->currentText().isEmpty()) {
- page()->setUserAgent(combo->currentText());
- if (!items.contains(combo->currentText()))
- settings.setValue("CustomUserAgent", combo->currentText());
- }
-
- delete dialog;
-}
-
-LauncherWindow* LauncherWindow::newWindow()
-{
- LauncherWindow* mw = new LauncherWindow(this, false);
- mw->show();
- return mw;
-}
-
-LauncherWindow* LauncherWindow::cloneWindow()
-{
- LauncherWindow* mw = new LauncherWindow(this, true);
- mw->show();
- return mw;
-}
-
-void LauncherWindow::updateFPS(int fps)
-{
- QString fpsStatusText = QString("Current FPS: %1").arg(fps);
-
-#if defined(Q_WS_MAEMO_5) && defined(Q_WS_S60)
- setWindowTitle(fpsStatusText);
-#else
- statusBar()->showMessage(fpsStatusText);
-#endif
-}
-
-void LauncherWindow::createChrome()
-{
- QMenu* fileMenu = menuBar()->addMenu("&File");
- fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
- fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open);
- fileMenu->addAction(tr("Open Location..."), this, SLOT(openLocation()), QKeySequence(Qt::CTRL | Qt::Key_L));
- fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close);
- fileMenu->addSeparator();
- fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot()));
- fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print);
- fileMenu->addSeparator();
- fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q));
-
- QMenu* editMenu = menuBar()->addMenu("&Edit");
- editMenu->addAction(page()->action(QWebPage::Undo));
- editMenu->addAction(page()->action(QWebPage::Redo));
- editMenu->addSeparator();
- editMenu->addAction(page()->action(QWebPage::Cut));
- editMenu->addAction(page()->action(QWebPage::Copy));
- editMenu->addAction(page()->action(QWebPage::Paste));
- editMenu->addSeparator();
- QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool)));
- setEditable->setCheckable(true);
-
- QMenu* viewMenu = menuBar()->addMenu("&View");
- viewMenu->addAction(page()->action(QWebPage::Stop));
- viewMenu->addAction(page()->action(QWebPage::Reload));
- viewMenu->addSeparator();
- QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn()));
- QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut()));
- QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom()));
- QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool)));
- zoomTextOnly->setCheckable(true);
- zoomTextOnly->setChecked(false);
- viewMenu->addSeparator();
- viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml()));
- // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins()));
-
- QMenu* formatMenu = new QMenu("F&ormat", this);
- m_formatMenuAction = menuBar()->addMenu(formatMenu);
- m_formatMenuAction->setVisible(false);
- formatMenu->addAction(page()->action(QWebPage::ToggleBold));
- formatMenu->addAction(page()->action(QWebPage::ToggleItalic));
- formatMenu->addAction(page()->action(QWebPage::ToggleUnderline));
- QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction"));
- writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault));
- writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight));
- writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft));
-
- zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus));
- zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
- resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
-
- QMenu* windowMenu = menuBar()->addMenu("&Window");
- QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool)));
- toggleFullScreen->setCheckable(true);
- toggleFullScreen->setChecked(false);
-
- // when exit fullscreen mode by clicking on the exit area (bottom right corner) we must
- // uncheck the Toggle FullScreen action
- toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool)));
-
- QMenu* toolsMenu = menuBar()->addMenu("&Develop");
-
- QWebSettings* settings = page()->settings();
-
- QMenu* graphicsViewMenu = toolsMenu->addMenu("QGraphicsView");
- QAction* toggleGraphicsView = graphicsViewMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool)));
- toggleGraphicsView->setCheckable(true);
- toggleGraphicsView->setChecked(isGraphicsBased());
-
- QAction* toggleWebGL = toolsMenu->addAction("Toggle WebGL", this, SLOT(toggleWebGL(bool)));
- toggleWebGL->setCheckable(true);
- toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled));
-
- QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool)));
- spatialNavigationAction->setCheckable(true);
- spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S));
-
- QAction* toggleFrameFlattening = toolsMenu->addAction("Toggle Frame Flattening", this, SLOT(toggleFrameFlattening(bool)));
- toggleFrameFlattening->setCheckable(true);
- toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled));
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool)));
- touchMockAction->setCheckable(true);
- touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
-#endif
-
- toolsMenu->addSeparator();
-
- QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
- toggleInterruptingJavaScripteEnabled->setCheckable(true);
- toggleInterruptingJavaScripteEnabled->setChecked(false);
-
- QAction* toggleJavascriptCanOpenWindows = toolsMenu->addAction("Enable js popup windows", this, SLOT(toggleJavascriptCanOpenWindows(bool)));
- toggleJavascriptCanOpenWindows->setCheckable(true);
- toggleJavascriptCanOpenWindows->setChecked(false);
-
- toolsMenu->addSeparator();
-
- QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
- userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U));
-
- toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
-
- QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));
- showInspectorAction->setCheckable(true);
- showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool)));
-
- // GraphicsView sub menu.
- QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool)));
- toggleAcceleratedCompositing->setCheckable(true);
- toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled));
- toggleAcceleratedCompositing->setEnabled(isGraphicsBased());
- toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
-
- QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool)));
- toggleResizesToContents->setCheckable(true);
- toggleResizesToContents->setChecked(false);
- toggleResizesToContents->setEnabled(isGraphicsBased());
- toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
-
- QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool)));
- toggleTiledBackingStore->setCheckable(true);
- toggleTiledBackingStore->setChecked(false);
- toggleTiledBackingStore->setEnabled(isGraphicsBased());
- toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
-
-#if defined(QT_CONFIGURED_WITH_OPENGL)
- QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool)));
- toggleQGLWidgetViewport->setCheckable(true);
- toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport);
- toggleQGLWidgetViewport->setEnabled(isGraphicsBased());
- toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
-#endif
-
- QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode");
- viewportUpdateMenu->setEnabled(isGraphicsBased());
- viewportUpdateMenu->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
-
- QAction* fullUpdate = viewportUpdateMenu->addAction("FullViewportUpdate");
- fullUpdate->setCheckable(true);
- fullUpdate->setChecked((gViewportUpdateMode == QGraphicsView::FullViewportUpdate) ? true : false);
-
- QAction* minimalUpdate = viewportUpdateMenu->addAction("MinimalViewportUpdate");
- minimalUpdate->setCheckable(true);
- minimalUpdate->setChecked((gViewportUpdateMode == QGraphicsView::MinimalViewportUpdate) ? true : false);
-
- QAction* smartUpdate = viewportUpdateMenu->addAction("SmartViewportUpdate");
- smartUpdate->setCheckable(true);
- smartUpdate->setChecked((gViewportUpdateMode == QGraphicsView::SmartViewportUpdate) ? true : false);
-
- QAction* boundingRectUpdate = viewportUpdateMenu->addAction("BoundingRectViewportUpdate");
- boundingRectUpdate->setCheckable(true);
- boundingRectUpdate->setChecked((gViewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) ? true : false);
-
- QAction* noUpdate = viewportUpdateMenu->addAction("NoViewportUpdate");
- noUpdate->setCheckable(true);
- noUpdate->setChecked((gViewportUpdateMode == QGraphicsView::NoViewportUpdate) ? true : false);
-
- QSignalMapper* signalMapper = new QSignalMapper(viewportUpdateMenu);
- signalMapper->setMapping(fullUpdate, QGraphicsView::FullViewportUpdate);
- signalMapper->setMapping(minimalUpdate, QGraphicsView::MinimalViewportUpdate);
- signalMapper->setMapping(smartUpdate, QGraphicsView::SmartViewportUpdate);
- signalMapper->setMapping(boundingRectUpdate, QGraphicsView::BoundingRectViewportUpdate);
- signalMapper->setMapping(noUpdate, QGraphicsView::NoViewportUpdate);
-
- connect(fullUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
- connect(minimalUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
- connect(smartUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
- connect(boundingRectUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
- connect(noUpdate, SIGNAL(triggered()), signalMapper, SLOT(map()));
-
- connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(changeViewportUpdateMode(int)));
-
- QActionGroup* viewportUpdateModeActions = new QActionGroup(viewportUpdateMenu);
- viewportUpdateModeActions->addAction(fullUpdate);
- viewportUpdateModeActions->addAction(minimalUpdate);
- viewportUpdateModeActions->addAction(smartUpdate);
- viewportUpdateModeActions->addAction(boundingRectUpdate);
- viewportUpdateModeActions->addAction(noUpdate);
-
- graphicsViewMenu->addSeparator();
-
- m_flipAnimated = graphicsViewMenu->addAction("Animated Flip");
- m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
- m_flipAnimated->setEnabled(isGraphicsBased());
-
- m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip");
- m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
- m_flipYAnimated->setEnabled(isGraphicsBased());
-
- if (isGraphicsBased()) {
- WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view);
- connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));
- connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));
- }
-
- QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow()));
- cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
- cloneWindow->setEnabled(isGraphicsBased());
-
- graphicsViewMenu->addSeparator();
-
- QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool)));
- showFPS->setCheckable(true);
- showFPS->setEnabled(isGraphicsBased());
- showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
- showFPS->setChecked(gShowFrameRate);
-}
-
-QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
-{
- LauncherWindow* mw = new LauncherWindow;
- if (type == WebModalDialog)
- mw->setWindowModality(Qt::ApplicationModal);
- mw->show();
- return mw->page();
-}
-
-QObject* WebPage::createPlugin(const QString &classId, const QUrl&, const QStringList&, const QStringList&)
-{
- if (classId == "alien_QLabel") {
- QLabel* l = new QLabel;
- l->winId();
- return l;
- }
-
-#ifndef QT_NO_UITOOLS
- QUiLoader loader;
- return loader.createWidget(classId, view());
-#else
- Q_UNUSED(classId);
- return 0;
-#endif
-}
-
int launcherMain(const QApplication& app)
{
@@ -1092,7 +89,7 @@ LauncherApplication::LauncherApplication(int& argc, char** argv)
static void requiresGraphicsView(const QString& option)
{
- if (gUseGraphicsView)
+ if (LauncherWindow::gUseGraphicsView)
return;
appQuit(1, QString("%1 only works in combination with the -graphicsbased option").arg(option));
}
@@ -1124,31 +121,31 @@ void LauncherApplication::handleUserOptions()
}
if (args.contains("-graphicsbased"))
- gUseGraphicsView = true;
+ LauncherWindow::gUseGraphicsView = true;
if (args.contains("-no-compositing")) {
requiresGraphicsView("-no-compositing");
- gUseCompositing = false;
+ LauncherWindow::gUseCompositing = false;
}
if (args.contains("-show-fps")) {
requiresGraphicsView("-show-fps");
- gShowFrameRate = true;
+ LauncherWindow::gShowFrameRate = true;
}
if (args.contains("-cache-webview")) {
requiresGraphicsView("-cache-webview");
- gCacheWebView = true;
+ LauncherWindow::gCacheWebView = true;
}
if (args.contains("-tiled-backing-store")) {
requiresGraphicsView("-tiled-backing-store");
- gUseTiledBackingStore = true;
+ LauncherWindow::gUseTiledBackingStore = true;
}
if (args.contains("-resizes-to-contents")) {
requiresGraphicsView("-resizes-to-contents");
- gResizesToContents = true;
+ LauncherWindow::gResizesToContents = true;
}
QString arg1("-viewport-update-mode");
@@ -1163,13 +160,13 @@ void LauncherApplication::handleUserOptions()
if (idx == -1)
appQuit(1, QString("%1 value has to be one of [%2]").arg(arg1).arg(formatKeys(updateModes)));
- gViewportUpdateMode = static_cast<QGraphicsView::ViewportUpdateMode>(idx);
+ LauncherWindow::gViewportUpdateMode = static_cast<QGraphicsView::ViewportUpdateMode>(idx);
}
QString inspectorUrlArg("-inspector-url");
int inspectorUrlIndex = args.indexOf(inspectorUrlArg);
if (inspectorUrlIndex != -1)
- gInspectorUrl = takeOptionValue(&args, inspectorUrlIndex);
+ LauncherWindow::gInspectorUrl = takeOptionValue(&args, inspectorUrlIndex);
int robotIndex = args.indexOf("-r");
if (robotIndex != -1) {
diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp
index ee0232b..137c65c 100644
--- a/WebKitTools/QtTestBrowser/webpage.cpp
+++ b/WebKitTools/QtTestBrowser/webpage.cpp
@@ -32,6 +32,8 @@
#include "webpage.h"
+#include "launcherwindow.h"
+
#include <QAuthenticator>
#include <QDesktopServices>
#include <QtGui>
@@ -185,3 +187,30 @@ void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domai
void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)
{
}
+
+QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
+{
+ LauncherWindow* mw = new LauncherWindow;
+ if (type == WebModalDialog)
+ mw->setWindowModality(Qt::ApplicationModal);
+ mw->show();
+ return mw->page();
+}
+
+QObject* WebPage::createPlugin(const QString &classId, const QUrl&, const QStringList&, const QStringList&)
+{
+ if (classId == "alien_QLabel") {
+ QLabel* l = new QLabel;
+ l->winId();
+ return l;
+ }
+
+#ifndef QT_NO_UITOOLS
+ QUiLoader loader;
+ return loader.createWidget(classId, view());
+#else
+ Q_UNUSED(classId);
+ return 0;
+#endif
+}
+
diff --git a/WebKitTools/QtTestBrowser/webview.h b/WebKitTools/QtTestBrowser/webview.h
index 30161bb..9b533b3 100644
--- a/WebKitTools/QtTestBrowser/webview.h
+++ b/WebKitTools/QtTestBrowser/webview.h
@@ -82,6 +82,7 @@ public:
virtual void paintEvent(QPaintEvent* event);
void setResizesToContents(bool b);
+ bool resizesToContents() const { return m_resizesToContents; }
void setYRotation(qreal angle)
{
diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit
index 21214cc..4639949 100755
--- a/WebKitTools/Scripts/build-webkit
+++ b/WebKitTools/Scripts/build-webkit
@@ -61,7 +61,7 @@ my ($linkPrefetchSupport, $threeDCanvasSupport, $threeDRenderingSupport, $channe
$svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport,
$svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $webTimingSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport,
$xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport,
- $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport);
+ $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport, $deviceOrientationSupport);
my @features = (
{ option => "link-prefetch", desc => "Toggle pre fetching support",
@@ -204,6 +204,9 @@ my @features = (
{ option => "file-system", desc => "Toggle FileSystem support",
define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport },
+
+ { option => "device-orientation", desc => "Toggle DeviceOrientation support",
+ define => "ENABLE_DEVICE_ORIENTATION", default => 0, value => \$deviceOrientationSupport },
);
# Update defaults from Qt's project file
diff --git a/WebKitTools/Scripts/find-included-framework-headers b/WebKitTools/Scripts/find-included-framework-headers
index 3e7aaf6..759a60b 100755
--- a/WebKitTools/Scripts/find-included-framework-headers
+++ b/WebKitTools/Scripts/find-included-framework-headers
@@ -1,10 +1,30 @@
#!/bin/sh
-
-FILE_EXTENSIONS_TO_SEARCH="cpp h m mm"
+# Copyright (C) 2007, 2008, 2009, 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.
+#
+# A script to find headers included from the given frameworks by files in the
+# current directory (and subdirectories).
for framework in $*; do
echo -e "\n$framework\n=================="
- for ext in ${FILE_EXTENSIONS_TO_SEARCH}; do
- find . -name "*.$ext" -exec grep $framework {} ';' | grep '\(include\|import\)' | sed -e 's|.*/\(.*\.h\).*|\1|'
- done | sort | uniq
+ find . \( -name '*.cpp' -o -name '*.h' -o -name '*.m' -o -name '*.mm' \) -exec grep "<$framework/" {} ';' | sed -e 's|.*/\(.*\.h\).*|\1|' | sort -u
done
diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests
index af82545..b46c129 100755
--- a/WebKitTools/Scripts/old-run-webkit-tests
+++ b/WebKitTools/Scripts/old-run-webkit-tests
@@ -298,7 +298,7 @@ Usage: $programName [options] [testdir|testpath ...]
-v|--verbose More verbose output (overrides --quiet)
-m|--merge-leak-depth arg Merges leak callStacks and prints the number of unique leaks beneath a callstack depth of arg. Defaults to 5.
--use-remote-links-to-tests Link to test files within the SVN repository in the results.
- --webkit-test-runner Use WebKitTestRunner rather than DumpRenderTree.
+ -2|--webkit-test-runner Use WebKitTestRunner rather than DumpRenderTree.
EOF
setConfiguration();
@@ -342,7 +342,7 @@ my $getOptionsResult = GetOptions(
'use-remote-links-to-tests' => \$useRemoteLinksToTests,
'valgrind' => \$useValgrind,
'verbose|v' => \$verbose,
- 'webkit-test-runner' => \$useWebKitTestRunner,
+ 'webkit-test-runner|2' => \$useWebKitTestRunner,
);
if (!$getOptionsResult || $showHelp) {
@@ -354,6 +354,9 @@ if ($useWebKitTestRunner) {
if (isAppleMacWebKit()) {
$realPlatform = $platform;
$platform = "mac-wk2";
+ } elsif (isAppleWinWebKit()) {
+ $realPlatform = $platform;
+ $platform = "win-wk2";
}
}
@@ -1895,8 +1898,8 @@ sub buildPlatformResultHierarchy()
my $isWin = $platform =~ /^win/;
if ($isMac || $isWin) {
my $effectivePlatform = $platform;
- if ($platform eq "mac-wk2") {
- push @platforms, "mac-wk2";
+ if ($platform eq "mac-wk2" || $platform eq "win-wk2") {
+ push @platforms, $platform;
$effectivePlatform = $realPlatform;
}
diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm
index 745e808..028d63d 100644
--- a/WebKitTools/Scripts/webkitdirs.pm
+++ b/WebKitTools/Scripts/webkitdirs.pm
@@ -1418,6 +1418,8 @@ sub buildQMakeProject($@)
print "Generating derived sources\n\n";
+ push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
+
my @dsQmakeArgs = @buildArgs;
push @dsQmakeArgs, "-r";
push @dsQmakeArgs, sourceDir() . "/DerivedSources.pro";
@@ -1431,7 +1433,12 @@ sub buildQMakeProject($@)
my $dsMakefile = "Makefile.DerivedSources";
# Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60
- for my $subdir ("JavaScriptCore", "WebCore", "WebKit/qt/Api") {
+ my @subdirs = ("JavaScriptCore", "WebCore", "WebKit/qt/Api");
+ if (grep { $_ eq "CONFIG+=webkit2"} @buildArgs) {
+ push @subdirs, "WebKit2";
+ }
+
+ for my $subdir (@subdirs) {
print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/$subdir\n\n";
if ($make eq "nmake") {
my $subdirWindows = $subdir;
@@ -1445,7 +1452,6 @@ sub buildQMakeProject($@)
}
}
- push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
push @buildArgs, sourceDir() . "/WebKit.pro";
if ($config =~ m/debug/i) {
push @buildArgs, "CONFIG-=release";
diff --git a/WebKitTools/Scripts/webkitpy/common/config/committers.py b/WebKitTools/Scripts/webkitpy/common/config/committers.py
index 0354981..25b1725 100644
--- a/WebKitTools/Scripts/webkitpy/common/config/committers.py
+++ b/WebKitTools/Scripts/webkitpy/common/config/committers.py
@@ -153,6 +153,7 @@ committers_unable_to_review = [
Committer("Mikhail Naganov", "mnaganov@chromium.org"),
Committer("MORITA Hajime", "morrita@google.com", "morrita"),
Committer("Nico Weber", ["thakis@chromium.org", "thakis@google.com"], "thakis"),
+ Committer("Noam Rosenthal", "noam.rosenthal@nokia.com", "noamr"),
Committer("Pam Greene", "pam@chromium.org", "pamg"),
Committer("Peter Kasting", ["pkasting@google.com", "pkasting@chromium.org"], "pkasting"),
Committer("Philippe Normand", ["pnormand@igalia.com", "philn@webkit.org"], "philn-tp"),
@@ -163,7 +164,6 @@ committers_unable_to_review = [
Committer("Ryosuke Niwa", "rniwa@webkit.org", "rniwa"),
Committer("Scott Violet", "sky@chromium.org", "sky"),
Committer("Stephen White", "senorblanco@chromium.org", "senorblanco"),
- Committer("Tony Chang", "tony@chromium.org", "tony^work"),
Committer("Tony Gentilcore", "tonyg@chromium.org", "tonyg-cr"),
Committer("Trey Matteson", "trey@usa.net", "trey"),
Committer("Tristan O'Tierney", ["tristan@otierney.net", "tristan@apple.com"]),
@@ -259,6 +259,7 @@ reviewers_list = [
Reviewer("Steve Falkenburg", "sfalken@apple.com", "sfalken"),
Reviewer("Tim Omernick", "timo@apple.com"),
Reviewer("Timothy Hatcher", ["timothy@hatcher.name", "timothy@apple.com"], "xenon"),
+ Reviewer("Tony Chang", "tony@chromium.org", "tony^work"),
Reviewer(u"Tor Arne Vestb\u00f8", ["vestbo@webkit.org", "tor.arne.vestbo@nokia.com"], "torarne"),
Reviewer("Vicki Murley", "vicki@apple.com"),
Reviewer("Xan Lopez", ["xan.lopez@gmail.com", "xan@gnome.org", "xan@webkit.org"], "xan"),
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index f8b181c..6cfc0b8 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -47,8 +47,8 @@ import http_server
from webkitpy.common.system.executive import Executive
-# Chromium DRT on non-Windows uses WebKitDriver.
-if sys.platform not in ('win32', 'cygwin'):
+# Chromium DRT on OSX uses WebKitDriver.
+if sys.platform == 'darwin':
import webkit
import websocket_server
@@ -172,7 +172,7 @@ class ChromiumPort(base.Port):
def create_driver(self, image_path, options):
"""Starts a new Driver and returns a handle to it."""
- if self._options.use_drt and sys.platform not in ('win32', 'cygwin'):
+ if self._options.use_drt and sys.platform == 'darwin':
return webkit.WebKitDriver(self, image_path, options, executive=self._executive)
if self._options.use_drt:
options += ['--test-shell']
diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
index 770ab40..9e4240c 100644
--- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
+++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
@@ -2512,6 +2512,9 @@ def check_identifier_name_in_declaration(filename, line_number, line, error):
if (not (filename.find('JavaScriptCore') >= 0 and modified_identifier.find('_op_') >= 0)
and not modified_identifier.startswith('tst_')
and not modified_identifier.startswith('webkit_dom_object_')
+ and not modified_identifier.startswith('NPN_')
+ and not modified_identifier.startswith('NPP_')
+ and not modified_identifier.startswith('NP_')
and not modified_identifier.startswith('qt_')
and not modified_identifier.find('::qt_') >= 0
and not modified_identifier == "const_iterator"):
diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index ee829aa..c927db6 100644
--- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -3703,6 +3703,11 @@ class WebKitStyleTest(CppStyleTestBase):
self.assert_lint('void QTFrame::qt_drt_is_awesome(int var1, int var2)', '')
self.assert_lint('void qt_drt_is_awesome(int var1, int var2);', '')
+ # NPAPI functions that start with NPN_, NPP_ or NP_ are allowed.
+ self.assert_lint('void NPN_Status(NPP, const char*)', '')
+ self.assert_lint('NPError NPP_SetWindow(NPP instance, NPWindow *window)', '')
+ self.assert_lint('NPObject* NP_Allocate(NPP, NPClass*)', '')
+
# const_iterator is allowed as well.
self.assert_lint('typedef VectorType::const_iterator const_iterator;', '')
diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py
index 1cb554a..704970d 100644
--- a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py
+++ b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py
@@ -88,15 +88,13 @@ installer.install(url="http://webkit-rietveld.googlecode.com/svn/trunk/static/up
# organization purposes.
irc_dir = os.path.join(autoinstalled_dir, "irc")
installer = AutoInstaller(target_dir=irc_dir)
-installer.install(url="http://surfnet.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip",
- url_subpath="irclib.py")
-installer.install(url="http://surfnet.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip",
- url_subpath="ircbot.py")
+installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="irclib.py")
+installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="ircbot.py")
pywebsocket_dir = os.path.join(autoinstalled_dir, "pywebsocket")
installer = AutoInstaller(target_dir=pywebsocket_dir)
-installer.install(url="http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.5.1.tar.gz",
- url_subpath="pywebsocket-0.5.1/src/mod_pywebsocket")
+installer.install(url="http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.5.2.tar.gz",
+ url_subpath="pywebsocket-0.5.2/src/mod_pywebsocket")
readme_path = os.path.join(autoinstalled_dir, "README")
if not os.path.exists(readme_path):
diff --git a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops
index 20a4852..e90ddb1 100644
--- a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops
+++ b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundleCommon.vsprops
@@ -6,7 +6,7 @@
>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\..&quot;;&quot;$(ProjectDir)\..\Bindings&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitOutputDir)\obj\InjectedBundle\DerivedSources\&quot;"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\InjectedBundle\&quot;;&quot;$(ProjectDir)\..\InjectedBundle\Bindings&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitOutputDir)\obj\InjectedBundle\DerivedSources\&quot;"
ForcedIncludeFiles="WebKitTestRunnerPrefix.h"
/>
<Tool
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index a0fbb85..2eca583 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -41,6 +41,9 @@ module WTR {
// Special options.
void keepWebHistory();
void setAcceptsEditing(in boolean value);
+ void setCanOpenWindows(in boolean value);
+ void setCloseRemainingWindowsWhenComplete(in boolean value);
+ unsigned long windowCount();
// Special DOM functions.
object computedStyleIncludingVisitedInfo(in object element);
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 0e99dde..095bd9c 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -27,13 +27,16 @@
#include "ActivateFonts.h"
#include "InjectedBundlePage.h"
-#include <WebKit2/WebKit2.h>
#include <WebKit2/WKBundle.h>
#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKBundlePrivate.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKStringCF.h>
+#include <WebKit2/WebKit2.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
namespace WTR {
@@ -45,6 +48,7 @@ InjectedBundle& InjectedBundle::shared()
InjectedBundle::InjectedBundle()
: m_bundle(0)
+ , m_mainPage(0)
{
}
@@ -58,9 +62,9 @@ void InjectedBundle::_willDestroyPage(WKBundleRef bundle, WKBundlePageRef page,
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page);
}
-void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo)
+void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
- static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(message);
+ static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody);
}
void InjectedBundle::initialize(WKBundleRef bundle)
@@ -81,37 +85,48 @@ void InjectedBundle::initialize(WKBundleRef bundle)
void InjectedBundle::done()
{
+ WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Done")));
+
std::string output = m_outputStream.str();
RetainPtr<CFStringRef> outputCFString(AdoptCF, CFStringCreateWithCString(0, output.c_str(), kCFStringEncodingUTF8));
- WKRetainPtr<WKStringRef> doneMessage(AdoptWK, WKStringCreateWithCFString(outputCFString.get()));
- WKBundlePostMessage(m_bundle, doneMessage.get());
+ WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithCFString(outputCFString.get()));
+
+ WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
}
void InjectedBundle::didCreatePage(WKBundlePageRef page)
{
// FIXME: we really need the main page ref to be sent over from the ui process
- m_mainPage = new InjectedBundlePage(page);
- m_pages.add(page, m_mainPage);
+ OwnPtr<InjectedBundlePage> pageWrapper = adoptPtr(new InjectedBundlePage(page));
+ if (!m_mainPage)
+ m_mainPage = pageWrapper.release();
+ else
+ m_otherPages.add(page, pageWrapper.leakPtr());
}
void InjectedBundle::willDestroyPage(WKBundlePageRef page)
{
- delete m_pages.take(page);
+ if (m_mainPage && m_mainPage->page() == page)
+ m_mainPage.clear();
+ else
+ delete m_otherPages.take(page);
}
-void InjectedBundle::didReceiveMessage(WKStringRef message)
+void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
+ CFStringRef cfMessage = WKStringCopyCFString(0, messageName);
if (CFEqual(cfMessage, CFSTR("BeginTest"))) {
- WKRetainPtr<WKStringRef> ackMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTestAck")));
- WKBundlePostMessage(m_bundle, ackMessage.get());
+ WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Ack")));
+ WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
+ WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
reset();
return;
}
- WKRetainPtr<WKStringRef> errorMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("Error: Unknown.")));
- WKBundlePostMessage(m_bundle, errorMessage.get());
+ WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithCFString(CFSTR("Error")));
+ WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("Unknown")));
+ WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
}
void InjectedBundle::reset()
@@ -120,6 +135,7 @@ void InjectedBundle::reset()
m_layoutTestController = LayoutTestController::create();
WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
WKBundleRemoveAllVisitedLinks(m_bundle);
+ m_mainPage->reset();
}
void InjectedBundle::setShouldTrackVisitedLinks()
@@ -127,4 +143,12 @@ void InjectedBundle::setShouldTrackVisitedLinks()
WKBundleSetShouldTrackVisitedLinks(m_bundle, true);
}
+void InjectedBundle::closeOtherPages()
+{
+ Vector<WKBundlePageRef> pages;
+ copyKeysToVector(m_otherPages, pages);
+ for (size_t i = 0; i < pages.size(); ++i)
+ WKBundlePageClose(pages[i]);
+}
+
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 9bda922..42eb3a1 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -30,6 +30,7 @@
#include <WebKit2/WKBase.h>
#include <WebKit2/WKBundleBase.h>
#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
#include <sstream>
@@ -48,7 +49,9 @@ public:
void done();
LayoutTestController* layoutTestController() { return m_layoutTestController.get(); }
- InjectedBundlePage* page() { return m_mainPage; }
+ InjectedBundlePage* page() { return m_mainPage.get(); }
+ size_t pageCount() { return !!m_mainPage + m_otherPages.size(); }
+ void closeOtherPages();
std::ostringstream& os() { return m_outputStream; }
@@ -60,17 +63,17 @@ private:
static void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
static void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
- static void _didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo);
+ static void _didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
void didCreatePage(WKBundlePageRef page);
void willDestroyPage(WKBundlePageRef page);
- void didReceiveMessage(WKStringRef message);
+ void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody);
void reset();
WKBundleRef m_bundle;
- HashMap<WKBundlePageRef, InjectedBundlePage*> m_pages;
- InjectedBundlePage* m_mainPage;
+ HashMap<WKBundlePageRef, InjectedBundlePage*> m_otherPages;
+ OwnPtr<InjectedBundlePage> m_mainPage;
RefPtr<LayoutTestController> m_layoutTestController;
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 3632fb9..406787e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -29,6 +29,7 @@
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebKit2/WKArray.h>
#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundleNode.h>
#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKRetainPtr.h>
@@ -72,21 +73,6 @@ static ostream& operator<<(ostream& out, const WKRetainPtr<WKStringRef>& stringR
return out << stringRef.get();
}
-static ostream& operator<<(ostream& out, JSStringRef stringRef)
-{
- if (!stringRef)
- return out;
- CFIndex bufferLength = JSStringGetMaximumUTF8CStringSize(stringRef) + 1;
- Vector<char> buffer(bufferLength);
- JSStringGetUTF8CString(stringRef, buffer.data(), bufferLength);
- return out << buffer.data();
-}
-
-static ostream& operator<<(ostream& out, const JSRetainPtr<JSStringRef>& stringRef)
-{
- return out << stringRef.get();
-}
-
static string dumpPath(WKBundleNodeRef node)
{
if (!node)
@@ -169,6 +155,11 @@ InjectedBundlePage::~InjectedBundlePage()
{
}
+void InjectedBundlePage::reset()
+{
+ WKBundlePageClearMainFrameName(m_page);
+}
+
// Loader Client Callbacks
void InjectedBundlePage::_didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo)
@@ -238,23 +229,6 @@ static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const
return JSObjectGetProperty(context, object, propertyNameString.get(), &exception);
}
-static JSObjectRef propertyObject(JSContextRef context, JSObjectRef object, const char* propertyName)
-{
- JSValueRef value = propertyValue(context, object, propertyName);
- if (!value || !JSValueIsObject(context, value))
- return 0;
- return const_cast<JSObjectRef>(value);
-}
-
-static JSRetainPtr<JSStringRef> propertyString(JSContextRef context, JSObjectRef object, const char* propertyName)
-{
- JSValueRef value = propertyValue(context, object, propertyName);
- if (!value)
- return 0;
- JSValueRef exception;
- return JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, value, &exception));
-}
-
static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
{
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
@@ -285,8 +259,7 @@ static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame)
WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame));
size_t size = WKArrayGetSize(childFrames.get());
for (size_t i = 0; i < size; ++i) {
- // FIXME: I don't like that we have to const_cast here. Can we change WKArray?
- WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i)));
+ WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i));
dumpFrameScrollPosition(subframe, ShouldIncludeFrameName);
dumpDescendantFrameScrollPositions(subframe);
}
@@ -301,10 +274,8 @@ void InjectedBundlePage::dumpAllFrameScrollPositions()
static void dumpFrameText(WKBundleFrameRef frame)
{
- JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
- JSObjectRef document = propertyObject(context, JSContextGetGlobalObject(context), "document");
- JSObjectRef documentElement = propertyObject(context, document, "documentElement");
- InjectedBundle::shared().os() << propertyString(context, documentElement, "innerText") << "\n";
+ WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame));
+ InjectedBundle::shared().os() << text << "\n";
}
static void dumpDescendantFramesText(WKBundleFrameRef frame)
@@ -312,8 +283,7 @@ static void dumpDescendantFramesText(WKBundleFrameRef frame)
WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame));
size_t size = WKArrayGetSize(childFrames.get());
for (size_t i = 0; i < size; ++i) {
- // FIXME: I don't like that we have to const_cast here. Can we change WKArray?
- WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i)));
+ WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i));
WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe));
InjectedBundle::shared().os() << "\n--------\nFrame: '" << subframeName << "'\n--------\n";
dumpFrameText(subframe);
@@ -361,6 +331,9 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
m_isLoading = false;
+ if (this != InjectedBundle::shared().page())
+ return;
+
if (InjectedBundle::shared().layoutTestController()->waitToDump())
return;
@@ -374,6 +347,9 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame)
m_isLoading = false;
+ if (this != InjectedBundle::shared().page())
+ return;
+
InjectedBundle::shared().done();
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index 1b67af0..f7d64f9 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -40,6 +40,8 @@ public:
bool isLoading() { return m_isLoading; }
+ void reset();
+
private:
// Loader Client
static void _didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo);
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 2f59eb1..8fda21e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -116,6 +116,7 @@ LayoutTestController::LayoutTestController()
: m_whatToDump(RenderTree)
, m_shouldDumpAllFrameScrollPositions(false)
, m_shouldAllowEditing(true)
+ , m_shouldCloseExtraWindows(false)
, m_dumpEditingCallbacks(false)
, m_dumpStatusCallbacks(false)
, m_waitToDump(false)
@@ -242,6 +243,17 @@ bool LayoutTestController::isCommandEnabled(JSStringRef name)
return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());
}
+void LayoutTestController::setCanOpenWindows(bool)
+{
+ // It's not clear if or why any tests require opening windows be forbidden.
+ // For now, just ignore this setting, and if we find later it's needed we can add it.
+}
+
+unsigned LayoutTestController::windowCount()
+{
+ return InjectedBundle::shared().pageCount();
+}
+
// Object Creation
void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 9f0641b..75aeb9e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -60,6 +60,9 @@ public:
// Special options.
void keepWebHistory();
void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
+ void setCanOpenWindows(bool);
+ void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
+ unsigned windowCount();
// Special DOM functions.
JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element);
@@ -92,12 +95,17 @@ public:
bool shouldAllowEditing() const { return m_shouldAllowEditing; }
+ bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
+
private:
LayoutTestController();
WhatToDump m_whatToDump;
bool m_shouldDumpAllFrameScrollPositions;
+
bool m_shouldAllowEditing;
+ bool m_shouldCloseExtraWindows;
+
bool m_dumpEditingCallbacks;
bool m_dumpStatusCallbacks;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 4f8cd6b..93857a7 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -28,21 +28,62 @@
#include "PlatformWebView.h"
#include "TestInvocation.h"
#include <WebKit2/WKContextPrivate.h>
+#include <wtf/PassOwnPtr.h>
namespace WTR {
+static TestController* controller;
+
TestController& TestController::shared()
{
- static TestController& shared = *new TestController;
- return shared;
+ ASSERT(controller);
+ return *controller;
}
-TestController::TestController()
+TestController::TestController(int argc, const char* argv[])
: m_dumpPixels(false)
, m_verbose(false)
, m_printSeparators(false)
, m_usingServerMode(false)
{
+ initialize(argc, argv);
+ controller = this;
+ run();
+ controller = 0;
+}
+
+TestController::~TestController()
+{
+}
+
+static void closeOtherPage(WKPageRef page, const void* clientInfo)
+{
+ WKPageClose(page);
+ const PlatformWebView* view = static_cast<const PlatformWebView*>(clientInfo);
+ delete view;
+}
+
+static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
+{
+ PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage));
+ WKPageRef newPage = view->page();
+
+ view->resizeTo(800, 600);
+
+ WKPageUIClient otherPageUIClient = {
+ 0,
+ view,
+ createOtherPage,
+ 0,
+ closeOtherPage,
+ 0,
+ 0,
+ 0
+ };
+ WKPageSetPageUIClient(newPage, &otherPageUIClient);
+
+ WKRetain(newPage);
+ return newPage;
}
void TestController::initialize(int argc, const char* argv[])
@@ -75,21 +116,33 @@ void TestController::initialize(int argc, const char* argv[])
m_printSeparators = m_paths.size() > 1;
initializeInjectedBundlePath();
- initializeTestPluginPath();
+ initializeTestPluginDirectory();
m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath()));
- WKContextInjectedBundleClient injectedBundlePathClient = {
+ WKContextInjectedBundleClient injectedBundleClient = {
0,
this,
- _didReceiveMessageFromInjectedBundle
+ didReceiveMessageFromInjectedBundle
};
- WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient);
+ WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
- _WKContextSetAdditionalPluginPath(m_context.get(), testPluginPath());
+ _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get()));
- m_mainWebView = new PlatformWebView(m_pageNamespace.get());
+ m_mainWebView = adoptPtr(new PlatformWebView(m_pageNamespace.get()));
+
+ WKPageUIClient pageUIClient = {
+ 0,
+ this,
+ createOtherPage,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+ WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
}
void TestController::runTest(const char* test)
@@ -114,7 +167,7 @@ void TestController::runTestingServerLoop()
}
}
-bool TestController::run()
+void TestController::run()
{
if (m_usingServerMode)
runTestingServerLoop();
@@ -122,18 +175,16 @@ bool TestController::run()
for (size_t i = 0; i < m_paths.size(); ++i)
runTest(m_paths[i].c_str());
}
-
- return true;
}
-void TestController::_didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo)
+void TestController::didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
- static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(message);
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
-void TestController::didReceiveMessageFromInjectedBundle(WKStringRef message)
+void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
- m_currentInvocation->didReceiveMessageFromInjectedBundle(message);
+ m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h
index bd073bf..5754728 100644
--- a/WebKitTools/WebKitTestRunner/TestController.h
+++ b/WebKitTools/WebKitTestRunner/TestController.h
@@ -36,39 +36,37 @@ namespace WTR {
class TestInvocation;
class PlatformWebView;
+// FIXME: Rename this TestRunner?
class TestController {
public:
static TestController& shared();
- // Initialize the TestController.
- void initialize(int argc, const char *argv[]);
-
- // Returns true if all the tests passed, false otherwise.
- bool run();
+ TestController(int argc, const char* argv[]);
+ ~TestController();
bool verbose() const { return m_verbose; }
WKStringRef injectedBundlePath() { return m_injectedBundlePath.get(); }
- WKStringRef testPluginPath() { return m_testPluginPath.get(); }
+ WKStringRef testPluginDirectory() { return m_testPluginDirectory.get(); }
- PlatformWebView* mainWebView() { return m_mainWebView; }
+ PlatformWebView* mainWebView() { return m_mainWebView.get(); }
WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); }
WKContextRef context() { return m_context.get(); }
private:
- TestController();
- ~TestController();
+ void initialize(int argc, const char* argv[]);
+ void run();
void runTestingServerLoop();
void runTest(const char* pathOrURL);
void platformInitialize();
void initializeInjectedBundlePath();
- void initializeTestPluginPath();
+ void initializeTestPluginDirectory();
// WKContextInjectedBundleClient
- static void _didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*);
- void didReceiveMessageFromInjectedBundle(WKStringRef message);
+ static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void*);
+ void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
OwnPtr<TestInvocation> m_currentInvocation;
@@ -78,9 +76,9 @@ private:
bool m_usingServerMode;
std::vector<std::string> m_paths;
WKRetainPtr<WKStringRef> m_injectedBundlePath;
- WKRetainPtr<WKStringRef> m_testPluginPath;
+ WKRetainPtr<WKStringRef> m_testPluginDirectory;
- PlatformWebView* m_mainWebView;
+ OwnPtr<PlatformWebView> m_mainWebView;
WKRetainPtr<WKContextRef> m_context;
WKRetainPtr<WKPageNamespaceRef> m_pageNamespace;
};
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index b6e950f..658911b 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -108,8 +108,9 @@ void TestInvocation::invoke()
sizeWebViewForCurrentTest(m_pathOrURL);
resetPreferencesToConsistentValues();
- WKRetainPtr<WKStringRef> message(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
- WKContextPostMessageToInjectedBundle(TestController::shared().context(), message.get());
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
+ WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("")));
+ WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), messageBody.get());
runUntil(m_gotInitialResponse);
if (m_error) {
@@ -139,11 +140,10 @@ void TestInvocation::dump(const char* stringToDump)
fflush(stderr);
}
-void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef message)
+void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
- RetainPtr<CFStringRef> cfMessage(AdoptCF, WKStringCopyCFString(0, message));
-
- if (CFEqual(cfMessage.get(), CFSTR("Error"))) {
+ RetainPtr<CFStringRef> cfMessageName(AdoptCF, WKStringCopyCFString(0, messageName));
+ if (CFEqual(cfMessageName.get(), CFSTR("Error"))) {
// Set all states to true to stop spinning the runloop.
m_gotInitialResponse = true;
m_gotFinalMessage = true;
@@ -151,15 +151,27 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef message)
return;
}
- if (CFEqual(cfMessage.get(), CFSTR("BeginTestAck"))) {
- m_gotInitialResponse = true;
- return;
+ if (CFEqual(cfMessageName.get(), CFSTR("Ack"))) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ RetainPtr<CFStringRef> cfMessageBody(AdoptCF, WKStringCopyCFString(0, static_cast<WKStringRef>(messageBody)));
+
+ if (CFEqual(cfMessageBody.get(), CFSTR("BeginTest"))) {
+ m_gotInitialResponse = true;
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
}
- OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
+ if (CFEqual(cfMessageName.get(), CFSTR("Done"))) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(static_cast<WKStringRef>(messageBody));
+ dump(utf8Message->data());
+ m_gotFinalMessage = true;
+ return;
+ }
- dump(utf8Message->data());
- m_gotFinalMessage = true;
+ ASSERT_NOT_REACHED();
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.h b/WebKitTools/WebKitTestRunner/TestInvocation.h
index e064a8f..484e61d 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.h
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.h
@@ -37,7 +37,7 @@ public:
~TestInvocation();
void invoke();
- void didReceiveMessageFromInjectedBundle(WKStringRef message);
+ void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
private:
void dump(const char*);
diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln b/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln
index e2435d3..670dd30 100644
--- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln
+++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.sln
@@ -18,7 +18,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiff", "..\DumpRenderT
{DA31DA52-6675-48D4-89E0-333A7144397C} = {DA31DA52-6675-48D4-89E0-333A7144397C}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "InjectedBundle\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
ProjectSection(ProjectDependencies) = postProject
{4343BC0B-A2E0-4B48-8277-F33CFBFA83CD} = {4343BC0B-A2E0-4B48-8277-F33CFBFA83CD}
EndProjectSection
diff --git a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
index 21db2eb..4e2a60c 100644
--- a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
@@ -38,6 +38,7 @@ PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
[[m_window contentView] addSubview:m_view];
[m_window orderBack:nil];
[m_window setAutodisplay:NO];
+ [m_window setReleasedWhenClosed:NO];
}
void PlatformWebView::resizeTo(unsigned width, unsigned height)
diff --git a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
index ae4cc2f..1a71b5d 100644
--- a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
@@ -40,9 +40,9 @@ void TestController::initializeInjectedBundlePath()
m_injectedBundlePath.adopt(WKStringCreateWithCFString((CFStringRef)nsBundlePath));
}
-void TestController::initializeTestPluginPath()
+void TestController::initializeTestPluginDirectory()
{
- m_testPluginPath.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
+ m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/mac/main.mm b/WebKitTools/WebKitTestRunner/mac/main.mm
index 021c124..d2f26ab 100644
--- a/WebKitTools/WebKitTestRunner/mac/main.mm
+++ b/WebKitTools/WebKitTestRunner/mac/main.mm
@@ -28,13 +28,10 @@
int main(int argc, const char* argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
[NSApplication sharedApplication];
-
- WTR::TestController::shared().initialize(argc, argv);
- WTR::TestController::shared().run();
-
+ {
+ WTR::TestController controller(argc, argv);
+ }
[pool drain];
-
return 0;
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj
index be20bab..d283083 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj
+++ b/WebKitTools/WebKitTestRunner/win/InjectedBundle.vcproj
@@ -18,7 +18,7 @@
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -79,7 +79,7 @@
<Configuration
Name="Release|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -141,7 +141,7 @@
<Configuration
Name="Debug_All|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -202,7 +202,7 @@
<Configuration
Name="Debug_Internal|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;..\..\Configurations\InjectedBundleCommon.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;..\Configurations\InjectedBundleCommon.vsprops"
CharacterSet="1"
>
<Tool
@@ -268,19 +268,19 @@
Name="Bindings"
>
<File
- RelativePath="..\Bindings\CodeGeneratorTestRunner.pm"
+ RelativePath="..\InjectedBundle\Bindings\CodeGeneratorTestRunner.pm"
>
</File>
<File
- RelativePath="..\Bindings\JSWrappable.h"
+ RelativePath="..\InjectedBundle\Bindings\JSWrappable.h"
>
</File>
<File
- RelativePath="..\Bindings\JSWrapper.cpp"
+ RelativePath="..\InjectedBundle\Bindings\JSWrapper.cpp"
>
</File>
<File
- RelativePath="..\Bindings\JSWrapper.h"
+ RelativePath="..\InjectedBundle\Bindings\JSWrapper.h"
>
</File>
</Filter>
@@ -297,35 +297,35 @@
</File>
</Filter>
<File
- RelativePath="ActivateFonts.cpp"
+ RelativePath="..\InjectedBundle\win\ActivateFonts.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundle.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundle.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundle.h"
+ RelativePath="..\InjectedBundle\InjectedBundle.h"
>
</File>
<File
- RelativePath="..\InjectedBundleMain.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundleMain.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundlePage.cpp"
+ RelativePath="..\InjectedBundle\InjectedBundlePage.cpp"
>
</File>
<File
- RelativePath="..\InjectedBundlePage.h"
+ RelativePath="..\InjectedBundle\InjectedBundlePage.h"
>
</File>
<File
- RelativePath="..\LayoutTestController.cpp"
+ RelativePath="..\InjectedBundle\LayoutTestController.cpp"
>
</File>
<File
- RelativePath="..\LayoutTestController.h"
+ RelativePath="..\InjectedBundle\LayoutTestController.h"
>
</File>
</Files>
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index 987481a..9bec373 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -50,11 +50,11 @@ void TestController::initializeInjectedBundlePath()
m_injectedBundlePath.adopt(WKStringCreateWithCFString(bundlePath));
}
-void TestController::initializeTestPluginPath()
+void TestController::initializeTestPluginDirectory()
{
CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle);
CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath);
- m_testPluginPath.adopt(WKStringCreateWithCFString(bundlePath));
+ m_testPluginDirectory.adopt(WKStringCreateWithCFString(bundlePath));
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln b/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln
deleted file mode 100644
index 757b7fb..0000000
--- a/WebKitTools/WebKitTestRunner/win/WebKitTestRunner.sln
+++ /dev/null
@@ -1,39 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitTestRunner", "WebKitTestRunner.vcproj", "{3B99669B-1817-443B-BCBE-835580146668}"
- ProjectSection(ProjectDependencies) = postProject
- {CBC3391C-F060-4BF5-A66E-81404168816B} = {CBC3391C-F060-4BF5-A66E-81404168816B}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectedBundle", "..\InjectedBundle\win\InjectedBundle.vcproj", "{CBC3391C-F060-4BF5-A66E-81404168816B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug_All|Win32 = Debug_All|Win32
- Debug_Internal|Win32 = Debug_Internal|Win32
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_All|Win32.Build.0 = Debug_All|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug|Win32.ActiveCfg = Debug|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Debug|Win32.Build.0 = Debug|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Release|Win32.ActiveCfg = Release|Win32
- {3B99669B-1817-443B-BCBE-835580146668}.Release|Win32.Build.0 = Release|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_All|Win32.Build.0 = Debug_All|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug|Win32.ActiveCfg = Debug|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Debug|Win32.Build.0 = Debug|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Release|Win32.ActiveCfg = Release|Win32
- {CBC3391C-F060-4BF5-A66E-81404168816B}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/WebKitTools/WebKitTestRunner/win/main.cpp b/WebKitTools/WebKitTestRunner/win/main.cpp
index 96e55b4..6ef0f66 100644
--- a/WebKitTools/WebKitTestRunner/win/main.cpp
+++ b/WebKitTools/WebKitTestRunner/win/main.cpp
@@ -27,8 +27,9 @@
int main(int argc, const char* argv[])
{
- WTR::TestController::shared().initialize(argc, argv);
- WTR::TestController::shared().run();
+ {
+ WTR::TestController controller(argc, argv);
+ }
return 0;
}