diff options
author | Steve Block <steveblock@google.com> | 2009-11-05 09:23:40 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-11-10 22:41:12 +0000 |
commit | cac0f67c402d107cdb10971b95719e2ff9c7c76b (patch) | |
tree | d182c7f87211c6f201a5f038e332336493ebdbe7 /WebKitTools/DumpRenderTree | |
parent | 4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff) | |
download | external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2 |
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebKitTools/DumpRenderTree')
41 files changed, 2050 insertions, 881 deletions
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.sln b/WebKitTools/DumpRenderTree/DumpRenderTree.sln index 43d2b61..399c002 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.sln +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.sln @@ -11,29 +11,38 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiff", "win\ImageDiff. 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
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_All|Win32.Build.0 = Debug_All|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.ActiveCfg = Debug|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.Build.0 = Debug|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.ActiveCfg = Release|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.Build.0 = Release|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_All|Win32.Build.0 = Debug_All|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.ActiveCfg = Debug|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.Build.0 = Debug|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.ActiveCfg = Release|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.Build.0 = Release|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.Build.0 = Debug|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.ActiveCfg = Debug|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.Build.0 = Debug|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.ActiveCfg = Release|Win32
- {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.Build.0 = Release|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_All|Win32.ActiveCfg = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_All|Win32.Build.0 = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.ActiveCfg = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.Build.0 = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.ActiveCfg = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.Build.0 = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.ActiveCfg = all|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.Build.0 = all|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_All|Win32.Build.0 = Debug_All|Win32
{59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.ActiveCfg = Debug|Win32
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index 1f34325..daf888f 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -31,6 +31,7 @@ #include "WorkQueue.h" #include "WorkQueueItem.h" +#include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSObjectRef.h> #include <JavaScriptCore/JSRetainPtr.h> #include <stdio.h> @@ -48,12 +49,14 @@ LayoutTestController::LayoutTestController(const std::string& testPathOrURL, con , m_dumpDatabaseCallbacks(false) , m_dumpEditingCallbacks(false) , m_dumpFrameLoadCallbacks(false) + , m_dumpHistoryDelegateCallbacks(false) , m_dumpResourceLoadCallbacks(false) , m_dumpResourceResponseMIMETypes(false) , m_dumpSelectionRect(false) , m_dumpSourceAsWebArchive(false) , m_dumpStatusCallbacks(false) , m_dumpTitleChanges(false) + , m_dumpVisitedLinksCallback(false) , m_dumpWillCacheResponse(false) , m_callCloseOnWebViews(true) , m_canOpenWindows(false) @@ -204,6 +207,14 @@ static JSValueRef pathToLocalResourceCallback(JSContextRef context, JSObjectRef return JSValueMakeString(context, convertedPath.get()); } +static JSValueRef removeAllVisitedLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setDumpVisitedLinksCallback(true); + controller->removeAllVisitedLinks(); + return JSValueMakeUndefined(context); +} + static JSValueRef repaintSweepHorizontallyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); @@ -374,6 +385,22 @@ static JSValueRef execCommandCallback(JSContextRef context, JSObjectRef function return JSValueMakeUndefined(context); } +static JSValueRef counterValueForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + if (*exception) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + JSRetainPtr<JSStringRef> counterValue(controller->counterValueForElementById(elementId.get())); + if (!counterValue.get()) + return JSValueMakeUndefined(context); + return JSValueMakeString(context, counterValue.get()); +} + static JSValueRef grantDesktopNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has Windows implementation @@ -968,6 +995,18 @@ static JSValueRef evaluateInWebInspectorCallback(JSContextRef context, JSObjectR return JSValueMakeUndefined(context); } +static JSValueRef evaluateScriptInIsolatedWorldCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + double worldID = JSValueToNumber(context, arguments[0], exception); + ASSERT(!*exception); + JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception)); + ASSERT(!*exception); + + controller->evaluateScriptInIsolatedWorld(static_cast<unsigned>(worldID), JSContextGetGlobalObject(context), script.get()); + return JSValueMakeUndefined(context); +} + static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); @@ -1176,7 +1215,9 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "evaluateScriptInIsolatedWorld", evaluateScriptInIsolatedWorldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1193,6 +1234,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "queueLoadingScript", queueLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueNonLoadingScript", queueNonLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueReload", queueReloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 7c829ef..79ffb99 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -30,6 +30,7 @@ #define LayoutTestController_h #include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSRetainPtr.h> #include <wtf/RefCounted.h> #include <string> #include <vector> @@ -51,6 +52,7 @@ public: void dispatchPendingLoadRequests(); void display(); void execCommand(JSStringRef name, JSStringRef value); + JSRetainPtr<JSStringRef> counterValueForElementById(JSStringRef id); bool isCommandEnabled(JSStringRef name); void keepWebHistory(); void notifyDone(); @@ -62,6 +64,7 @@ public: void queueLoadingScript(JSStringRef script); void queueNonLoadingScript(JSStringRef script); void queueReload(); + void removeAllVisitedLinks(); void setAcceptsEditing(bool acceptsEditing); void setAppCacheMaximumSize(unsigned long long quota); void setAuthorAndUserStylesEnabled(bool); @@ -120,6 +123,9 @@ public: bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; } void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; } + bool dumpHistoryDelegateCallbacks() const { return m_dumpHistoryDelegateCallbacks; } + void setDumpHistoryDelegateCallbacks(bool dumpHistoryDelegateCallbacks) { m_dumpHistoryDelegateCallbacks = dumpHistoryDelegateCallbacks; } + bool dumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; } void setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks) { m_dumpResourceLoadCallbacks = dumpResourceLoadCallbacks; } @@ -137,6 +143,9 @@ public: bool dumpTitleChanges() const { return m_dumpTitleChanges; } void setDumpTitleChanges(bool dumpTitleChanges) { m_dumpTitleChanges = dumpTitleChanges; } + + bool dumpVisitedLinksCallback() const { return m_dumpVisitedLinksCallback; } + void setDumpVisitedLinksCallback(bool dumpVisitedLinksCallback) { m_dumpVisitedLinksCallback = dumpVisitedLinksCallback; } bool dumpWillCacheResponse() const { return m_dumpWillCacheResponse; } void setDumpWillCacheResponse(bool dumpWillCacheResponse) { m_dumpWillCacheResponse = dumpWillCacheResponse; } @@ -206,6 +215,7 @@ public: void showWebInspector(); void closeWebInspector(); void evaluateInWebInspector(long callId, JSStringRef script); + void evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script); void setPOSIXLocale(JSStringRef locale); @@ -219,12 +229,14 @@ private: bool m_dumpDatabaseCallbacks; bool m_dumpEditingCallbacks; bool m_dumpFrameLoadCallbacks; + bool m_dumpHistoryDelegateCallbacks; bool m_dumpResourceLoadCallbacks; bool m_dumpResourceResponseMIMETypes; bool m_dumpSelectionRect; bool m_dumpSourceAsWebArchive; bool m_dumpStatusCallbacks; bool m_dumpTitleChanges; + bool m_dumpVisitedLinksCallback; bool m_dumpWillCacheResponse; bool m_callCloseOnWebViews; bool m_canOpenWindows; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp index 3a04c3c..14280ba 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp @@ -106,13 +106,17 @@ NPClass *getPluginClass(void) static bool identifiersInitialized = false; -#define ID_PROPERTY_PROPERTY 0 -#define ID_PROPERTY_EVENT_LOGGING 1 -#define ID_PROPERTY_HAS_STREAM 2 -#define ID_PROPERTY_TEST_OBJECT 3 -#define ID_PROPERTY_LOG_DESTROY 4 -#define ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM 5 -#define NUM_PROPERTY_IDENTIFIERS 6 +enum { + ID_PROPERTY_PROPERTY = 0, + ID_PROPERTY_EVENT_LOGGING, + ID_PROPERTY_HAS_STREAM, + ID_PROPERTY_TEST_OBJECT, + ID_PROPERTY_LOG_DESTROY, + ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM, + ID_PROPERTY_PRIVATE_BROWSING_ENABLED, + ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED, + NUM_PROPERTY_IDENTIFIERS +}; static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS]; static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { @@ -122,6 +126,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { "testObject", "logDestroy", "returnErrorFromNewStream", + "privateBrowsingEnabled", + "cachedPrivateBrowsingEnabled", }; enum { @@ -144,6 +150,7 @@ enum { ID_TEST_POSTURL_FILE, ID_TEST_CONSTRUCT, ID_TEST_THROW_EXCEPTION_METHOD, + ID_TEST_FAIL_METHOD, ID_DESTROY_NULL_STREAM, NUM_METHOD_IDENTIFIERS }; @@ -169,6 +176,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { "testPostURLFile", "testConstruct", "testThrowException", + "testFail", "destroyNullStream" }; @@ -226,6 +234,14 @@ static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* resul } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) { BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result); return true; + } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_PRIVATE_BROWSING_ENABLED]) { + NPBool privateBrowsingEnabled = FALSE; + browser->getvalue(plugin->npp, NPNVprivateModeBool, &privateBrowsingEnabled); + BOOLEAN_TO_NPVARIANT(privateBrowsingEnabled, *result); + return true; + } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED]) { + BOOLEAN_TO_NPVARIANT(plugin->cachedPrivateBrowsingMode, *result); + return true; } return false; } @@ -309,13 +325,13 @@ static NPIdentifier variantToIdentifier(NPVariant variant) static bool testIdentifierToString(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result) { if (argCount != 1) - return false; + return true; NPIdentifier identifier = variantToIdentifier(args[0]); if (!identifier) - return false; + return true; NPUTF8* utf8String = browser->utf8fromidentifier(identifier); if (!utf8String) - return false; + return true; STRINGZ_TO_NPVARIANT(utf8String, *result); return true; } @@ -669,6 +685,10 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a else if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) { browser->setexception(header, "plugin object testThrowException SUCCESS"); return true; + } else if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) { + NPObject* windowScriptObject; + browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject); + browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result); } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) return destroyNullStream(plugin, args, argCount, result); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h index 17b11e1..7437d04 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h @@ -35,6 +35,7 @@ typedef struct { NPBool logSetWindow; NPBool logDestroy; NPBool returnErrorFromNewStream; + NPBool cachedPrivateBrowsingMode; NPObject* testObject; NPStream* stream; char* onStreamLoad; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp index 88618c3..125d2e8 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp @@ -130,7 +130,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch return NPERR_INCOMPATIBLE_VERSION_ERROR; } + browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode); browser->setvalue(instance, NPPVpluginEventModel, (void *)obj->eventModel); + return NPERR_NO_ERROR; } @@ -383,5 +385,13 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) { - return NPERR_GENERIC_ERROR; + PluginObject* obj = static_cast<PluginObject*>(instance->pdata); + + switch (variable) { + case NPNVprivateModeBool: + obj->cachedPrivateBrowsingMode = *(NPBool*)value; + return NPERR_NO_ERROR; + default: + return NPERR_GENERIC_ERROR; + } } diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 6ecd774..4ed6e36 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -319,6 +319,8 @@ static void resetDefaultsToConsistentValues() "enable-offline-web-application-cache", TRUE, "enable-universal-access-from-file-uris", TRUE, "enable-scripts", TRUE, + "enable-web-sockets", TRUE, + "enable-dom-paste", TRUE, "default-font-family", "Times", "monospace-font-family", "Courier", "serif-font-family", "Times", @@ -706,6 +708,11 @@ static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, We static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*); +static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer data) +{ + return WEBKIT_WEB_VIEW(webkit_web_view_new()); +} + static WebKitWebView* createWebView() { WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); @@ -730,6 +737,9 @@ static WebKitWebView* createWebView() "signal::database-quota-exceeded", databaseQuotaExceeded, 0, NULL); + WebKitWebInspector* inspector = webkit_web_view_get_inspector(view); + g_signal_connect(inspector, "inspect-web-view", G_CALLBACK(webInspectorInspectWebView), 0); + return view; } diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index c3c72c1..f42928c 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -53,6 +53,7 @@ extern "C" { } static bool down = false; +static bool currentEventButton = 1; static bool dragMode = true; static bool replayingSavedEvents = false; static int lastMousePositionX; @@ -122,12 +123,27 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio static void updateClickCount(int /* button */) { // FIXME: take the last clicked button number and the time of last click into account. - if (lastClickPositionX != lastMousePositionX && lastClickPositionY != lastMousePositionY) + if (lastClickPositionX != lastMousePositionX || lastClickPositionY != lastMousePositionY) clickCount = 1; else clickCount++; } +#if !GTK_CHECK_VERSION(2,17,3) +static void getRootCoords(GtkWidget* view, int* rootX, int* rootY) +{ + GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(view)); + int tmpX, tmpY; + + gtk_widget_translate_coordinates(view, window, lastMousePositionX, lastMousePositionY, &tmpX, &tmpY); + + gdk_window_get_origin(window->window, rootX, rootY); + + *rootX += tmpX; + *rootY += tmpY; +} +#endif + static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); @@ -140,9 +156,29 @@ static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, memset(&event, 0, sizeof(event)); event.type = GDK_BUTTON_PRESS; event.button.button = 1; + + if (argumentCount == 1) { + event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1; + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + } + + currentEventButton = event.button.button; + event.button.x = lastMousePositionX; event.button.y = lastMousePositionY; event.button.window = GTK_WIDGET(view)->window; + event.button.time = GDK_CURRENT_TIME; + event.button.device = gdk_device_get_core_pointer(); + + int x_root, y_root; +#if GTK_CHECK_VERSION(2,17,3) + gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); +#else + getRootCoords(GTK_WIDGET(view), &x_root, &y_root); +#endif + + event.button.x_root = x_root; + event.button.y_root = y_root; updateClickCount(1); @@ -177,9 +213,29 @@ static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JS memset(&event, 0, sizeof(event)); event.type = GDK_BUTTON_RELEASE; event.button.button = 1; + + if (argumentCount == 1) { + event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1; + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + } + + currentEventButton = event.button.button; + event.button.x = lastMousePositionX; event.button.y = lastMousePositionY; event.button.window = GTK_WIDGET(view)->window; + event.button.time = GDK_CURRENT_TIME; + event.button.device = gdk_device_get_core_pointer(); + + int x_root, y_root; +#if GTK_CHECK_VERSION(2,17,3) + gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); +#else + getRootCoords(GTK_WIDGET(view), &x_root, &y_root); +#endif + + event.button.x_root = x_root; + event.button.y_root = y_root; if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) { msgQueue[endOfQueue].event = event; @@ -213,11 +269,33 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); GdkEvent event; + memset(&event, 0, sizeof(event)); event.type = GDK_MOTION_NOTIFY; event.motion.x = lastMousePositionX; event.motion.y = lastMousePositionY; event.motion.time = GDK_CURRENT_TIME; event.motion.window = GTK_WIDGET(view)->window; + event.motion.device = gdk_device_get_core_pointer(); + + int x_root, y_root; +#if GTK_CHECK_VERSION(2,17,3) + gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); +#else + getRootCoords(GTK_WIDGET(view), &x_root, &y_root); +#endif + + event.motion.x_root = x_root; + event.motion.y_root = y_root; + + if (down) { + if (currentEventButton == 1) + event.motion.state = GDK_BUTTON1_MASK; + else if (currentEventButton == 2) + event.motion.state = GDK_BUTTON2_MASK; + else if (currentEventButton == 3) + event.motion.state = GDK_BUTTON3_MASK; + } else + event.motion.state = 0; if (dragMode && down && !replayingSavedEvents) { msgQueue[endOfQueue].event = event; diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 0b4a38f..631fc31 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2007 Eric Seidel <eric@webkit.org> * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com> + * Copyright (C) 2009 Collabora Ltd. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -52,6 +53,8 @@ unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame) void webkit_application_cache_set_maximum_size(unsigned long long size); unsigned int webkit_worker_thread_count(void); void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains); +gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id); +void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script); } static gchar* copyWebSettingKey(gchar* preferenceKey) @@ -118,6 +121,17 @@ void LayoutTestController::display() displayWebView(); } +JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) +{ + gchar* idGChar = JSStringCopyUTF8CString(id); + gchar* counterValueGChar = webkit_web_frame_counter_value_for_element_by_id(mainFrame, idGChar); + g_free(idGChar); + if (!counterValueGChar) + return 0; + JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar)); + return counterValue; +} + void LayoutTestController::keepWebHistory() { // FIXME: implement @@ -474,15 +488,40 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source) void LayoutTestController::showWebInspector() { - // FIXME: Implement this. + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView); + WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); + + g_object_set(webSettings, "enable-developer-extras", TRUE, NULL); + webkit_web_inspector_inspect_coordinates(inspector, 0, 0); } void LayoutTestController::closeWebInspector() { - // FIXME: Implement this. + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView); + WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); + + webkit_web_inspector_close(inspector); + g_object_set(webSettings, "enable-developer-extras", FALSE, NULL); } void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) { + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); + char* scriptString = JSStringCopyUTF8CString(script); + + webkit_web_inspector_execute_script(inspector, callId, scriptString); + g_free(scriptString); +} + +void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) +{ + // FIXME: Implement this. +} + +void LayoutTestController::removeAllVisitedLinks() +{ // FIXME: Implement this. } diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig index 79d1e14..a72dd7d 100644 --- a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -22,11 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. HEADER_SEARCH_PATHS = ForwardingHeaders mac/InternalHeaders; -FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(MAC_OS_X_VERSION_MAJOR)); -FRAMEWORK_SEARCH_PATHS_ = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -FRAMEWORK_SEARCH_PATHS_1040 = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -FRAMEWORK_SEARCH_PATHS_1050 = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks -FRAMEWORK_SEARCH_PATHS_1060 = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks +FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; DEBUG_INFORMATION_FORMAT = dwarf PREBINDING = NO diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig index 05af1e5..96a39a9 100644 --- a/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig +++ b/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig @@ -28,6 +28,7 @@ ARCHS_ = $(ARCHS_1040); ARCHS_1040 = $(NATIVE_ARCH); ARCHS_1050 = $(NATIVE_ARCH); ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; @@ -36,3 +37,4 @@ MACOSX_DEPLOYMENT_TARGET_ = 10.4; MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 0c33381..98f4f9c 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -409,7 +409,7 @@ static void resetDefaultsToConsistentValues() [preferences setCacheModel:WebCacheModelDocumentBrowser]; [preferences setXSSAuditorEnabled:NO]; [preferences setExperimentalNotificationsEnabled:NO]; - [preferences setExperimentalWebSocketsEnabled:NO]; + [preferences setPluginAllowedRunTime:1]; [preferences setPrivateBrowsingEnabled:NO]; [preferences setAuthorAndUserStylesEnabled:YES]; @@ -434,9 +434,9 @@ static void resetDefaultsToConsistentValues() SInt32 qtVersion; OSErr err = Gestalt(gestaltQuickTimeVersion, &qtVersion); assert(err == noErr); - // Bug 7228836 exists in at least 7.6.3 and 7.6.4, hopefully it will be fixed in 7.6.5. + // Bug 7228836 exists in at least 7.6.3 through 7.6.4, hopefully it will be fixed in 7.6.5. // FIXME: Once we know the exact versions of QuickTime affected, we can update this check. - if (qtVersion <= 0x07640000) + if (qtVersion <= 0x07648000) // 7.6.4, final release (0x8). See http://developer.apple.com/mac/library/techn [preferences setAcceleratedCompositingEnabled:NO]; else #endif diff --git a/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm index 9e2b836..cbc4093 100644 --- a/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm +++ b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm @@ -29,6 +29,7 @@ #import "LayoutTestController.h" #import <WebKit/WebNavigationData.h> +#import <WebKit/WebView.h> @interface NSURL (DRTExtras) - (NSString *)_drt_descriptionSuitableForTestResult; @@ -71,4 +72,10 @@ printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", [[[NSURL URLWithString:url]_drt_descriptionSuitableForTestResult] UTF8String], [title UTF8String]); } +- (void)populateVisitedLinksForWebView:(WebView *)webView +{ + if (gLayoutTestController->dumpVisitedLinksCallback()) + printf("Asked to populate visited links for WebView \"%s\"\n", [[[NSURL URLWithString:[webView mainFrameURL]] _drt_descriptionSuitableForTestResult] UTF8String]); +} + @end diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 233c5fd..4d6a609 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -42,6 +42,7 @@ #import <WebKit/DOMElement.h> #import <WebKit/WebApplicationCache.h> #import <WebKit/WebBackForwardList.h> +#import <WebKit/WebCoreStatistics.h> #import <WebKit/WebDatabaseManagerPrivate.h> #import <WebKit/WebDataSource.h> #import <WebKit/WebFrame.h> @@ -151,6 +152,19 @@ void LayoutTestController::display() displayWebView(); } +JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) +{ + RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, id)); + NSString *idNS = (NSString *)idCF.get(); + + DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS]; + if (!element) + return 0; + + JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame counterValueForElement:element])); + return counterValue; +} + void LayoutTestController::keepWebHistory() { if (![WebHistory optionalSharedHistory]) { @@ -333,6 +347,11 @@ void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS]; } +void LayoutTestController::removeAllVisitedLinks() +{ + [WebHistory _removeAllVisitedLinks]; +} + void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL) { RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); @@ -482,24 +501,26 @@ void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart) { RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source)); NSString *sourceNS = (NSString *)sourceCF.get(); - [WebView _addUserScriptToGroup:@"org.webkit.DumpRenderTree" source:sourceNS url:nil worldID:1 whitelist:nil blacklist:nil injectionTime:(runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd)]; + [WebView _addUserScriptToGroup:@"org.webkit.DumpRenderTree" worldID:1 source:sourceNS url:nil whitelist:nil blacklist:nil injectionTime:(runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd)]; } void LayoutTestController::addUserStyleSheet(JSStringRef source) { RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source)); NSString *sourceNS = (NSString *)sourceCF.get(); - [WebView _addUserStyleSheetToGroup:@"org.webkit.DumpRenderTree" source:sourceNS url:nil worldID:1 whitelist:nil blacklist:nil]; + [WebView _addUserStyleSheetToGroup:@"org.webkit.DumpRenderTree" worldID:1 source:sourceNS url:nil whitelist:nil blacklist:nil]; } void LayoutTestController::showWebInspector() { + [[[mainFrame webView] preferences] setDeveloperExtrasEnabled:true]; [[[mainFrame webView] inspector] show:nil]; } void LayoutTestController::closeWebInspector() { [[[mainFrame webView] inspector] close:nil]; + [[[mainFrame webView] preferences] setDeveloperExtrasEnabled:false]; } void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) @@ -508,3 +529,10 @@ void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef scrip NSString *scriptNS = (NSString *)scriptCF.get(); [[[mainFrame webView] inspector] evaluateInFrontend:nil callId:callId script:scriptNS]; } + +void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) +{ + RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script)); + NSString *scriptNS = (NSString *)scriptCF.get(); + [mainFrame _stringByEvaluatingJavaScriptInIsolatedWorld:worldID WithGlobalObject:globalObject FromString:scriptNS]; +} diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm index a52d5be..393899e 100644 --- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm +++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm @@ -157,6 +157,11 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; [geolocation setIsAllowed:gLayoutTestController->geolocationPermission()]; } +- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode +{ + return NO; +} + - (void)dealloc { [draggingInfo release]; diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp index 83626ac..9faa37f 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp @@ -30,6 +30,9 @@ */ #include "DumpRenderTree.h" +#include "EventSenderQt.h" +#include "LayoutTestControllerQt.h" +#include "TextInputControllerQt.h" #include "jsobjects.h" #include "testplugin.h" #include "WorkQueue.h" @@ -65,6 +68,7 @@ extern void qt_dump_set_accepts_editing(bool b); extern void qt_dump_frame_loader(bool b); extern void qt_drt_clearFrameName(QWebFrame* qFrame); extern void qt_drt_overwritePluginDirectories(); +extern void qt_drt_resetOriginAccessWhiteLists(); namespace WebCore { @@ -285,9 +289,10 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting() //WorkQueue::shared()->setFrozen(false); m_controller->reset(); - QWebSecurityOrigin::resetOriginAccessWhiteLists(); + qt_drt_resetOriginAccessWhiteLists(); - setlocale(LC_ALL, ""); + QLocale qlocale; + QLocale::setDefault(qlocale); } void DumpRenderTree::open(const QUrl& aurl) @@ -312,7 +317,7 @@ void DumpRenderTree::open(const QUrl& aurl) int width = isW3CTest ? 480 : maxViewWidth; int height = isW3CTest ? 360 : maxViewHeight; m_page->view()->resize(QSize(width, height)); - m_page->setFixedContentsSize(QSize()); + m_page->setPreferredContentsSize(QSize()); m_page->setViewportSize(QSize(width, height)); QFocusEvent ev(QEvent::FocusIn); @@ -591,7 +596,8 @@ void DumpRenderTree::initializeFonts() exit(1); } char currentPath[PATH_MAX+1]; - getcwd(currentPath, PATH_MAX); + if (!getcwd(currentPath, PATH_MAX)) + qFatal("Couldn't get current working directory"); QByteArray configFile = currentPath; FcConfig *config = FcConfigCreate(); configFile += "/WebKitTools/DumpRenderTree/qt/fonts.conf"; diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro index 0daf8bd..571313c 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro @@ -12,8 +12,23 @@ PKGCONFIG += fontconfig QT = core gui network macx: QT += xml -HEADERS = WorkQueue.h WorkQueueItem.h DumpRenderTree.h jsobjects.h testplugin.h -SOURCES = WorkQueue.cpp DumpRenderTree.cpp main.cpp jsobjects.cpp testplugin.cpp +HEADERS = WorkQueue.h \ + WorkQueueItem.h \ + DumpRenderTree.h \ + EventSenderQt.h \ + TextInputControllerQt.h \ + LayoutTestControllerQt.h \ + jsobjects.h \ + testplugin.h +SOURCES = WorkQueue.cpp \ + DumpRenderTree.cpp \ + EventSenderQt.cpp \ + TextInputControllerQt.cpp \ + WorkQueueItemQt.cpp \ + LayoutTestControllerQt.cpp \ + main.cpp \ + jsobjects.cpp \ + testplugin.cpp unix:!mac { QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp new file mode 100644 index 0000000..bbefed9 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "config.h" +#include "EventSenderQt.h" + +//#include <QtDebug> +EventSender::EventSender(QWebPage* parent) + : QObject(parent) +{ + m_page = parent; +} + +void EventSender::mouseDown(int button) +{ + Qt::MouseButton mouseButton; + switch (button) { + case 0: + mouseButton = Qt::LeftButton; + break; + case 1: + mouseButton = Qt::MidButton; + break; + case 2: + mouseButton = Qt::RightButton; + break; + case 3: + // fast/events/mouse-click-events expects the 4th button to be treated as the middle button + mouseButton = Qt::MidButton; + break; + default: + mouseButton = Qt::LeftButton; + break; + } + +// qDebug() << "EventSender::mouseDown" << frame; + QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, mouseButton, mouseButton, Qt::NoModifier); + QApplication::sendEvent(m_page, &event); +} + +void EventSender::mouseUp(int button) +{ + Qt::MouseButton mouseButton; + switch (button) { + case 0: + mouseButton = Qt::LeftButton; + break; + case 1: + mouseButton = Qt::MidButton; + break; + case 2: + mouseButton = Qt::RightButton; + break; + case 3: + // fast/events/mouse-click-events expects the 4th button to be treated as the middle button + mouseButton = Qt::MidButton; + break; + default: + mouseButton = Qt::LeftButton; + break; + } + +// qDebug() << "EventSender::mouseUp" << frame; + QMouseEvent event(QEvent::MouseButtonRelease, m_mousePos, mouseButton, mouseButton, Qt::NoModifier); + QApplication::sendEvent(m_page, &event); +} + +void EventSender::mouseMoveTo(int x, int y) +{ +// qDebug() << "EventSender::mouseMoveTo" << x << y; + m_mousePos = QPoint(x, y); + QMouseEvent event(QEvent::MouseMove, m_mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); + QApplication::sendEvent(m_page, &event); +} + +void EventSender::leapForward(int ms) +{ + m_timeLeap += ms; + //qDebug() << "EventSender::leapForward" << ms; +} + +void EventSender::keyDown(const QString& string, const QStringList& modifiers) +{ + QString s = string; + Qt::KeyboardModifiers modifs = 0; + for (int i = 0; i < modifiers.size(); ++i) { + const QString& m = modifiers.at(i); + if (m == "ctrlKey") + modifs |= Qt::ControlModifier; + else if (m == "shiftKey") + modifs |= Qt::ShiftModifier; + else if (m == "altKey") + modifs |= Qt::AltModifier; + else if (m == "metaKey") + modifs |= Qt::MetaModifier; + } + int code = 0; + if (string.length() == 1) { + code = string.unicode()->unicode(); + //qDebug() << ">>>>>>>>> keyDown" << code << (char)code; + // map special keycodes used by the tests to something that works for Qt/X11 + if (code == '\t') { + code = Qt::Key_Tab; + if (modifs == Qt::ShiftModifier) + code = Qt::Key_Backtab; + s = QString(); + } else if (code == 127) { + code = Qt::Key_Backspace; + if (modifs == Qt::AltModifier) + modifs = Qt::ControlModifier; + s = QString(); + } else if (code == 'o' && modifs == Qt::ControlModifier) { + s = QLatin1String("\n"); + code = '\n'; + modifs = 0; + } else if (code == 'y' && modifs == Qt::ControlModifier) { + s = QLatin1String("c"); + code = 'c'; + } else if (code == 'k' && modifs == Qt::ControlModifier) { + s = QLatin1String("x"); + code = 'x'; + } else if (code == 'a' && modifs == Qt::ControlModifier) { + s = QString(); + code = Qt::Key_Home; + modifs = 0; + } else if (code == 0xf702) { + s = QString(); + code = Qt::Key_Left; + if (modifs & Qt::MetaModifier) { + code = Qt::Key_Home; + modifs &= ~Qt::MetaModifier; + } + } else if (code == 0xf703) { + s = QString(); + code = Qt::Key_Right; + if (modifs & Qt::MetaModifier) { + code = Qt::Key_End; + modifs &= ~Qt::MetaModifier; + } + } else if (code == 0xf700) { + s = QString(); + code = Qt::Key_Up; + if (modifs & Qt::MetaModifier) { + code = Qt::Key_PageUp; + modifs &= ~Qt::MetaModifier; + } + } else if (code == 0xf701) { + s = QString(); + code = Qt::Key_Down; + if (modifs & Qt::MetaModifier) { + code = Qt::Key_PageDown; + modifs &= ~Qt::MetaModifier; + } + } else if (code == 'a' && modifs == Qt::ControlModifier) { + s = QString(); + code = Qt::Key_Home; + modifs = 0; + } else + code = string.unicode()->toUpper().unicode(); + } else { + //qDebug() << ">>>>>>>>> keyDown" << string; + + if (string.startsWith(QLatin1Char('F')) && string.count() <= 3) { + s = s.mid(1); + int functionKey = s.toInt(); + Q_ASSERT(functionKey >= 1 && functionKey <= 35); + code = Qt::Key_F1 + (functionKey - 1); + // map special keycode strings used by the tests to something that works for Qt/X11 + } else if (string == QLatin1String("leftArrow")) { + s = QString(); + code = Qt::Key_Left; + } else if (string == QLatin1String("rightArrow")) { + s = QString(); + code = Qt::Key_Right; + } else if (string == QLatin1String("upArrow")) { + s = QString(); + code = Qt::Key_Up; + } else if (string == QLatin1String("downArrow")) { + s = QString(); + code = Qt::Key_Down; + } else if (string == QLatin1String("pageUp")) { + s = QString(); + code = Qt::Key_PageUp; + } else if (string == QLatin1String("pageDown")) { + s = QString(); + code = Qt::Key_PageDown; + } else if (string == QLatin1String("home")) { + s = QString(); + code = Qt::Key_Home; + } else if (string == QLatin1String("end")) { + s = QString(); + code = Qt::Key_End; + } else if (string == QLatin1String("delete")) { + s = QString(); + code = Qt::Key_Delete; + } + } + QKeyEvent event(QEvent::KeyPress, code, modifs, s); + QApplication::sendEvent(m_page, &event); + QKeyEvent event2(QEvent::KeyRelease, code, modifs, s); + QApplication::sendEvent(m_page, &event2); +} + +void EventSender::contextClick() +{ + QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); + QApplication::sendEvent(m_page, &event); + QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); + QApplication::sendEvent(m_page, &event2); +} + +void EventSender::scheduleAsynchronousClick() +{ + QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonPress, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); + QApplication::postEvent(m_page, event); + QMouseEvent* event2 = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); + QApplication::postEvent(m_page, event2); +} + +QWebFrame* EventSender::frameUnderMouse() const +{ + QWebFrame* frame = m_page->mainFrame(); + +redo: + QList<QWebFrame*> children = frame->childFrames(); + for (int i = 0; i < children.size(); ++i) { + if (children.at(i)->geometry().contains(m_mousePos)) { + frame = children.at(i); + goto redo; + } + } + if (frame->geometry().contains(m_mousePos)) + return frame; + return 0; +} diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h new file mode 100644 index 0000000..fd74455 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 EventSenderQt_h +#define EventSenderQt_h + +#include <QApplication> +#include <QEvent> +#include <QMouseEvent> +#include <QObject> +#include <QPoint> +#include <QString> +#include <QStringList> + +#include <qwebpage.h> +#include <qwebframe.h> + +class EventSender : public QObject { + Q_OBJECT +public: + EventSender(QWebPage* parent); + +public slots: + void mouseDown(int button = 0); + void mouseUp(int button = 0); + void mouseMoveTo(int x, int y); + void leapForward(int ms); + void keyDown(const QString& string, const QStringList& modifiers = QStringList()); + void clearKillRing() {} + void contextClick(); + void scheduleAsynchronousClick(); + +private: + QPoint m_mousePos; + QWebPage* m_page; + int m_timeLeap; + QWebFrame* frameUnderMouse() const; +}; +#endif // EventSenderQt_h diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp new file mode 100644 index 0000000..b8de6a5 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -0,0 +1,316 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "config.h" +#include "LayoutTestControllerQt.h" + +#include "DumpRenderTree.h" +#include "WorkQueue.h" +#include "WorkQueueItem.h" + +extern void qt_dump_editing_callbacks(bool b); +extern void qt_dump_resource_load_callbacks(bool b); +extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); +extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); +extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); +extern int qt_drt_numberOfActiveAnimations(QWebFrame*); +extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); +extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id); + +LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt) + : QObject() + , m_drt(drt) +{ + reset(); +} + +void LayoutTestController::reset() +{ + m_isLoading = true; + m_textDump = false; + m_dumpBackForwardList = false; + m_dumpChildrenAsText = false; + m_canOpenWindows = false; + m_waitForDone = false; + m_dumpTitleChanges = false; + m_dumpDatabaseCallbacks = false; + m_dumpStatusCallbacks = false; + m_timeoutTimer.stop(); + m_topLoadingFrame = 0; + m_waitForPolicy = false; + qt_dump_editing_callbacks(false); + qt_dump_resource_load_callbacks(false); +} + +void LayoutTestController::processWork() +{ + // qDebug() << ">>>processWork"; + + // if we didn't start a new load, then we finished all the commands, so we're ready to dump state + if (!WorkQueue::shared()->processWork() && !shouldWaitUntilDone()) { + emit done(); + m_isLoading = false; + } +} + +// Called on loadFinished on mainFrame. +void LayoutTestController::maybeDump(bool success) +{ + Q_ASSERT(sender() == m_topLoadingFrame); + + // as the function is called on loadFinished, the test might + // already have dumped and thus no longer be active, thus + // bail out here. + if (!m_isLoading) + return; + + m_topLoadingFrame = 0; + WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test + + if (!shouldWaitUntilDone()) { + if (WorkQueue::shared()->count()) + QTimer::singleShot(0, this, SLOT(processWork())); + else { + if (success) + emit done(); + m_isLoading = false; + } + } +} + +void LayoutTestController::waitUntilDone() +{ + //qDebug() << ">>>>waitForDone"; + m_waitForDone = true; + m_timeoutTimer.start(11000, this); +} + +QString LayoutTestController::counterValueForElementById(const QString& id) +{ + return qt_drt_counterValueForElementById(m_drt->webPage()->mainFrame(), id); +} + +void LayoutTestController::keepWebHistory() +{ + // FIXME: implement +} + +void LayoutTestController::notifyDone() +{ + qDebug() << ">>>>notifyDone"; + if (!m_timeoutTimer.isActive()) + return; + m_timeoutTimer.stop(); + emit done(); + m_isLoading = false; + m_waitForDone = false; + m_waitForPolicy = false; +} + +int LayoutTestController::windowCount() +{ + return m_drt->windowCount(); +} + +void LayoutTestController::clearBackForwardList() +{ + m_drt->webPage()->history()->clear(); +} + +void LayoutTestController::dumpEditingCallbacks() +{ + qDebug() << ">>>dumpEditingCallbacks"; + qt_dump_editing_callbacks(true); +} + +void LayoutTestController::dumpResourceLoadCallbacks() +{ + qt_dump_resource_load_callbacks(true); +} + +void LayoutTestController::queueBackNavigation(int howFarBackward) +{ + //qDebug() << ">>>queueBackNavigation" << howFarBackward; + WorkQueue::shared()->queue(new BackItem(howFarBackward, m_drt->webPage())); +} + +void LayoutTestController::queueForwardNavigation(int howFarForward) +{ + //qDebug() << ">>>queueForwardNavigation" << howFarForward; + WorkQueue::shared()->queue(new ForwardItem(howFarForward, m_drt->webPage())); +} + +void LayoutTestController::queueLoad(const QString& url, const QString& target) +{ + //qDebug() << ">>>queueLoad" << url << target; + QUrl mainResourceUrl = m_drt->webPage()->mainFrame()->url(); + QString absoluteUrl = mainResourceUrl.resolved(QUrl(url)).toEncoded(); + WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage())); +} + +void LayoutTestController::queueReload() +{ + //qDebug() << ">>>queueReload"; + WorkQueue::shared()->queue(new ReloadItem(m_drt->webPage())); +} + +void LayoutTestController::queueScript(const QString &url) +{ + //qDebug() << ">>>queueScript" << url; + WorkQueue::shared()->queue(new ScriptItem(url, m_drt->webPage())); +} + +void LayoutTestController::provisionalLoad() +{ + QWebFrame* frame = qobject_cast<QWebFrame*>(sender()); + if (!m_topLoadingFrame && m_isLoading) + m_topLoadingFrame = frame; +} + +void LayoutTestController::timerEvent(QTimerEvent *ev) +{ + if (ev->timerId() == m_timeoutTimer.timerId()) { + //qDebug() << ">>>>>>>>>>>>> timeout"; + notifyDone(); + } else + QObject::timerEvent(ev); +} + +QString LayoutTestController::encodeHostName(const QString& host) +{ + QString encoded = QString::fromLatin1(QUrl::toAce(host + QLatin1String(".no"))); + encoded.truncate(encoded.length() - 3); // strip .no + return encoded; +} + +QString LayoutTestController::decodeHostName(const QString& host) +{ + QString decoded = QUrl::fromAce(host.toLatin1() + QByteArray(".no")); + decoded.truncate(decoded.length() - 3); + return decoded; +} + +void LayoutTestController::setJavaScriptProfilingEnabled(bool enable) +{ + m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + qt_drt_setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); +} + +void LayoutTestController::setFixedContentsSize(int width, int height) +{ + m_topLoadingFrame->page()->setPreferredContentsSize(QSize(width, height)); +} + +void LayoutTestController::setPrivateBrowsingEnabled(bool enable) +{ + m_drt->webPage()->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, enable); +} + +void LayoutTestController::setPopupBlockingEnabled(bool enable) +{ + m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !enable); +} + +void LayoutTestController::setPOSIXLocale(const QString& locale) +{ + QLocale qlocale(locale); + QLocale::setDefault(qlocale); +} + +bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(const QString& animationName, + double time, + const QString& elementId) +{ + QWebFrame* frame = m_drt->webPage()->mainFrame(); + Q_ASSERT(frame); + return qt_drt_pauseAnimation(frame, animationName, time, elementId); +} + +bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString& propertyName, + double time, + const QString& elementId) +{ + QWebFrame* frame = m_drt->webPage()->mainFrame(); + Q_ASSERT(frame); + return qt_drt_pauseTransitionOfProperty(frame, propertyName, time, elementId); +} + +unsigned LayoutTestController::numberOfActiveAnimations() const +{ + QWebFrame* frame = m_drt->webPage()->mainFrame(); + Q_ASSERT(frame); + return qt_drt_numberOfActiveAnimations(frame); +} + +void LayoutTestController::disableImageLoading() +{ + // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896 + // Also need to make sure image loading is re-enabled for each new test. +} + +void LayoutTestController::dispatchPendingLoadRequests() +{ + // FIXME: Implement for testing fix for 6727495 +} + +void LayoutTestController::setDatabaseQuota(int size) +{ + if (!m_topLoadingFrame) + return; + m_topLoadingFrame->securityOrigin().setDatabaseQuota(size); +} + +void LayoutTestController::clearAllDatabases() +{ + QWebDatabase::removeAllDatabases(); +} + +void LayoutTestController::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + qt_drt_whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +void LayoutTestController::waitForPolicyDelegate() +{ + m_waitForPolicy = true; + waitUntilDone(); +} + +void LayoutTestController::overridePreference(const QString& name, const QVariant& value) +{ + QWebSettings* settings = m_topLoadingFrame->page()->settings(); + + if (name == "WebKitJavaScriptEnabled") + settings->setAttribute(QWebSettings::JavascriptEnabled, value.toBool()); + else if (name == "WebKitTabToLinksPreferenceKey") + settings->setAttribute(QWebSettings::LinksIncludedInFocusChain, value.toBool()); + else if (name == "WebKitOfflineWebApplicationCacheEnabled") + settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, value.toBool()); + else if (name == "WebKitDefaultFontSize") + settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt()); +} diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h new file mode 100644 index 0000000..cab014c --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 LayoutTestControllerQt_h +#define LayoutTestControllerQt_h + +#include <QBasicTimer> +#include <QObject> +#include <QSize> +#include <QString> +#include <QtDebug> +#include <QTimer> +#include <QTimerEvent> +#include <QVariant> + +#include <qwebdatabase.h> +#include <qwebframe.h> +#include <qwebhistory.h> +#include <qwebpage.h> +#include <qwebsecurityorigin.h> + +class QWebFrame; +namespace WebCore { + class DumpRenderTree; +} +class LayoutTestController : public QObject { + Q_OBJECT +public: + LayoutTestController(WebCore::DumpRenderTree* drt); + + bool isLoading() const { return m_isLoading; } + void setLoading(bool loading) { m_isLoading = loading; } + + bool shouldDumpAsText() const { return m_textDump; } + bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; } + bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; } + bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; } + bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } + bool shouldWaitUntilDone() const { return m_waitForDone; } + bool canOpenWindows() const { return m_canOpenWindows; } + bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } + bool waitForPolicy() const { return m_waitForPolicy; } + + void reset(); + +protected: + void timerEvent(QTimerEvent*); + +signals: + void done(); + +public slots: + void maybeDump(bool ok); + void dumpAsText() { m_textDump = true; } + void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } + void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; } + void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; } + void setCanOpenWindows() { m_canOpenWindows = true; } + void waitUntilDone(); + QString counterValueForElementById(const QString& id); + void keepWebHistory(); + void notifyDone(); + void dumpBackForwardList() { m_dumpBackForwardList = true; } + void dumpEditingCallbacks(); + void dumpResourceLoadCallbacks(); + void queueBackNavigation(int howFarBackward); + void queueForwardNavigation(int howFarForward); + void queueLoad(const QString& url, const QString& target = QString()); + void queueReload(); + void queueScript(const QString& url); + void provisionalLoad(); + void setCloseRemainingWindowsWhenComplete(bool = false) {} + int windowCount(); + void display() {} + void clearBackForwardList(); + void dumpTitleChanges() { m_dumpTitleChanges = true; } + QString encodeHostName(const QString& host); + QString decodeHostName(const QString& host); + void dumpSelectionRect() const {} + void setJavaScriptProfilingEnabled(bool enable); + void setFixedContentsSize(int width, int height); + void setPrivateBrowsingEnabled(bool enable); + void setPopupBlockingEnabled(bool enable); + void setPOSIXLocale(const QString& locale); + + bool pauseAnimationAtTimeOnElementWithId(const QString& animationName, double time, const QString& elementId); + bool pauseTransitionAtTimeOnElementWithId(const QString& propertyName, double time, const QString& elementId); + unsigned numberOfActiveAnimations() const; + + void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); + + void dispatchPendingLoadRequests(); + void disableImageLoading(); + + void setDatabaseQuota(int size); + void clearAllDatabases(); + + void waitForPolicyDelegate(); + void overridePreference(const QString& name, const QVariant& value); + +private slots: + void processWork(); + +private: + bool m_isLoading; + bool m_textDump; + bool m_dumpBackForwardList; + bool m_dumpChildrenAsText; + bool m_canOpenWindows; + bool m_waitForDone; + bool m_dumpTitleChanges; + bool m_dumpDatabaseCallbacks; + bool m_dumpStatusCallbacks; + bool m_waitForPolicy; + + QBasicTimer m_timeoutTimer; + QWebFrame* m_topLoadingFrame; + WebCore::DumpRenderTree* m_drt; +}; + +#endif // LayoutTestControllerQt_h diff --git a/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp new file mode 100644 index 0000000..7b8f120 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "config.h" +#include "TextInputControllerQt.h" + +#include <QApplication> +#include <QKeyEvent> + +TextInputController::TextInputController(QWebPage* parent) + : QObject(parent) +{ +} + +void TextInputController::doCommand(const QString& command) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + int keycode = 0; + if (command == "moveBackwardAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Left; + } else if (command =="moveDown:") { + keycode = Qt::Key_Down; + } else if (command =="moveDownAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Down; + } else if (command =="moveForward:") { + keycode = Qt::Key_Right; + } else if (command =="moveForwardAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Right; + } else if (command =="moveLeft:") { + keycode = Qt::Key_Left; + } else if (command =="moveLeftAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Left; + } else if (command =="moveRight:") { + keycode = Qt::Key_Right; + } else if (command =="moveRightAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Right; + } else if (command =="moveToBeginningOfDocument:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Home; + } else if (command =="moveToBeginningOfLine:") { + keycode = Qt::Key_Home; +// } else if (command =="moveToBeginningOfParagraph:") { + } else if (command =="moveToEndOfDocument:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_End; + } else if (command =="moveToEndOfLine:") { + keycode = Qt::Key_End; +// } else if (command =="moveToEndOfParagraph:") { + } else if (command =="moveUp:") { + keycode = Qt::Key_Up; + } else if (command =="moveUpAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Up; + } else if (command =="moveWordBackward:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Up; + } else if (command =="moveWordBackwardAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Left; + } else if (command =="moveWordForward:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Right; + } else if (command =="moveWordForwardAndModifySelection:") { + modifiers |= Qt::ControlModifier; + modifiers |= Qt::ShiftModifier; + keycode = Qt::Key_Right; + } else if (command =="moveWordLeft:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Left; + } else if (command =="moveWordRight:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Left; + } else if (command =="moveWordRightAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Right; + } else if (command =="moveWordLeftAndModifySelection:") { + modifiers |= Qt::ShiftModifier; + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Left; + } else if (command =="pageDown:") { + keycode = Qt::Key_PageDown; + } else if (command =="pageUp:") { + keycode = Qt::Key_PageUp; + } else if (command == "deleteWordBackward:") { + modifiers |= Qt::ControlModifier; + keycode = Qt::Key_Backspace; + } else if (command == "deleteBackward:") { + keycode = Qt::Key_Backspace; + } else if (command == "deleteForward:") { + keycode = Qt::Key_Delete; + } + + QKeyEvent event(QEvent::KeyPress, keycode, modifiers); + QApplication::sendEvent(parent(), &event); + QKeyEvent event2(QEvent::KeyRelease, keycode, modifiers); + QApplication::sendEvent(parent(), &event2); +} diff --git a/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.h b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.h new file mode 100644 index 0000000..7c7433e --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/TextInputControllerQt.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 TextInputControllerQt_h +#define TextInputControllerQt_h + +#include <QList> +#include <QObject> +#include <QString> +#include "qwebpage.h" + +class TextInputController : public QObject { + Q_OBJECT +public: + TextInputController(QWebPage* parent); + +public slots: + void doCommand(const QString& command); +// void setMarkedText(const QString& str, int from, int length); +// bool hasMarkedText(); +// void unmarkText(); +// QList<int> markedRange(); +// QList<int> selectedRange(); +// void validAttributesForMarkedText(); +// void inserText(const QString&); +// void firstRectForCharacterRange(); +// void characterIndexForPoint(int, int); +// void substringFromRange(int, int); +// void conversationIdentifier(); +}; +#endif // TextInputControllerQt_h diff --git a/WebKitTools/DumpRenderTree/qt/WorkQueue.cpp b/WebKitTools/DumpRenderTree/qt/WorkQueue.cpp index ae24e0d..f8448e4 100644 --- a/WebKitTools/DumpRenderTree/qt/WorkQueue.cpp +++ b/WebKitTools/DumpRenderTree/qt/WorkQueue.cpp @@ -30,8 +30,6 @@ #include "config.h" #include "WorkQueue.h" -#include "WorkQueueItem.h" - static const unsigned queueLength = 1024; static WorkQueueItem* theQueue[queueLength]; diff --git a/WebKitTools/DumpRenderTree/qt/WorkQueue.h b/WebKitTools/DumpRenderTree/qt/WorkQueue.h index 8adbfcd..902ba0d 100644 --- a/WebKitTools/DumpRenderTree/qt/WorkQueue.h +++ b/WebKitTools/DumpRenderTree/qt/WorkQueue.h @@ -30,7 +30,7 @@ #ifndef WorkQueue_h #define WorkQueue_h -class WorkQueueItem; +#include "WorkQueueItem.h" class WorkQueue { public: diff --git a/WebKitTools/DumpRenderTree/qt/WorkQueueItem.h b/WebKitTools/DumpRenderTree/qt/WorkQueueItem.h index 0e10f62..9819ec0 100644 --- a/WebKitTools/DumpRenderTree/qt/WorkQueueItem.h +++ b/WebKitTools/DumpRenderTree/qt/WorkQueueItem.h @@ -30,8 +30,9 @@ #ifndef WorkQueueItem_h #define WorkQueueItem_h -#include <qstring.h> -#include <qpointer.h> +#include <QPointer> +#include <QString> +#include <qwebframe.h> #include <qwebpage.h> class WorkQueueItem { diff --git a/WebKitTools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/WebKitTools/DumpRenderTree/qt/WorkQueueItemQt.cpp new file mode 100644 index 0000000..807a6a4 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/WorkQueueItemQt.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "config.h" +#include "WorkQueueItem.h" + +QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame) +{ + if (frame->frameName() == frameName) + return frame; + + foreach (QWebFrame* childFrame, frame->childFrames()) + if (QWebFrame* f = findFrameNamed(frameName, childFrame)) + return f; + + return 0; +} + +bool LoadItem::invoke() const +{ + //qDebug() << ">>>LoadItem::invoke"; + Q_ASSERT(m_webPage); + + QWebFrame* frame = 0; + const QString t = target(); + if (t.isEmpty()) + frame = m_webPage->mainFrame(); + else + frame = findFrameNamed(t, m_webPage->mainFrame()); + + if (!frame) + return false; + + frame->load(url()); + return true; +} + +bool ReloadItem::invoke() const +{ + //qDebug() << ">>>ReloadItem::invoke"; + Q_ASSERT(m_webPage); + m_webPage->triggerAction(QWebPage::Reload); + return true; +} + +bool ScriptItem::invoke() const +{ + //qDebug() << ">>>ScriptItem::invoke"; + Q_ASSERT(m_webPage); + m_webPage->mainFrame()->evaluateJavaScript(script()); + return true; +} + +bool BackForwardItem::invoke() const +{ + //qDebug() << ">>>BackForwardItem::invoke"; + Q_ASSERT(m_webPage); + if (!m_howFar) + return false; + + if (m_howFar > 0) { + for (int i = 0; i != m_howFar; ++i) + m_webPage->triggerAction(QWebPage::Forward); + } else { + for (int i = 0; i != m_howFar; --i) + m_webPage->triggerAction(QWebPage::Back); + } + return true; +} diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp b/WebKitTools/DumpRenderTree/qt/jsobjects.cpp index b2d8528..e747aeb 100644 --- a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp +++ b/WebKitTools/DumpRenderTree/qt/jsobjects.cpp @@ -27,672 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <jsobjects.h> - -#include "DumpRenderTree.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" - -#include <qapplication.h> -#include <qevent.h> -#include <qtimer.h> -#include <qwebdatabase.h> -#include <qwebframe.h> -#include <qwebhistory.h> #include <qwebpage.h> -#include <qwebsecurityorigin.h> - -extern void qt_dump_editing_callbacks(bool b); -extern void qt_dump_resource_load_callbacks(bool b); -extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); -extern bool qt_drt_pauseAnimation(QWebFrame*, const QString &name, double time, const QString &elementId); -extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString &name, double time, const QString &elementId); -extern int qt_drt_numberOfActiveAnimations(QWebFrame*); - -QWebFrame* findFrameNamed(const QString &frameName, QWebFrame* frame) -{ - if (frame->frameName() == frameName) - return frame; - - foreach (QWebFrame *childFrame, frame->childFrames()) - if (QWebFrame *f = findFrameNamed(frameName, childFrame)) - return f; - - return 0; -} - -bool LoadItem::invoke() const -{ - //qDebug() << ">>>LoadItem::invoke"; - Q_ASSERT(m_webPage); - - QWebFrame* frame = 0; - const QString t = target(); - if (t.isEmpty()) - frame = m_webPage->mainFrame(); - else - frame = findFrameNamed(t, m_webPage->mainFrame()); - - if (!frame) - return false; - - frame->load(url()); - return true; -} - -bool ReloadItem::invoke() const -{ - //qDebug() << ">>>ReloadItem::invoke"; - Q_ASSERT(m_webPage); - m_webPage->triggerAction(QWebPage::Reload); - return true; -} - -bool ScriptItem::invoke() const -{ - //qDebug() << ">>>ScriptItem::invoke"; - Q_ASSERT(m_webPage); - m_webPage->mainFrame()->evaluateJavaScript(script()); - return true; -} - -bool BackForwardItem::invoke() const -{ - //qDebug() << ">>>BackForwardItem::invoke"; - Q_ASSERT(m_webPage); - if (!m_howFar) - return false; - - if (m_howFar > 0) { - for (int i = 0; i != m_howFar; ++i) - m_webPage->triggerAction(QWebPage::Forward); - } else { - for (int i = 0; i != m_howFar; --i) - m_webPage->triggerAction(QWebPage::Back); - } - return true; -} - -LayoutTestController::LayoutTestController(WebCore::DumpRenderTree *drt) - : QObject() - , m_drt(drt) -{ - reset(); -} - -void LayoutTestController::reset() -{ - m_isLoading = true; - m_textDump = false; - m_dumpBackForwardList = false; - m_dumpChildrenAsText = false; - m_canOpenWindows = false; - m_waitForDone = false; - m_dumpTitleChanges = false; - m_dumpDatabaseCallbacks = false; - m_dumpStatusCallbacks = false; - m_timeoutTimer.stop(); - m_topLoadingFrame = 0; - m_waitForPolicy = false; - qt_dump_editing_callbacks(false); - qt_dump_resource_load_callbacks(false); -} - -void LayoutTestController::processWork() -{ - qDebug() << ">>>processWork"; - - // if we didn't start a new load, then we finished all the commands, so we're ready to dump state - if (!WorkQueue::shared()->processWork() && !shouldWaitUntilDone()) { - emit done(); - m_isLoading = false; - } -} - -// Called on loadFinished on mainFrame. -void LayoutTestController::maybeDump(bool success) -{ - Q_ASSERT(sender() == m_topLoadingFrame); - - // as the function is called on loadFinished, the test might - // already have dumped and thus no longer be active, thus - // bail out here. - if (!m_isLoading) - return; - - m_topLoadingFrame = 0; - WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test - - if (!shouldWaitUntilDone()) { - if (WorkQueue::shared()->count()) - QTimer::singleShot(0, this, SLOT(processWork())); - else { - if (success) - emit done(); - m_isLoading = false; - } - } -} - -void LayoutTestController::waitUntilDone() -{ - //qDebug() << ">>>>waitForDone"; - m_waitForDone = true; - m_timeoutTimer.start(11000, this); -} - -void LayoutTestController::notifyDone() -{ - //qDebug() << ">>>>notifyDone"; - if (!m_timeoutTimer.isActive()) - return; - m_timeoutTimer.stop(); - emit done(); - m_isLoading = false; - m_waitForDone = false; - m_waitForPolicy = false; -} - -int LayoutTestController::windowCount() -{ - return m_drt->windowCount(); -} - -void LayoutTestController::clearBackForwardList() -{ - m_drt->webPage()->history()->clear(); -} - -void LayoutTestController::dumpEditingCallbacks() -{ - qDebug() << ">>>dumpEditingCallbacks"; - qt_dump_editing_callbacks(true); -} - -void LayoutTestController::dumpResourceLoadCallbacks() -{ - qt_dump_resource_load_callbacks(true); -} - -void LayoutTestController::queueBackNavigation(int howFarBackward) -{ - //qDebug() << ">>>queueBackNavigation" << howFarBackward; - WorkQueue::shared()->queue(new BackItem(howFarBackward, m_drt->webPage())); -} - -void LayoutTestController::queueForwardNavigation(int howFarForward) -{ - //qDebug() << ">>>queueForwardNavigation" << howFarForward; - WorkQueue::shared()->queue(new ForwardItem(howFarForward, m_drt->webPage())); -} - -void LayoutTestController::queueLoad(const QString &url, const QString &target) -{ - //qDebug() << ">>>queueLoad" << url << target; - QUrl mainResourceUrl = m_drt->webPage()->mainFrame()->url(); - QString absoluteUrl = mainResourceUrl.resolved(QUrl(url)).toEncoded(); - WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage())); -} - -void LayoutTestController::queueReload() -{ - //qDebug() << ">>>queueReload"; - WorkQueue::shared()->queue(new ReloadItem(m_drt->webPage())); -} - -void LayoutTestController::queueScript(const QString &url) -{ - //qDebug() << ">>>queueScript" << url; - WorkQueue::shared()->queue(new ScriptItem(url, m_drt->webPage())); -} - -void LayoutTestController::provisionalLoad() -{ - QWebFrame* frame = qobject_cast<QWebFrame*>(sender()); - if (!m_topLoadingFrame && m_isLoading) - m_topLoadingFrame = frame; -} - -void LayoutTestController::timerEvent(QTimerEvent *ev) -{ - if (ev->timerId() == m_timeoutTimer.timerId()) { - qDebug() << ">>>>>>>>>>>>> timeout"; - notifyDone(); - } else - QObject::timerEvent(ev); -} - -QString LayoutTestController::encodeHostName(const QString &host) -{ - QString encoded = QString::fromLatin1(QUrl::toAce(host + QLatin1String(".no"))); - encoded.truncate(encoded.length() - 3); // strip .no - return encoded; -} - -QString LayoutTestController::decodeHostName(const QString &host) -{ - QString decoded = QUrl::fromAce(host.toLatin1() + QByteArray(".no")); - decoded.truncate(decoded.length() - 3); - return decoded; -} - -void LayoutTestController::setJavaScriptProfilingEnabled(bool enable) -{ - m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - qt_drt_setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); -} - -void LayoutTestController::setFixedContentsSize(int width, int height) -{ - m_topLoadingFrame->page()->setFixedContentsSize(QSize(width, height)); -} - -void LayoutTestController::setPrivateBrowsingEnabled(bool enable) -{ - m_drt->webPage()->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, enable); -} - -void LayoutTestController::setPopupBlockingEnabled(bool enable) -{ - m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !enable); -} - -bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(const QString &animationName, - double time, - const QString &elementId) -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return qt_drt_pauseAnimation(frame, animationName, time, elementId); -} - -bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString &propertyName, - double time, - const QString &elementId) -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return qt_drt_pauseTransitionOfProperty(frame, propertyName, time, elementId); -} - -unsigned LayoutTestController::numberOfActiveAnimations() const -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return qt_drt_numberOfActiveAnimations(frame); -} - -void LayoutTestController::disableImageLoading() -{ - // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896 - // Also need to make sure image loading is re-enabled for each new test. -} - -void LayoutTestController::dispatchPendingLoadRequests() -{ - // FIXME: Implement for testing fix for 6727495 -} - -void LayoutTestController::setDatabaseQuota(int size) -{ - if (!m_topLoadingFrame) - return; - m_topLoadingFrame->securityOrigin().setDatabaseQuota(size); -} - -void LayoutTestController::clearAllDatabases() -{ - QWebDatabase::removeAllDatabases(); -} - -void LayoutTestController::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) -{ - QWebSecurityOrigin::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); -} - -void LayoutTestController::waitForPolicyDelegate() -{ - m_waitForPolicy = true; - waitUntilDone(); -} - -void LayoutTestController::overridePreference(const QString& name, const QVariant& value) -{ - QWebSettings* settings = m_topLoadingFrame->page()->settings(); - - if (name == "WebKitJavaScriptEnabled") - settings->setAttribute(QWebSettings::JavascriptEnabled, value.toBool()); - else if (name == "WebKitTabToLinksPreferenceKey") - settings->setAttribute(QWebSettings::LinksIncludedInFocusChain, value.toBool()); - else if (name == "WebKitOfflineWebApplicationCacheEnabled") - settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, value.toBool()); - else if (name == "WebKitDefaultFontSize") - settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt()); -} - -EventSender::EventSender(QWebPage *parent) - : QObject(parent) -{ - m_page = parent; -} - -void EventSender::mouseDown(int button) -{ - Qt::MouseButton mouseButton; - switch (button) { - case 0: - mouseButton = Qt::LeftButton; - break; - case 1: - mouseButton = Qt::MidButton; - break; - case 2: - mouseButton = Qt::RightButton; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button to be treated as the middle button - mouseButton = Qt::MidButton; - break; - default: - mouseButton = Qt::LeftButton; - break; - } - -// qDebug() << "EventSender::mouseDown" << frame; - QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, mouseButton, mouseButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::mouseUp(int button) -{ - Qt::MouseButton mouseButton; - switch (button) { - case 0: - mouseButton = Qt::LeftButton; - break; - case 1: - mouseButton = Qt::MidButton; - break; - case 2: - mouseButton = Qt::RightButton; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button to be treated as the middle button - mouseButton = Qt::MidButton; - break; - default: - mouseButton = Qt::LeftButton; - break; - } - -// qDebug() << "EventSender::mouseUp" << frame; - QMouseEvent event(QEvent::MouseButtonRelease, m_mousePos, mouseButton, mouseButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::mouseMoveTo(int x, int y) -{ -// qDebug() << "EventSender::mouseMoveTo" << x << y; - m_mousePos = QPoint(x, y); - QMouseEvent event(QEvent::MouseMove, m_mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::leapForward(int ms) -{ - m_timeLeap += ms; - qDebug() << "EventSender::leapForward" << ms; -} - -void EventSender::keyDown(const QString &string, const QStringList &modifiers) -{ - QString s = string; - Qt::KeyboardModifiers modifs = 0; - for (int i = 0; i < modifiers.size(); ++i) { - const QString &m = modifiers.at(i); - if (m == "ctrlKey") - modifs |= Qt::ControlModifier; - else if (m == "shiftKey") - modifs |= Qt::ShiftModifier; - else if (m == "altKey") - modifs |= Qt::AltModifier; - else if (m == "metaKey") - modifs |= Qt::MetaModifier; - } - int code = 0; - if (string.length() == 1) { - code = string.unicode()->unicode(); - qDebug() << ">>>>>>>>> keyDown" << code << (char)code; - // map special keycodes used by the tests to something that works for Qt/X11 - if (code == '\t') { - code = Qt::Key_Tab; - if (modifs == Qt::ShiftModifier) - code = Qt::Key_Backtab; - s = QString(); - } else if (code == 127) { - code = Qt::Key_Backspace; - if (modifs == Qt::AltModifier) - modifs = Qt::ControlModifier; - s = QString(); - } else if (code == 'o' && modifs == Qt::ControlModifier) { - s = QLatin1String("\n"); - code = '\n'; - modifs = 0; - } else if (code == 'y' && modifs == Qt::ControlModifier) { - s = QLatin1String("c"); - code = 'c'; - } else if (code == 'k' && modifs == Qt::ControlModifier) { - s = QLatin1String("x"); - code = 'x'; - } else if (code == 'a' && modifs == Qt::ControlModifier) { - s = QString(); - code = Qt::Key_Home; - modifs = 0; - } else if (code == 0xf702) { - s = QString(); - code = Qt::Key_Left; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_Home; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 0xf703) { - s = QString(); - code = Qt::Key_Right; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_End; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 0xf700) { - s = QString(); - code = Qt::Key_Up; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_PageUp; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 0xf701) { - s = QString(); - code = Qt::Key_Down; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_PageDown; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 'a' && modifs == Qt::ControlModifier) { - s = QString(); - code = Qt::Key_Home; - modifs = 0; - } else - code = string.unicode()->toUpper().unicode(); - } else { - qDebug() << ">>>>>>>>> keyDown" << string; - - if (string.startsWith(QLatin1Char('F')) && string.count() <= 3) { - s = s.mid(1); - int functionKey = s.toInt(); - Q_ASSERT(functionKey >= 1 && functionKey <= 35); - code = Qt::Key_F1 + (functionKey - 1); - // map special keycode strings used by the tests to something that works for Qt/X11 - } else if (string == QLatin1String("leftArrow")) { - s = QString(); - code = Qt::Key_Left; - } else if (string == QLatin1String("rightArrow")) { - s = QString(); - code = Qt::Key_Right; - } else if (string == QLatin1String("upArrow")) { - s = QString(); - code = Qt::Key_Up; - } else if (string == QLatin1String("downArrow")) { - s = QString(); - code = Qt::Key_Down; - } else if (string == QLatin1String("pageUp")) { - s = QString(); - code = Qt::Key_PageUp; - } else if (string == QLatin1String("pageDown")) { - s = QString(); - code = Qt::Key_PageDown; - } else if (string == QLatin1String("home")) { - s = QString(); - code = Qt::Key_Home; - } else if (string == QLatin1String("end")) { - s = QString(); - code = Qt::Key_End; - } else if (string == QLatin1String("delete")) { - s = QString(); - code = Qt::Key_Delete; - } - } - QKeyEvent event(QEvent::KeyPress, code, modifs, s); - QApplication::sendEvent(m_page, &event); - QKeyEvent event2(QEvent::KeyRelease, code, modifs, s); - QApplication::sendEvent(m_page, &event2); -} - -void EventSender::contextClick() -{ - QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); - QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event2); -} - -void EventSender::scheduleAsynchronousClick() -{ - QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonPress, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); - QApplication::postEvent(m_page, event); - QMouseEvent* event2 = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); - QApplication::postEvent(m_page, event2); -} - -QWebFrame* EventSender::frameUnderMouse() const -{ - QWebFrame* frame = m_page->mainFrame(); - -redo: - QList<QWebFrame*> children = frame->childFrames(); - for (int i = 0; i < children.size(); ++i) { - if (children.at(i)->geometry().contains(m_mousePos)) { - frame = children.at(i); - goto redo; - } - } - if (frame->geometry().contains(m_mousePos)) - return frame; - return 0; -} - - -TextInputController::TextInputController(QWebPage *parent) - : QObject(parent) -{ -} - -void TextInputController::doCommand(const QString &command) -{ - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - int keycode = 0; - if (command == "moveBackwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Left; - } else if (command =="moveDown:") { - keycode = Qt::Key_Down; - } else if (command =="moveDownAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Down; - } else if (command =="moveForward:") { - keycode = Qt::Key_Right; - } else if (command =="moveForwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if (command =="moveLeft:") { - keycode = Qt::Key_Left; - } else if (command =="moveLeftAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Left; - } else if (command =="moveRight:") { - keycode = Qt::Key_Right; - } else if (command =="moveRightAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if (command =="moveToBeginningOfDocument:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Home; - } else if (command =="moveToBeginningOfLine:") { - keycode = Qt::Key_Home; -// } else if (command =="moveToBeginningOfParagraph:") { - } else if (command =="moveToEndOfDocument:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_End; - } else if (command =="moveToEndOfLine:") { - keycode = Qt::Key_End; -// } else if (command =="moveToEndOfParagraph:") { - } else if (command =="moveUp:") { - keycode = Qt::Key_Up; - } else if (command =="moveUpAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Up; - } else if (command =="moveWordBackward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Up; - } else if (command =="moveWordBackwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if (command =="moveWordForward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Right; - } else if (command =="moveWordForwardAndModifySelection:") { - modifiers |= Qt::ControlModifier; - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if (command =="moveWordLeft:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if (command =="moveWordRight:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if (command =="moveWordRightAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Right; - } else if (command =="moveWordLeftAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if (command =="pageDown:") { - keycode = Qt::Key_PageDown; - } else if (command =="pageUp:") { - keycode = Qt::Key_PageUp; - } else if (command == "deleteWordBackward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Backspace; - } else if (command == "deleteBackward:") { - keycode = Qt::Key_Backspace; - } else if (command == "deleteForward:") { - keycode = Qt::Key_Delete; - } - QKeyEvent event(QEvent::KeyPress, keycode, modifiers); - QApplication::sendEvent(parent(), &event); - QKeyEvent event2(QEvent::KeyRelease, keycode, modifiers); - QApplication::sendEvent(parent(), &event2); -} GCController::GCController(QWebPage* parent) : QObject(parent) diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.h b/WebKitTools/DumpRenderTree/qt/jsobjects.h index c076bb9..3ee566b 100644 --- a/WebKitTools/DumpRenderTree/qt/jsobjects.h +++ b/WebKitTools/DumpRenderTree/qt/jsobjects.h @@ -29,156 +29,9 @@ #ifndef JSOBJECTS_H #define JSOBJECTS_H -#include <qobject.h> -#include <qdebug.h> -#include <qpoint.h> -#include <qstringlist.h> -#include <qsize.h> -#include <qbasictimer.h> - -class QWebFrame; -namespace WebCore { - class DumpRenderTree; -} -class LayoutTestController : public QObject -{ - Q_OBJECT -public: - LayoutTestController(WebCore::DumpRenderTree *drt); - - bool isLoading() const { return m_isLoading; } - void setLoading(bool loading) { m_isLoading = loading; } - - bool shouldDumpAsText() const { return m_textDump; } - bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; } - bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; } - bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; } - bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } - bool shouldWaitUntilDone() const { return m_waitForDone; } - bool canOpenWindows() const { return m_canOpenWindows; } - bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } - bool waitForPolicy() const { return m_waitForPolicy; } - - void reset(); - -protected: - void timerEvent(QTimerEvent *); - -signals: - void done(); - -public slots: - void maybeDump(bool ok); - void dumpAsText() { m_textDump = true; } - void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } - void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; } - void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; } - void setCanOpenWindows() { m_canOpenWindows = true; } - void waitUntilDone(); - void notifyDone(); - void dumpBackForwardList() { m_dumpBackForwardList = true; } - void dumpEditingCallbacks(); - void dumpResourceLoadCallbacks(); - void queueBackNavigation(int howFarBackward); - void queueForwardNavigation(int howFarForward); - void queueLoad(const QString &url, const QString &target = QString()); - void queueReload(); - void queueScript(const QString &url); - void provisionalLoad(); - void setCloseRemainingWindowsWhenComplete(bool=false) {} - int windowCount(); - void display() {} - void clearBackForwardList(); - void dumpTitleChanges() { m_dumpTitleChanges = true; } - QString encodeHostName(const QString &host); - QString decodeHostName(const QString &host); - void dumpSelectionRect() const {} - void setJavaScriptProfilingEnabled(bool enable); - void setFixedContentsSize(int width, int height); - void setPrivateBrowsingEnabled(bool enable); - void setPopupBlockingEnabled(bool enable); - - bool pauseAnimationAtTimeOnElementWithId(const QString &animationName, double time, const QString &elementId); - bool pauseTransitionAtTimeOnElementWithId(const QString &propertyName, double time, const QString &elementId); - unsigned numberOfActiveAnimations() const; - - void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); - - void dispatchPendingLoadRequests(); - void disableImageLoading(); - - void setDatabaseQuota(int size); - void clearAllDatabases(); - - void waitForPolicyDelegate(); - void overridePreference(const QString& name, const QVariant& value); - -private slots: - void processWork(); - -private: - bool m_isLoading; - bool m_textDump; - bool m_dumpBackForwardList; - bool m_dumpChildrenAsText; - bool m_canOpenWindows; - bool m_waitForDone; - bool m_dumpTitleChanges; - bool m_dumpDatabaseCallbacks; - bool m_dumpStatusCallbacks; - bool m_waitForPolicy; - - QBasicTimer m_timeoutTimer; - QWebFrame *m_topLoadingFrame; - WebCore::DumpRenderTree *m_drt; -}; +#include <QObject> class QWebPage; -class QWebFrame; - -class EventSender : public QObject -{ - Q_OBJECT -public: - EventSender(QWebPage *parent); - -public slots: - void mouseDown(int button = 0); - void mouseUp(int button = 0); - void mouseMoveTo(int x, int y); - void leapForward(int ms); - void keyDown(const QString &string, const QStringList &modifiers=QStringList()); - void clearKillRing() {} - void contextClick(); - void scheduleAsynchronousClick(); - -private: - QPoint m_mousePos; - QWebPage *m_page; - int m_timeLeap; - QWebFrame *frameUnderMouse() const; -}; - -class TextInputController : public QObject -{ - Q_OBJECT -public: - TextInputController(QWebPage *parent); - -public slots: - void doCommand(const QString &command); -// void setMarkedText(const QString &str, int from, int length); -// bool hasMarkedText(); -// void unmarkText(); -// QList<int> markedRange(); -// QList<int> selectedRange(); -// void validAttributesForMarkedText(); -// void inserText(const QString &); -// void firstRectForCharacterRange(); -// void characterIndexForPoint(int, int); -// void substringFromRange(int, int); -// void conversationIdentifier(); -}; class GCController : public QObject { diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index 7e013a7..d486d06 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -31,6 +31,7 @@ #include "EditingDelegate.h" #include "FrameLoadDelegate.h" +#include "HistoryDelegate.h" #include "LayoutTestController.h" #include "PixelDumpSupport.h" #include "PolicyDelegate.h" @@ -97,6 +98,7 @@ COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; COMPtr<UIDelegate> sharedUIDelegate; COMPtr<EditingDelegate> sharedEditingDelegate; COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate; +COMPtr<HistoryDelegate> sharedHistoryDelegate; IWebFrame* frame; HWND webViewWindow; @@ -199,7 +201,7 @@ static const wstring& fontsPath() return path; } -#ifdef DEBUG_WEBKIT_HAS_SUFFIX +#ifdef DEBUG_ALL #define WEBKITDLL TEXT("WebKit_debug.dll") #else #define WEBKITDLL TEXT("WebKit.dll") @@ -681,6 +683,11 @@ static bool shouldLogFrameLoadDelegates(const char* pathOrURL) return strstr(pathOrURL, "/loading/") || strstr(pathOrURL, "\\loading\\"); } +static bool shouldLogHistoryDelegates(const char* pathOrURL) +{ + return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\"); +} + static void resetDefaultsToConsistentValues(IWebPreferences* preferences) { #ifdef USE_MAC_FONTS @@ -737,7 +744,6 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); prefsPrivate->setDeveloperExtrasEnabled(FALSE); prefsPrivate->setExperimentalNotificationsEnabled(TRUE); - prefsPrivate->setExperimentalWebSocketsEnabled(FALSE); prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> prefsPrivate->setXSSAuditorEnabled(FALSE); prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); @@ -836,6 +842,17 @@ static void runTest(const string& testPathOrURL) if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) gLayoutTestController->setDumpFrameLoadCallbacks(true); + COMPtr<IWebView> webView; + if (SUCCEEDED(frame->webView(&webView))) { + COMPtr<IWebViewPrivate> viewPrivate; + if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) { + if (shouldLogHistoryDelegates(pathOrURL.c_str())) { + gLayoutTestController->setDumpHistoryDelegateCallbacks(true); + viewPrivate->setHistoryDelegate(sharedHistoryDelegate.get()); + } else + viewPrivate->setHistoryDelegate(0); + } + } COMPtr<IWebHistory> history; if (SUCCEEDED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) history->setOptionalSharedHistory(0); @@ -843,8 +860,7 @@ static void runTest(const string& testPathOrURL) resetWebViewToConsistentStateBeforeTesting(); prevTestBFItem = 0; - COMPtr<IWebView> webView; - if (SUCCEEDED(frame->webView(&webView))) { + if (webView) { COMPtr<IWebBackForwardList> bfList; if (SUCCEEDED(webView->backForwardList(&bfList))) bfList->currentItem(&prevTestBFItem); @@ -1095,9 +1111,11 @@ IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) #if USE(CFNETWORK) RetainPtr<CFURLCacheRef> sharedCFURLCache() { +#ifndef DEBUG_ALL + HMODULE module = GetModuleHandle(TEXT("CFNetwork.dll")); +#else HMODULE module = GetModuleHandle(TEXT("CFNetwork_debug.dll")); - if (!module) - module = GetModuleHandle(TEXT("CFNetwork.dll")); +#endif if (!module) return 0; @@ -1153,6 +1171,7 @@ int main(int argc, char* argv[]) sharedUIDelegate.adoptRef(new UIDelegate); sharedEditingDelegate.adoptRef(new EditingDelegate); sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate); + sharedHistoryDelegate.adoptRef(new HistoryDelegate); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> COMPtr<IWebPreferences> tmpPreferences; diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj index dea2467..ba3640c 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -185,7 +185,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ProjectDir)\..\cg";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_CONSOLE;DEBUG_WEBKIT_HAS_SUFFIX"
+ PreprocessorDefinitions="_CONSOLE"
DisableSpecificWarnings="4146"
ForcedIncludeFiles="DumpRenderTreePrefix.h"
/>
@@ -376,6 +376,77 @@ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CFNetwork.resources" "$(WebKitOutputDir)\bin\CFNetwork.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\dnssd.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
/>
</Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ProjectDir)\..\cg";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
+ PreprocessorDefinitions="_CONSOLE"
+ DisableSpecificWarnings="4146"
+ ForcedIncludeFiles="DumpRenderTreePrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib comsuppw.lib"
+ AdditionalLibraryDirectories=""
+ DelayLoadDLLs=""
+ SubSystem="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CFNetwork.resources" "$(WebKitOutputDir)\bin\CFNetwork.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\dnssd.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
@@ -456,6 +527,14 @@ >
</File>
<File
+ RelativePath=".\HistoryDelegate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\HistoryDelegate.h"
+ >
+ </File>
+ <File
RelativePath=".\PolicyDelegate.cpp"
>
</File>
@@ -555,6 +634,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\cairo\PixelDumpSupportCairo.h"
@@ -583,6 +670,14 @@ Name="VCCustomBuildTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\cg\PixelDumpSupportCG.cpp"
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp index 721b238..dd5bf9d 100644 --- a/WebKitTools/DumpRenderTree/win/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp @@ -194,7 +194,7 @@ static inline POINTL pointl(const POINT& point) return result; } -static void doMouseUp(MSG msg) +static void doMouseUp(MSG msg, HRESULT* oleDragAndDropReturnValue = 0) { COMPtr<IWebFramePrivate> framePrivate; if (SUCCEEDED(frame->QueryInterface(&framePrivate))) @@ -215,6 +215,8 @@ static void doMouseUp(MSG msg) didDragEnter = true; } HRESULT hr = draggingInfo->dropSource()->QueryContinueDrag(0, 0); + if (oleDragAndDropReturnValue) + *oleDragAndDropReturnValue = hr; webViewDropTarget->DragOver(0, pointl(screenPoint), &effect); if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) { DWORD effect = 0; @@ -314,7 +316,7 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function return JSValueMakeUndefined(context); } -void replaySavedEvents() +void replaySavedEvents(HRESULT* oleDragAndDropReturnValue) { replayingSavedEvents = true; @@ -326,7 +328,7 @@ void replaySavedEvents() case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: - doMouseUp(msg); + doMouseUp(msg, oleDragAndDropReturnValue); break; case WM_MOUSEMOVE: doMouseMove(msg); @@ -370,7 +372,7 @@ void replaySavedEvents() case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: - doMouseUp(msg); + doMouseUp(msg, oleDragAndDropReturnValue); break; case WM_MOUSEMOVE: doMouseMove(msg); diff --git a/WebKitTools/DumpRenderTree/win/EventSender.h b/WebKitTools/DumpRenderTree/win/EventSender.h index 9ae0aec..79d7dab 100644 --- a/WebKitTools/DumpRenderTree/win/EventSender.h +++ b/WebKitTools/DumpRenderTree/win/EventSender.h @@ -31,11 +31,12 @@ class DraggingInfo; +typedef long HRESULT; typedef const struct OpaqueJSContext* JSContextRef; typedef struct OpaqueJSValue* JSObjectRef; JSObjectRef makeEventSender(JSContextRef context); -void replaySavedEvents(); +void replaySavedEvents(HRESULT* oleDragAndDropReturnValue = 0); extern DraggingInfo* draggingInfo; diff --git a/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp b/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp new file mode 100644 index 0000000..8a41fac --- /dev/null +++ b/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2009 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 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 "config.h" +#include "HistoryDelegate.h" + +#include "DumpRenderTree.h" +#include "DumpRenderTreeWin.h" +#include "LayoutTestController.h" +#include <string> +#include <WebKit/WebKit.h> + +using std::wstring; + +static inline wstring wstringFromBSTR(BSTR str) +{ + return wstring(str, ::SysStringLen(str)); +} + +HistoryDelegate::HistoryDelegate() + : m_refCount(1) +{ +} + +HistoryDelegate::~HistoryDelegate() +{ +} + + // IUnknown +HRESULT HistoryDelegate::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = static_cast<IWebHistoryDelegate*>(this); + else if (IsEqualGUID(riid, IID_IWebHistoryDelegate)) + *ppvObject = static_cast<IWebHistoryDelegate*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG HistoryDelegate::AddRef(void) +{ + return ++m_refCount; +} + +ULONG HistoryDelegate::Release(void) +{ + ULONG newRef = --m_refCount; + if (!newRef) + delete(this); + + return newRef; +} + +// IWebHistoryDelegate +HRESULT HistoryDelegate::didNavigateWithNavigationData(IWebView* webView, IWebNavigationData* navigationData, IWebFrame* webFrame) +{ + if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) + return S_OK; + + BSTR urlBSTR; + if (FAILED(navigationData->url(&urlBSTR))) + return E_FAIL; + wstring url; + if (urlBSTR) + url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); + SysFreeString(urlBSTR); + + BSTR titleBSTR; + if (FAILED(navigationData->title(&titleBSTR))) + return E_FAIL; + wstring title; + if (titleBSTR) + title = wstringFromBSTR(titleBSTR); + SysFreeString(titleBSTR); + + COMPtr<IWebURLRequest> request; + if (FAILED(navigationData->originalRequest(&request))) + return E_FAIL; + + BSTR httpMethodBSTR; + if (FAILED(request->HTTPMethod(&httpMethodBSTR))) + return E_FAIL; + wstring httpMethod; + if (httpMethodBSTR) + httpMethod = wstringFromBSTR(httpMethodBSTR); + SysFreeString(httpMethodBSTR); + + COMPtr<IWebURLResponse> response; + if (FAILED(navigationData->response(&response))) + return E_FAIL; + + COMPtr<IWebHTTPURLResponse> httpResponse; + if (FAILED(response->QueryInterface(&httpResponse))) + return E_FAIL; + + int statusCode = 0; + if (FAILED(httpResponse->statusCode(&statusCode))) + return E_FAIL; + + BOOL hasSubstituteData; + if (FAILED(navigationData->hasSubstituteData(&hasSubstituteData))) + return E_FAIL; + + BSTR clientRedirectSourceBSTR; + if (FAILED(navigationData->clientRedirectSource(&clientRedirectSourceBSTR))) + return E_FAIL; + bool hasClientRedirect = clientRedirectSourceBSTR && SysStringLen(clientRedirectSourceBSTR); + wstring redirectSource; + if (clientRedirectSourceBSTR) + redirectSource = urlSuitableForTestResult(wstringFromBSTR(clientRedirectSourceBSTR)); + SysFreeString(clientRedirectSourceBSTR); + + bool wasFailure = hasSubstituteData || (httpResponse && statusCode >= 400); + + printf("WebView navigated to url \"%S\" with title \"%S\" with HTTP equivalent method \"%S\". The navigation was %s and was %s%S.\n", + url.c_str(), + title.c_str(), + httpMethod.c_str(), + wasFailure ? "a failure" : "successful", + hasClientRedirect ? "a client redirect from " : "not a client redirect", + redirectSource.c_str()); + + return S_OK; +} + +HRESULT HistoryDelegate::didPerformClientRedirectFromURL(IWebView*, BSTR sourceURL, BSTR destinationURL, IWebFrame*) +{ + if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) + return S_OK; + + wstring source; + if (sourceURL) + source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); + + wstring destination; + if (destinationURL) + destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); + + printf("WebView performed a client redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); + return S_OK; +} + +HRESULT HistoryDelegate::didPerformServerRedirectFromURL(IWebView* webView, BSTR sourceURL, BSTR destinationURL, IWebFrame* webFrame) +{ + if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) + return S_OK; + + wstring source; + if (sourceURL) + source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); + + wstring destination; + if (destinationURL) + destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); + + printf("WebView performed a server redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); + return S_OK; +} + +HRESULT HistoryDelegate::updateHistoryTitle(IWebView* webView, BSTR titleBSTR, BSTR urlBSTR) +{ + if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) + return S_OK; + + wstring url; + if (urlBSTR) + url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); + + wstring title; + if (titleBSTR) + title = wstringFromBSTR(titleBSTR); + + printf("WebView updated the title for history URL \"%S\" to \"%S\".\n", url.c_str(), title.c_str()); + return S_OK; +} + +HRESULT HistoryDelegate::populateVisitedLinksForWebView(IWebView* webView) +{ + if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) + return S_OK; + + BSTR urlBSTR; + if (FAILED(webView->mainFrameURL(&urlBSTR))) + return E_FAIL; + + wstring url; + if (urlBSTR) + url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); + SysFreeString(urlBSTR); + + if (gLayoutTestController->dumpVisitedLinksCallback()) + printf("Asked to populate visited links for WebView \"%S\"\n", url.c_str()); + + return S_OK; +} diff --git a/WebKitTools/DumpRenderTree/win/HistoryDelegate.h b/WebKitTools/DumpRenderTree/win/HistoryDelegate.h new file mode 100644 index 0000000..41be670 --- /dev/null +++ b/WebKitTools/DumpRenderTree/win/HistoryDelegate.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2009 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 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 HistoryDelegate_h +#define HistoryDelegate_h + +#include <WebKit/WebKit.h> +#include <wtf/OwnPtr.h> + +class HistoryDelegate : public IWebHistoryDelegate { +public: + HistoryDelegate(); + virtual ~HistoryDelegate(); + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + // IWebHistoryDelegate + virtual HRESULT STDMETHODCALLTYPE didNavigateWithNavigationData( + /* [in] */ IWebView* webView, + /* [in] */ IWebNavigationData* navigationData, + /* [in] */ IWebFrame* webFrame); + + virtual HRESULT STDMETHODCALLTYPE didPerformClientRedirectFromURL( + /* [in] */ IWebView* webView, + /* [in] */ BSTR sourceURL, + /* [in] */ BSTR destinationURL, + /* [in] */ IWebFrame* webFrame); + + virtual HRESULT STDMETHODCALLTYPE didPerformServerRedirectFromURL( + /* [in] */ IWebView* webView, + /* [in] */ BSTR sourceURL, + /* [in] */ BSTR destinationURL, + /* [in] */ IWebFrame* webFrame); + + virtual HRESULT STDMETHODCALLTYPE updateHistoryTitle( + /* [in] */ IWebView* webView, + /* [in] */ BSTR title, + /* [in] */ BSTR url); + + virtual HRESULT STDMETHODCALLTYPE populateVisitedLinksForWebView( + /* [in] */ IWebView* webView); + +private: + ULONG m_refCount; +}; + +#endif // HistoryDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj index 37bddeb..d9f5225 100644 --- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj +++ b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj @@ -216,6 +216,73 @@ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
/>
</Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_all.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalLibraryDirectories=""
+ SubSystem="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index cf3ac85..d3cac7a 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -876,34 +876,68 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source) void LayoutTestController::showWebInspector() { - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebPreferences> preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); + if (!prefsPrivate) + return; + + prefsPrivate->setDeveloperExtrasEnabled(true); + + COMPtr<IWebViewPrivate> viewPrivate(Query, webView); + if (!viewPrivate) return; COMPtr<IWebInspector> inspector; - if (SUCCEEDED(webView->inspector(&inspector))) + if (SUCCEEDED(viewPrivate->inspector(&inspector))) inspector->show(); } void LayoutTestController::closeWebInspector() { - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> viewPrivate(Query, webView); + if (!viewPrivate) return; COMPtr<IWebInspector> inspector; - if (SUCCEEDED(webView->inspector(&inspector))) - inspector->close(); + if (FAILED(viewPrivate->inspector(&inspector))) + return; + + inspector->close(); + + COMPtr<IWebPreferences> preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); + if (!prefsPrivate) + return; + + prefsPrivate->setDeveloperExtrasEnabled(false); } void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) { - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> viewPrivate(Query, webView); + if (!viewPrivate) return; COMPtr<IWebInspector> inspector; - if (FAILED(webView->inspector(&inspector))) + if (FAILED(viewPrivate->inspector(&inspector))) return; COMPtr<IWebInspectorPrivate> inspectorPrivate(Query, inspector); @@ -912,3 +946,52 @@ void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef scrip inspectorPrivate->evaluateInFrontend(callId, bstrT(script).GetBSTR()); } + +void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script) +{ + COMPtr<IWebFramePrivate> framePrivate(Query, frame); + if (!framePrivate) + return; + + BSTR result; + if (FAILED(framePrivate->stringByEvaluatingJavaScriptInIsolatedWorld(worldId, reinterpret_cast<OLE_HANDLE>(globalObject), bstrT(script).GetBSTR(), &result))) + return; + SysFreeString(result); +} + +void LayoutTestController::removeAllVisitedLinks() +{ + COMPtr<IWebHistory> history; + if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) + return; + + COMPtr<IWebHistory> sharedHistory; + if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) + return; + + COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; + if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) + return; + + sharedHistoryPrivate->removeAllVisitedLinks(); +} + +JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) +{ + COMPtr<IWebFramePrivate> framePrivate(Query, frame); + if (!framePrivate) + return 0; + + wstring idWstring = jsStringRefToWString(id); + BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); + BSTR counterValueBSTR; + if (FAILED(framePrivate->counterValueForElementById(idBSTR, &counterValueBSTR))) + return 0; + + wstring counterValue(counterValueBSTR, SysStringLen(counterValueBSTR)); + SysFreeString(idBSTR); + SysFreeString(counterValueBSTR); + JSRetainPtr<JSStringRef> counterValueJS(Adopt, JSStringCreateWithCharacters(counterValue.data(), counterValue.length())); + return counterValueJS; +} + diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc index cccc69c..a8fbbcd 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc @@ -7,7 +7,7 @@ //
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -34,7 +34,7 @@ END 2 TEXTINCLUDE
BEGIN
- "#include ""afxres.h""\r\n"
+ "#include ""windows.h""\r\n"
"\0"
END
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj index 0e0918d..b1f2073 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj @@ -157,7 +157,7 @@ <Configuration
Name="Debug_Internal|Win32"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
CharacterSet="1"
>
<Tool
@@ -293,6 +293,76 @@ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
/>
</Configuration>
+ <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"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
+ PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
+ RuntimeLibrary="3"
+ DisableSpecificWarnings="4819"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
+ ModuleDefinitionFile="TestNetscapePlugin$(WebKitConfigSuffix).def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
+ />
+ </Configuration>
</Configurations>
<References>
</References>
diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp index b78fd3e..16724d7 100755 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp @@ -502,13 +502,14 @@ HRESULT STDMETHODCALLTYPE UIDelegate::doDragDrop( *performedEffect = 0; draggingInfo = new DraggingInfo(object, source); - replaySavedEvents(); + HRESULT oleDragAndDropReturnValue = DRAGDROP_S_CANCEL; + replaySavedEvents(&oleDragAndDropReturnValue); if (draggingInfo) { *performedEffect = draggingInfo->performedDropEffect(); delete draggingInfo; draggingInfo = 0; } - return S_OK; + return oleDragAndDropReturnValue; } HRESULT STDMETHODCALLTYPE UIDelegate::webViewGetDlgCode( diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index bfe1d99..72f85ae 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -313,3 +313,8 @@ void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef scrip { // FIXME: Implement this. } + +void LayoutTestController::removeAllVisitedLinks() +{ + // FIXME: Implement this. +} |