diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Tools/DumpRenderTree/gtk | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Tools/DumpRenderTree/gtk')
-rw-r--r-- | Tools/DumpRenderTree/gtk/DumpRenderTree.cpp | 34 | ||||
-rw-r--r-- | Tools/DumpRenderTree/gtk/EventSender.cpp | 26 | ||||
-rw-r--r-- | Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp | 18 |
3 files changed, 73 insertions, 5 deletions
diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index ff3327f..3f70b49 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -105,6 +105,11 @@ static bool shouldOpenWebInspector(const string& pathOrURL) return pathOrURL.find("inspector/") != string::npos; } +static bool shouldDumpAsText(const string& pathOrURL) +{ + return pathOrURL.find("dumpAsText/") != string::npos; +} + static bool shouldEnableDeveloperExtras(const string& pathOrURL) { return true; @@ -232,6 +237,13 @@ static void initializeFonts(const char* testURL = 0) if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(ahemFontFilename.get()))) g_error("Could not load font at %s!", ahemFontFilename.get()); + for (int i = 1; i <= 9; i++) { + GOwnPtr<gchar> fontFilename(g_strdup_printf("WebKitWeightWatcher%i00.ttf", i)); + GOwnPtr<gchar> fontPath(g_build_filename(FONTS_CONF_DIR, "..", "..", "fonts", fontFilename.get(), NULL)); + if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontPath.get()))) + g_error("Could not load font at %s!", fontPath.get()); + } + // A font with no valid Fontconfig encoding to test https://bugs.webkit.org/show_bug.cgi?id=47452 GOwnPtr<gchar> fontWithNoValidEncodingFilename(g_build_filename(FONTS_CONF_DIR, "FontWithNoValidEncoding.fon", NULL)); if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontWithNoValidEncodingFilename.get()))) @@ -428,6 +440,7 @@ static void resetDefaultsToConsistentValues() g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL); webkit_web_view_set_zoom_level(webView, 1.0); + DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, DumpRenderTreeSupportGtk::defaultMinimumTimerInterval()); DumpRenderTreeSupportGtk::resetOriginAccessWhiteLists(); @@ -446,9 +459,12 @@ static void resetDefaultsToConsistentValues() DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true); DumpRenderTreeSupportGtk::setIconDatabaseEnabled(false); + DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(false); if (axController) axController->resetToConsistentState(); + + DumpRenderTreeSupportGtk::clearOpener(mainFrame); } static bool useLongRunningServerMode(int argc, char *argv[]) @@ -504,7 +520,7 @@ void dump() gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame); if (g_str_equal(responseMimeType, "text/plain")) { - gLayoutTestController->setDumpAsText(true); + gLayoutTestController->setDumpAsText(true); gLayoutTestController->setGeneratePixelResults(false); } g_free(responseMimeType); @@ -630,6 +646,10 @@ static void runTest(const string& testPathOrURL) gLayoutTestController->setDeveloperExtrasEnabled(true); if (shouldOpenWebInspector(testURL)) gLayoutTestController->showWebInspector(); + if (shouldDumpAsText(testURL)) { + gLayoutTestController->setDumpAsText(true); + gLayoutTestController->setGeneratePixelResults(false); + } } WorkQueue::shared()->clear(); @@ -1004,6 +1024,17 @@ static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFram g_signal_connect(webFrame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL); } +static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource*, WebKitNetworkRequest* request, WebKitNetworkResponse*) +{ + SoupMessage* soupMessage = webkit_network_request_get_message(request); + + if (soupMessage) { + const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); + for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) + soup_message_headers_remove(soupMessage->request_headers, header->c_str()); + } +} + static WebKitWebView* createWebView() { WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); @@ -1032,6 +1063,7 @@ static WebKitWebView* createWebView() "signal::drag-end", dragEndCallback, 0, "signal::drag-failed", dragFailedCallback, 0, "signal::frame-created", frameCreatedCallback, 0, + "signal::resource-request-starting", willSendRequestCallback, 0, NULL); connectEditingCallbacks(view); diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp index 10e129c..068dd5a 100644 --- a/Tools/DumpRenderTree/gtk/EventSender.cpp +++ b/Tools/DumpRenderTree/gtk/EventSender.cpp @@ -229,6 +229,29 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio return valueRef; } +static gboolean sendClick(gpointer) +{ + GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS); + + if (!prepareMouseButtonEvent(pressEvent, 1, 0)) { + gdk_event_free(pressEvent); + return FALSE; + } + + GdkEvent* releaseEvent = gdk_event_copy(pressEvent); + dispatchEvent(pressEvent); + releaseEvent->type = GDK_BUTTON_RELEASE; + dispatchEvent(releaseEvent); + + return FALSE; +} + +static JSValueRef scheduleAsynchronousClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + g_idle_add(sendClick, 0); + return JSValueMakeUndefined(context); +} + static void updateClickCount(int button) { if (lastClickPositionX != lastMousePositionX @@ -644,6 +667,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS gdkKeySym = GDK_Delete; else if (JSStringIsEqualToUTF8CString(character, "printScreen")) gdkKeySym = GDK_Print; + else if (JSStringIsEqualToUTF8CString(character, "menu")) + gdkKeySym = GDK_Menu; else if (JSStringIsEqualToUTF8CString(character, "F1")) gdkKeySym = GDK_F1; else if (JSStringIsEqualToUTF8CString(character, "F2")) @@ -776,6 +801,7 @@ static JSStaticFunction staticFunctions[] = { { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 56d75f7..77d6ae1 100644 --- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -50,7 +50,6 @@ #include <wtf/gobject/GOwnPtr.h> extern "C" { -void webkit_application_cache_set_maximum_size(unsigned long long size); void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script); } @@ -333,6 +332,11 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path) setUserStyleSheetEnabled(true); } +void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) +{ + // FIXME: implement +} + void LayoutTestController::setViewModeMediaFeature(JSStringRef mode) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); @@ -508,7 +512,7 @@ void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) { - // FIXME: implement + DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(flag); } void LayoutTestController::setPopupBlockingEnabled(bool flag) @@ -869,14 +873,20 @@ bool LayoutTestController::hasSpellingMarker(int from, int length) return DumpRenderTreeSupportGtk::webkitWebFrameSelectionHasSpellingMarker(mainFrame, from, length); } -void LayoutTestController::dumpConfigurationForViewport(int availableWidth, int availableHeight) +void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) { WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); ASSERT(webView); - DumpRenderTreeSupportGtk::dumpConfigurationForViewport(webView, availableWidth, availableHeight); + DumpRenderTreeSupportGtk::dumpConfigurationForViewport(webView, deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight); } void LayoutTestController::setSerializeHTTPLoads(bool) { // FIXME: Implement if needed for https://bugs.webkit.org/show_bug.cgi?id=50758. } + +void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval) +{ + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, minimumTimerInterval); +} |