diff options
author | Steve Block <steveblock@google.com> | 2009-10-08 17:19:54 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-10-20 00:41:58 +0100 |
commit | 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch) | |
tree | a6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKitTools/DumpRenderTree/gtk | |
parent | e196732677050bd463301566a68a643b6d14b907 (diff) | |
download | external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2 |
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk')
8 files changed, 1146 insertions, 45 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp index ab92e1d..593f2eb 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp @@ -61,3 +61,11 @@ AccessibilityUIElement AccessibilityController::rootElement() AtkObject* axObject = gtk_widget_get_accessible(GTK_WIDGET(view)); return AccessibilityUIElement(axObject); } + +void AccessibilityController::setLogFocusEvents(bool) +{ +} + +void AccessibilityController::setLogScrollingStartEvents(bool) +{ +} diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index be1bbed..9aa31a8 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -67,9 +67,9 @@ void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& childre } } -void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length) +void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end) { - for (unsigned i = location; i < length; i++) { + for (unsigned i = start; i < end; i++) { AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i); elementVector.append(AccessibilityUIElement(child)); } @@ -94,7 +94,7 @@ AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) { Vector<AccessibilityUIElement> children; - getChildrenWithRange(children, index, 1); + getChildrenWithRange(children, index, index + 1); if (children.size() == 1) return children.at(0); @@ -156,6 +156,11 @@ JSStringRef AccessibilityUIElement::role() return JSStringCreateWithUTF8CString(atk_role_get_name(role)); } +JSStringRef AccessibilityUIElement::subrole() +{ + return 0; +} + JSStringRef AccessibilityUIElement::title() { const gchar* name = atk_object_get_name(ATK_OBJECT(m_element)); @@ -377,6 +382,12 @@ JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned l return JSStringCreateWithCharacters(0, 0); } +JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) { // FIXME: implement diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index ac82dd8..6ecd774 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -32,6 +32,7 @@ #include "DumpRenderTree.h" #include "AccessibilityController.h" +#include "EventSender.h" #include "GCController.h" #include "LayoutTestController.h" #include "WorkQueue.h" @@ -43,6 +44,10 @@ #include <wtf/Assertions.h> +#if PLATFORM(X11) +#include <fontconfig/fontconfig.h> +#endif + #include <cassert> #include <getopt.h> #include <stdlib.h> @@ -58,10 +63,12 @@ extern GList* webkit_web_history_item_get_children(WebKitWebHistoryItem*); extern GSList* webkit_web_frame_get_children(WebKitWebFrame* frame); extern gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame); extern gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame); +extern guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame); extern void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* view, const gchar* directory); extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); extern void webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame); extern void webkit_web_view_set_group_name(WebKitWebView* view, const gchar* groupName); +extern void webkit_reset_origin_access_white_lists(); } volatile bool done; @@ -73,6 +80,7 @@ AccessibilityController* axController = 0; LayoutTestController* gLayoutTestController = 0; static GCController* gcController = 0; static WebKitWebView* webView; +static GtkWidget* window; static GtkWidget* container; WebKitWebFrame* mainFrame = 0; WebKitWebFrame* topLoadingFrame = 0; @@ -122,6 +130,41 @@ static void appendString(gchar*& target, gchar* string) g_free(oldString); } +#if PLATFORM(X11) +static void initializeFonts() +{ + static int numFonts = -1; + + // Some tests may add or remove fonts via the @font-face rule. + // If that happens, font config should be re-created to suppress any unwanted change. + FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication); + if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts) + return; + + const char* fontDirEnv = g_getenv("WEBKIT_TESTFONTS"); + if (!fontDirEnv) + g_error("WEBKIT_TESTFONTS environment variable is not set, but it should point to the directory " + "containing the fonts you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"); + + GFile* fontDir = g_file_new_for_path(fontDirEnv); + if (!fontDir || !g_file_query_exists(fontDir, NULL)) + g_error("WEBKIT_TESTFONTS environment variable is not set correctly - it should point to the directory " + "containing the fonts you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"); + + FcConfig *config = FcConfigCreate(); + if (!FcConfigParseAndLoad (config, (FcChar8*) FONTS_CONF_FILE, true)) + g_error("Couldn't load font configuration file"); + if (!FcConfigAppFontAddDir (config, (FcChar8*) g_file_get_path(fontDir))) + g_error("Couldn't add font dir!"); + FcConfigSetCurrent(config); + + g_object_unref(fontDir); + + appFontSet = FcConfigGetFonts(config, FcSetApplication); + numFonts = appFontSet->nfont; +} +#endif + static gchar* dumpFramesAsText(WebKitWebFrame* frame) { gchar* result = 0; @@ -262,7 +305,7 @@ static void invalidateAnyPreviousWaitToDumpWatchdog() waitForPolicy = false; } -static void resetWebViewToConsistentStateBeforeTesting() +static void resetDefaultsToConsistentValues() { WebKitWebSettings* settings = webkit_web_view_get_settings(webView); g_object_set(G_OBJECT(settings), @@ -274,12 +317,25 @@ static void resetWebViewToConsistentStateBeforeTesting() "enable-xss-auditor", FALSE, "javascript-can-open-windows-automatically", TRUE, "enable-offline-web-application-cache", TRUE, + "enable-universal-access-from-file-uris", TRUE, + "enable-scripts", TRUE, + "default-font-family", "Times", + "monospace-font-family", "Courier", + "serif-font-family", "Times", + "sans-serif-font-family", "Helvetica", + "default-font-size", 16, + "default-monospace-font-size", 13, + "minimum-font-size", 1, NULL); webkit_web_frame_clear_main_frame_name(mainFrame); WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL); + + webkit_reset_origin_access_white_lists(); + + setlocale(LC_ALL, ""); } void dump() @@ -354,16 +410,7 @@ static void setDefaultsToConsistentStateValuesForTesting() { gdk_screen_set_resolution(gdk_screen_get_default(), 72.0); - WebKitWebSettings* settings = webkit_web_view_get_settings(webView); - g_object_set(G_OBJECT(settings), - "default-font-family", "Times", - "monospace-font-family", "Courier", - "serif-font-family", "Times", - "sans-serif-font-family", "Helvetica", - "default-font-size", 16, - "default-monospace-font-size", 13, - "minimum-font-size", 1, - NULL); + resetDefaultsToConsistentValues(); /* Disable the default auth dialog for testing */ SoupSession* session = webkit_get_default_session(); @@ -372,6 +419,10 @@ static void setDefaultsToConsistentStateValuesForTesting() #if PLATFORM(X11) webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR); #endif + + gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL); + webkit_set_web_database_directory_path(databaseDirectory); + g_free(databaseDirectory); } static void runTest(const string& testPathOrURL) @@ -391,7 +442,7 @@ static void runTest(const string& testPathOrURL) gchar* url = autocorrectURL(pathOrURL.c_str()); const string testURL(url); - resetWebViewToConsistentStateBeforeTesting(); + resetDefaultsToConsistentValues(); gLayoutTestController = new LayoutTestController(testURL, expectedPixelHash); topLoadingFrame = 0; @@ -407,8 +458,10 @@ static void runTest(const string& testPathOrURL) bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos); GtkAllocation size; + size.x = size.y = 0; size.width = isSVGW3CTest ? 480 : maxViewWidth; size.height = isSVGW3CTest ? 360 : maxViewHeight; + gtk_window_resize(GTK_WINDOW(window), size.width, size.height); gtk_widget_size_allocate(container, &size); if (prevTestBFItem) @@ -418,7 +471,12 @@ static void runTest(const string& testPathOrURL) if (prevTestBFItem) g_object_ref(prevTestBFItem); +#if PLATFORM(X11) + initializeFonts(); +#endif + // Focus the web view before loading the test to avoid focusing problems + gtk_widget_grab_focus(GTK_WIDGET(webView)); webkit_web_view_open(webView, url); g_free(url); @@ -462,8 +520,39 @@ static gboolean processWork(void* data) return FALSE; } +static char* getFrameNameSuitableForTestResult(WebKitWebView* view, WebKitWebFrame* frame) +{ + char* frameName = g_strdup(webkit_web_frame_get_name(frame)); + + if (frame == webkit_web_view_get_main_frame(view)) { + // This is a bit strange. Shouldn't web_frame_get_name return NULL? + if (frameName && (frameName[0] != '\0')) { + char* tmp = g_strdup_printf("main frame \"%s\"", frameName); + g_free (frameName); + frameName = tmp; + } else { + g_free(frameName); + frameName = g_strdup("main frame"); + } + } else if (!frameName || (frameName[0] == '\0')) { + g_free(frameName); + frameName = g_strdup("frame (anonymous)"); + } + + return frameName; +} + static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*) { + if (!done && !gLayoutTestController->dumpFrameLoadCallbacks()) { + guint pendingFrameUnloadEvents = webkit_web_frame_get_pending_unload_event_count(frame); + if (pendingFrameUnloadEvents) { + char* frameName = getFrameNameSuitableForTestResult(view, frame); + printf("%s - has %u onunload handler(s)\n", frameName, pendingFrameUnloadEvents); + g_free(frameName); + } + } + if (frame != topLoadingFrame) return; @@ -492,6 +581,10 @@ static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* fram axController->makeWindowObject(context, windowObject, &exception); ASSERT(!exception); + JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); + JSValueRef eventSender = makeEventSender(context); + JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); + JSStringRelease(eventSenderStr); } static gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId, gpointer data) @@ -593,6 +686,23 @@ static gboolean webViewClose(WebKitWebView* view) return TRUE; } +static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, WebKitWebDatabase *database) +{ + ASSERT(view); + ASSERT(frame); + ASSERT(database); + + WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin(database); + if (gLayoutTestController->dumpDatabaseCallbacks()) { + printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", + webkit_security_origin_get_protocol(origin), + webkit_security_origin_get_host(origin), + webkit_security_origin_get_port(origin), + webkit_web_database_get_name(database)); + } + webkit_security_origin_set_web_database_quota(origin, 5 * 1024 * 1024); +} + static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*); @@ -617,6 +727,7 @@ static WebKitWebView* createWebView() "signal::status-bar-text-changed", webViewStatusBarTextChanged, 0, "signal::create-web-view", webViewCreate, 0, "signal::close-web-view", webViewClose, 0, + "signal::database-quota-exceeded", databaseQuotaExceeded, 0, NULL); return view; @@ -641,6 +752,11 @@ int main(int argc, char* argv[]) g_thread_init(NULL); gtk_init(&argc, &argv); +#if PLATFORM(X11) + FcInit(); + initializeFonts(); +#endif + struct option options[] = { {"notree", no_argument, &dumpTree, false}, {"pixel-tests", no_argument, &dumpPixels, true}, @@ -657,11 +773,11 @@ int main(int argc, char* argv[]) break; } - GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); + window = gtk_window_new(GTK_WINDOW_POPUP); container = GTK_WIDGET(gtk_scrolled_window_new(NULL, NULL)); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(container), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(window), container); - gtk_widget_realize(window); + gtk_widget_show_all(window); webView = createWebView(); gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(webView)); @@ -699,7 +815,7 @@ int main(int argc, char* argv[]) delete axController; axController = 0; - g_object_unref(webView); + gtk_widget_destroy(window); return 0; } diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp new file mode 100644 index 0000000..c3c72c1 --- /dev/null +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -0,0 +1,545 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> + * Copyright (C) 2009 Holger Hans Peter Freyther + * + * 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 "EventSender.h" + +#include "DumpRenderTree.h" + +#include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSRetainPtr.h> +#include <JavaScriptCore/JSStringRef.h> +#include <webkit/webkitwebframe.h> +#include <webkit/webkitwebview.h> +#include <wtf/ASCIICType.h> +#include <wtf/Platform.h> + +#include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> +#include <string.h> + +// TODO: Currently drag and drop related code is left out and +// should be merged once we have drag and drop support in WebCore. + +extern "C" { + extern void webkit_web_frame_layout(WebKitWebFrame* frame); +} + +static bool down = false; +static bool dragMode = true; +static bool replayingSavedEvents = false; +static int lastMousePositionX; +static int lastMousePositionY; + +static int lastClickPositionX; +static int lastClickPositionY; +static int clickCount = 0; + +struct DelayedMessage { + GdkEvent event; + gulong delay; + gboolean isDragEvent; +}; + +static DelayedMessage msgQueue[1024]; + +static unsigned endOfQueue; +static unsigned startOfQueue; + +static const float zoomMultiplierRatio = 1.2f; + +static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + return JSValueMakeBoolean(context, dragMode); +} + +static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + dragMode = JSValueToBoolean(context, value); + return true; +} + +static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + // FIXME: Add proper support for forward leaps + return JSValueMakeUndefined(context); +} + +static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + webkit_web_frame_layout(mainFrame); + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + GdkEvent event; + memset(&event, 0, sizeof(event)); + event.button.button = 3; + event.button.x = lastMousePositionX; + event.button.y = lastMousePositionY; + event.button.window = GTK_WIDGET(view)->window; + + gboolean return_val; + down = true; + event.type = GDK_BUTTON_PRESS; + g_signal_emit_by_name(view, "button_press_event", &event, &return_val); + + down = false; + event.type = GDK_BUTTON_RELEASE; + g_signal_emit_by_name(view, "button_release_event", &event, &return_val); + + return JSValueMakeUndefined(context); +} + +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) + clickCount = 1; + else + clickCount++; +} + +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); + if (!view) + return JSValueMakeUndefined(context); + + down = true; + + GdkEvent event; + memset(&event, 0, sizeof(event)); + event.type = GDK_BUTTON_PRESS; + event.button.button = 1; + event.button.x = lastMousePositionX; + event.button.y = lastMousePositionY; + event.button.window = GTK_WIDGET(view)->window; + + updateClickCount(1); + + if (!msgQueue[endOfQueue].delay) { + webkit_web_frame_layout(mainFrame); + + gboolean return_val; + g_signal_emit_by_name(view, "button_press_event", &event, &return_val); + if (clickCount == 2) { + event.type = GDK_2BUTTON_PRESS; + g_signal_emit_by_name(view, "button_press_event", &event, &return_val); + } + } else { + // replaySavedEvents should have the required logic to make leapForward delays work + msgQueue[endOfQueue++].event = event; + replaySavedEvents(); + } + + return JSValueMakeUndefined(context); +} + +static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + down = false; + + GdkEvent event; + memset(&event, 0, sizeof(event)); + event.type = GDK_BUTTON_RELEASE; + event.button.button = 1; + event.button.x = lastMousePositionX; + event.button.y = lastMousePositionY; + event.button.window = GTK_WIDGET(view)->window; + + if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) { + msgQueue[endOfQueue].event = event; + msgQueue[endOfQueue++].isDragEvent = true; + replaySavedEvents(); + } else { + webkit_web_frame_layout(mainFrame); + + gboolean return_val; + g_signal_emit_by_name(view, "button_release_event", &event, &return_val); + } + + lastClickPositionX = lastMousePositionX; + lastClickPositionY = lastMousePositionY; + + return JSValueMakeUndefined(context); +} + +static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + if (argumentCount < 2) + return JSValueMakeUndefined(context); + + lastMousePositionX = (int)JSValueToNumber(context, arguments[0], exception); + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + lastMousePositionY = (int)JSValueToNumber(context, arguments[1], exception); + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + + GdkEvent 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; + + if (dragMode && down && !replayingSavedEvents) { + msgQueue[endOfQueue].event = event; + msgQueue[endOfQueue++].isDragEvent = true; + } else { + webkit_web_frame_layout(mainFrame); + + gboolean return_val; + g_signal_emit_by_name(view, "motion_notify_event", &event, &return_val); + } + + return JSValueMakeUndefined(context); +} + +static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + if (argumentCount < 2) + return JSValueMakeUndefined(context); + + int horizontal = (int)JSValueToNumber(context, arguments[0], exception); + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + int vertical = (int)JSValueToNumber(context, arguments[1], exception); + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + + // GTK+ doesn't support multiple direction scrolls in the same event! + g_return_val_if_fail((!vertical || !horizontal), JSValueMakeUndefined(context)); + + GdkEvent event; + event.type = GDK_SCROLL; + event.scroll.x = lastMousePositionX; + event.scroll.y = lastMousePositionY; + event.scroll.time = GDK_CURRENT_TIME; + event.scroll.window = GTK_WIDGET(view)->window; + + if (horizontal < 0) + event.scroll.direction = GDK_SCROLL_LEFT; + else if (horizontal > 0) + event.scroll.direction = GDK_SCROLL_RIGHT; + else if (vertical < 0) + event.scroll.direction = GDK_SCROLL_UP; + else if (vertical > 0) + event.scroll.direction = GDK_SCROLL_DOWN; + else + g_assert_not_reached(); + + if (dragMode && down && !replayingSavedEvents) { + msgQueue[endOfQueue].event = event; + msgQueue[endOfQueue++].isDragEvent = true; + } else { + webkit_web_frame_layout(mainFrame); + gtk_main_do_event(&event); + } + + return JSValueMakeUndefined(context); +} + +static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + // FIXME: Implement this completely once WebCore has complete drag and drop support + return JSValueMakeUndefined(context); +} + +void replaySavedEvents() +{ + // FIXME: This doesn't deal with forward leaps, but it should. + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return; + + replayingSavedEvents = true; + + for (unsigned queuePos = 0; queuePos < endOfQueue; queuePos++) { + GdkEvent event = msgQueue[queuePos].event; + gboolean return_val; + + switch (event.type) { + case GDK_BUTTON_RELEASE: + g_signal_emit_by_name(view, "button_release_event", &event, &return_val); + break; + case GDK_BUTTON_PRESS: + g_signal_emit_by_name(view, "button_press_event", &event, &return_val); + break; + case GDK_MOTION_NOTIFY: + g_signal_emit_by_name(view, "motion_notify_event", &event, &return_val); + break; + default: + continue; + } + + startOfQueue++; + } + + int numQueuedMessages = endOfQueue - startOfQueue; + if (!numQueuedMessages) { + startOfQueue = 0; + endOfQueue = 0; + replayingSavedEvents = false; + return; + } + + startOfQueue = 0; + endOfQueue = 0; + + replayingSavedEvents = false; +} + +static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); + + webkit_web_frame_layout(mainFrame); + + // handle modifier keys. + int state = 0; + if (argumentCount > 1) { + JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], exception); + if (modifiersArray) { + for (int i = 0; i < JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); ++i) { + JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0); + JSStringRef string = JSValueToStringCopy(context, value, 0); + if (JSStringIsEqualToUTF8CString(string, "ctrlKey")) + state |= GDK_CONTROL_MASK; + else if (JSStringIsEqualToUTF8CString(string, "shiftKey")) + state |= GDK_SHIFT_MASK; + else if (JSStringIsEqualToUTF8CString(string, "altKey")) + state |= GDK_MOD1_MASK; + + JSStringRelease(string); + } + } + } + + JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); + g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + int gdkKeySym; + if (JSStringIsEqualToUTF8CString(character, "leftArrow")) + gdkKeySym = GDK_Left; + else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) + gdkKeySym = GDK_Right; + else if (JSStringIsEqualToUTF8CString(character, "upArrow")) + gdkKeySym = GDK_Up; + else if (JSStringIsEqualToUTF8CString(character, "downArrow")) + gdkKeySym = GDK_Down; + else if (JSStringIsEqualToUTF8CString(character, "pageUp")) + gdkKeySym = GDK_Page_Up; + else if (JSStringIsEqualToUTF8CString(character, "pageDown")) + gdkKeySym = GDK_Page_Down; + else if (JSStringIsEqualToUTF8CString(character, "home")) + gdkKeySym = GDK_Home; + else if (JSStringIsEqualToUTF8CString(character, "end")) + gdkKeySym = GDK_End; + else if (JSStringIsEqualToUTF8CString(character, "delete")) + gdkKeySym = GDK_BackSpace; + else if (JSStringIsEqualToUTF8CString(character, "F1")) + gdkKeySym = GDK_F1; + else if (JSStringIsEqualToUTF8CString(character, "F2")) + gdkKeySym = GDK_F2; + else if (JSStringIsEqualToUTF8CString(character, "F3")) + gdkKeySym = GDK_F3; + else if (JSStringIsEqualToUTF8CString(character, "F4")) + gdkKeySym = GDK_F4; + else if (JSStringIsEqualToUTF8CString(character, "F5")) + gdkKeySym = GDK_F5; + else if (JSStringIsEqualToUTF8CString(character, "F6")) + gdkKeySym = GDK_F6; + else if (JSStringIsEqualToUTF8CString(character, "F7")) + gdkKeySym = GDK_F7; + else if (JSStringIsEqualToUTF8CString(character, "F8")) + gdkKeySym = GDK_F8; + else if (JSStringIsEqualToUTF8CString(character, "F9")) + gdkKeySym = GDK_F9; + else if (JSStringIsEqualToUTF8CString(character, "F10")) + gdkKeySym = GDK_F10; + else if (JSStringIsEqualToUTF8CString(character, "F11")) + gdkKeySym = GDK_F11; + else if (JSStringIsEqualToUTF8CString(character, "F12")) + gdkKeySym = GDK_F12; + else { + int charCode = JSStringGetCharactersPtr(character)[0]; + if (charCode == '\n' || charCode == '\r') + gdkKeySym = GDK_Return; + else if (charCode == '\t') + gdkKeySym = GDK_Tab; + else if (charCode == '\x8') + gdkKeySym = GDK_BackSpace; + else { + gdkKeySym = gdk_unicode_to_keyval(charCode); + if (WTF::isASCIIUpper(charCode)) + state |= GDK_SHIFT_MASK; + } + } + + JSStringRelease(character); + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + // create and send the event + GdkEvent event; + memset(&event, 0, sizeof(event)); + event.key.keyval = gdkKeySym; + event.key.state = state; + event.key.window = GTK_WIDGET(view)->window; + + gboolean return_val; + event.key.type = GDK_KEY_PRESS; + g_signal_emit_by_name(view, "key-press-event", &event.key, &return_val); + + event.key.type = GDK_KEY_RELEASE; + g_signal_emit_by_name(view, "key-release-event", &event.key, &return_val); + + return JSValueMakeUndefined(context); +} + +static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + gfloat currentZoom = webkit_web_view_get_zoom_level(view); + webkit_web_view_set_zoom_level(view, currentZoom * zoomMultiplierRatio); + + return JSValueMakeUndefined(context); +} + +static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + gfloat currentZoom = webkit_web_view_get_zoom_level(view); + webkit_web_view_set_zoom_level(view, currentZoom / zoomMultiplierRatio); + + return JSValueMakeUndefined(context); +} + +static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + webkit_web_view_zoom_in(view); + return JSValueMakeUndefined(context); +} + +static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + if (!view) + return JSValueMakeUndefined(context); + + webkit_web_view_zoom_out(view); + return JSValueMakeUndefined(context); +} + +static JSStaticFunction staticFunctions[] = { + { "mouseWheelTo", mouseWheelToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +static JSStaticValue staticValues[] = { + { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone }, + { 0, 0, 0, 0 } +}; + +static JSClassRef getClass(JSContextRef context) +{ + static JSClassRef eventSenderClass = 0; + + if (!eventSenderClass) { + JSClassDefinition classDefinition = { + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + classDefinition.staticFunctions = staticFunctions; + classDefinition.staticValues = staticValues; + + eventSenderClass = JSClassCreate(&classDefinition); + } + + return eventSenderClass; +} + +JSObjectRef makeEventSender(JSContextRef context) +{ + down = false; + dragMode = true; + lastMousePositionX = lastMousePositionY = 0; + lastClickPositionX = lastClickPositionY = 0; + + if (!replayingSavedEvents) { + // This function can be called in the middle of a test, even + // while replaying saved events. Resetting these while doing that + // can break things. + endOfQueue = 0; + startOfQueue = 0; + } + + return JSObjectMake(context, getClass(context), 0); +} diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.h b/WebKitTools/DumpRenderTree/gtk/EventSender.h new file mode 100644 index 0000000..272e8a9 --- /dev/null +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2009 Holger Hans Peter Freyther + * + * 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 EventSender_h +#define EventSender_h + +typedef const struct OpaqueJSContext* JSContextRef; +typedef struct OpaqueJSValue* JSObjectRef; + +JSObjectRef makeEventSender(JSContextRef context); +void replaySavedEvents(); + +#endif diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 009cb97..0b4a38f 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -38,6 +38,8 @@ #include <JavaScriptCore/JSRetainPtr.h> #include <JavaScriptCore/JSStringRef.h> +#include <iostream> +#include <sstream> #include <stdio.h> #include <glib.h> #include <libsoup/soup.h> @@ -48,6 +50,23 @@ bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element); 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); +} + +static gchar* copyWebSettingKey(gchar* preferenceKey) +{ + static GHashTable* keyTable; + + if (!keyTable) { + // If you add a pref here, make sure you reset the value in + // DumpRenderTree::resetWebViewToConsistentStateBeforeTesting. + keyTable = g_hash_table_new(g_str_hash, g_str_equal); + g_hash_table_insert(keyTable, g_strdup("WebKitJavaScriptEnabled"), g_strdup("enable-scripts")); + g_hash_table_insert(keyTable, g_strdup("WebKitDefaultFontSize"), g_strdup("default-font-size")); + } + + return g_strdup(static_cast<gchar*>(g_hash_table_lookup(keyTable, preferenceKey))); } LayoutTestController::~LayoutTestController() @@ -110,6 +129,11 @@ size_t LayoutTestController::webHistoryItemCount() return 0; } +unsigned LayoutTestController::workerThreadCount() const +{ + return webkit_worker_thread_count(); +} + void LayoutTestController::notifyDone() { if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) @@ -152,6 +176,11 @@ void LayoutTestController::setAcceptsEditing(bool acceptsEditing) webkit_web_view_set_editable(webView, acceptsEditing); } +void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies) +{ + // FIXME: Implement this (and restore the default value before running each test in DumpRenderTree.cpp). +} + void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive) { // FIXME: implement @@ -163,6 +192,17 @@ void LayoutTestController::waitForPolicyDelegate() setWaitToDump(true); } +void LayoutTestController::whiteListAccessFromOrigin(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) +{ + gchar* sourceOriginGChar = JSStringCopyUTF8CString(sourceOrigin); + gchar* protocolGChar = JSStringCopyUTF8CString(protocol); + gchar* hostGChar = JSStringCopyUTF8CString(host); + webkit_white_list_access_from_origin(sourceOriginGChar, protocolGChar, hostGChar, includeSubdomains); + g_free(sourceOriginGChar); + g_free(protocolGChar); + g_free(hostGChar); +} + void LayoutTestController::setMainFrameIsFirstResponder(bool flag) { // FIXME: implement @@ -213,17 +253,14 @@ void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) static gboolean waitToDumpWatchdogFired(void*) { - const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; - fprintf(stderr, "%s", message); - fprintf(stdout, "%s", message); waitToDumpWatchdog = 0; - dump(); + gLayoutTestController->waitToDumpWatchdogTimerFired(); return FALSE; } void LayoutTestController::setWaitToDump(bool waitUntilDone) { - static const int timeoutSeconds = 10; + static const int timeoutSeconds = 15; m_waitToDump = waitUntilDone; if (m_waitToDump && !waitToDumpWatchdog) @@ -265,6 +302,18 @@ void LayoutTestController::disableImageLoading() // Also need to make sure image loading is re-enabled for each new test. } +void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ + // FIXME: Implement for Geolocation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=28264. +} + +void LayoutTestController::setMockGeolocationError(int code, JSStringRef message) +{ + // FIXME: Implement for Geolocation layout tests. + // See https://bugs.webkit.org/show_bug.cgi?id=28264. +} + void LayoutTestController::setIconDatabaseEnabled(bool flag) { // FIXME: implement @@ -331,12 +380,13 @@ void LayoutTestController::clearPersistentUserStyleSheet() void LayoutTestController::clearAllDatabases() { - // FIXME: implement + webkit_remove_all_web_databases(); } void LayoutTestController::setDatabaseQuota(unsigned long long quota) -{ - // FIXME: implement +{ + WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(mainFrame); + webkit_security_origin_set_web_database_quota(origin, quota); } void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) @@ -348,17 +398,91 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima { gchar* name = JSStringCopyUTF8CString(animationName); gchar* element = JSStringCopyUTF8CString(elementId); - return webkit_web_frame_pause_animation(mainFrame, name, time, element); + bool returnValue = webkit_web_frame_pause_animation(mainFrame, name, time, element); + g_free(name); + g_free(element); + return returnValue; } bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) { gchar* name = JSStringCopyUTF8CString(propertyName); gchar* element = JSStringCopyUTF8CString(elementId); - return webkit_web_frame_pause_transition(mainFrame, name, time, element); + bool returnValue = webkit_web_frame_pause_transition(mainFrame, name, time, element); + g_free(name); + g_free(element); + return returnValue; } unsigned LayoutTestController::numberOfActiveAnimations() const { return webkit_web_frame_number_of_active_animations(mainFrame); } + +void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value) +{ + gchar* name = JSStringCopyUTF8CString(key); + gchar* strValue = JSStringCopyUTF8CString(value); + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + WebKitWebSettings* settings = webkit_web_view_get_settings(view); + gchar* webSettingKey = copyWebSettingKey(name); + + if (webSettingKey) { + GValue stringValue = { 0, { { 0 } } }; + g_value_init(&stringValue, G_TYPE_STRING); + g_value_set_string(&stringValue, const_cast<gchar*>(strValue)); + + WebKitWebSettingsClass* klass = WEBKIT_WEB_SETTINGS_GET_CLASS(settings); + GParamSpec* pspec = g_object_class_find_property(G_OBJECT_CLASS(klass), webSettingKey); + GValue propValue = { 0, { { 0 } } }; + g_value_init(&propValue, pspec->value_type); + + if (g_value_type_transformable(G_TYPE_STRING, pspec->value_type)) { + g_value_transform(const_cast<GValue*>(&stringValue), &propValue); + g_object_set_property(G_OBJECT(settings), webSettingKey, const_cast<GValue*>(&propValue)); + } else if (G_VALUE_HOLDS_BOOLEAN(&propValue)) { + g_object_set(G_OBJECT(settings), webSettingKey, + g_str_equal(g_utf8_strdown(strValue, -1), "true"), + NULL); + } else if (G_VALUE_HOLDS_INT(&propValue)) { + std::string str(strValue); + std::stringstream ss(str); + int val = 0; + if (!(ss >> val).fail()) + g_object_set(G_OBJECT(settings), webSettingKey, val, NULL); + } else + printf("LayoutTestController::overridePreference failed to override preference '%s'.\n", name); + } + + g_free(webSettingKey); + g_free(name); + g_free(strValue); +} + +void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart) +{ + printf("LayoutTestController::addUserScript not implemented.\n"); +} + +void LayoutTestController::addUserStyleSheet(JSStringRef source) +{ + printf("LayoutTestController::addUserStyleSheet not implemented.\n"); +} + +void LayoutTestController::showWebInspector() +{ + // FIXME: Implement this. +} + +void LayoutTestController::closeWebInspector() +{ + // FIXME: Implement this. +} + +void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) +{ + // FIXME: Implement this. +} diff --git a/WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp index b7d14eb..6c62a7c 100644 --- a/WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp +++ b/WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp @@ -46,13 +46,13 @@ extern "C" { } static NPError -webkit_test_plugin_new_instance(NPMIMEType mimetype, +webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/, NPP instance, - uint16_t mode, + uint16_t /*mode*/, int16_t argc, char *argn[], char *argv[], - NPSavedData *savedData) + NPSavedData* /*savedData*/) { if (browser->version >= 14) { PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); @@ -85,7 +85,7 @@ webkit_test_plugin_new_instance(NPMIMEType mimetype, } static NPError -webkit_test_plugin_destroy_instance(NPP instance, NPSavedData **save) +webkit_test_plugin_destroy_instance(NPP instance, NPSavedData** /*save*/) { PluginObject* obj = static_cast<PluginObject*>(instance->pdata); if (obj) { @@ -138,9 +138,9 @@ static void executeScript(const PluginObject* obj, const char* script) static NPError webkit_test_plugin_new_stream(NPP instance, - NPMIMEType type, + NPMIMEType /*type*/, NPStream *stream, - NPBool seekable, + NPBool /*seekable*/, uint16* stype) { PluginObject* obj = static_cast<PluginObject*>(instance->pdata); @@ -160,7 +160,7 @@ webkit_test_plugin_new_stream(NPP instance, } static NPError -webkit_test_plugin_destroy_stream(NPP instance, NPStream *stream, NPError reason) +webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError /*reason*/) { PluginObject* obj = (PluginObject*)instance->pdata; @@ -171,28 +171,28 @@ webkit_test_plugin_destroy_stream(NPP instance, NPStream *stream, NPError reason } static void -webkit_test_plugin_stream_as_file(NPP instance, NPStream *stream, const char* fname) +webkit_test_plugin_stream_as_file(NPP /*instance*/, NPStream* /*stream*/, const char* /*fname*/) { } static int32 -webkit_test_plugin_write_ready(NPP instance, NPStream *stream) +webkit_test_plugin_write_ready(NPP /*instance*/, NPStream* /*stream*/) { return 0; } static int32 -webkit_test_plugin_write(NPP instance, - NPStream *stream, - int32_t offset, - int32_t len, - void *buffer) +webkit_test_plugin_write(NPP /*instance*/, + NPStream* /*stream*/, + int32_t /*offset*/, + int32_t /*len*/, + void* /*buffer*/) { return 0; } static void -webkit_test_plugin_print(NPP instance, NPPrint* platformPrint) +webkit_test_plugin_print(NPP /*instance*/, NPPrint* /*platformPrint*/) { } @@ -258,7 +258,7 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value) } static NPError -webkit_test_plugin_set_value(NPP instance, NPNVariable variable, void *value) +webkit_test_plugin_set_value(NPP /*instance*/, NPNVariable /*variable*/, void* /*value*/) { return NPERR_NO_ERROR; } @@ -310,7 +310,7 @@ NP_Shutdown(void) } NPError -NP_GetValue(void *future, NPPVariable variable, void *value) +NP_GetValue(void* /*future*/, NPPVariable variable, void *value) { return webkit_test_plugin_get_value(NULL, variable, value); } diff --git a/WebKitTools/DumpRenderTree/gtk/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts.conf new file mode 100644 index 0000000..3540c47 --- /dev/null +++ b/WebKitTools/DumpRenderTree/gtk/fonts.conf @@ -0,0 +1,258 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<fontconfig> + +<!-- + Accept deprecated 'mono' alias, replacing it with 'monospace' +--> + <match target="pattern"> + <test qual="any" name="family"> + <string>mono</string> + </test> + <edit name="family" mode="assign"> + <string>monospace</string> + </edit> + </match> + +<!-- + Accept alternate 'sans serif' spelling, replacing it with 'sans-serif' +--> + <match target="pattern"> + <test qual="any" name="family"> + <string>sans serif</string> + </test> + <edit name="family" mode="assign"> + <string>sans-serif</string> + </edit> + </match> + +<!-- + Accept deprecated 'sans' alias, replacing it with 'sans-serif' +--> + <match target="pattern"> + <test qual="any" name="family"> + <string>sans</string> + </test> + <edit name="family" mode="assign"> + <string>sans-serif</string> + </edit> + </match> + + + <config> +<!-- + These are the default Unicode chars that are expected to be blank + in fonts. All other blank chars are assumed to be broken and + won't appear in the resulting charsets + --> + <blank> + <int>0x0020</int> <!-- SPACE --> + <int>0x00A0</int> <!-- NO-BREAK SPACE --> + <int>0x00AD</int> <!-- SOFT HYPHEN --> + <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER --> + <int>0x0600</int> <!-- ARABIC NUMBER SIGN --> + <int>0x0601</int> <!-- ARABIC SIGN SANAH --> + <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER --> + <int>0x0603</int> <!-- ARABIC SIGN SAFHA --> + <int>0x06DD</int> <!-- ARABIC END OF AYAH --> + <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK --> + <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER --> + <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER --> + <int>0x1680</int> <!-- OGHAM SPACE MARK --> + <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ --> + <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA --> + <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR --> + <int>0x2000</int> <!-- EN QUAD --> + <int>0x2001</int> <!-- EM QUAD --> + <int>0x2002</int> <!-- EN SPACE --> + <int>0x2003</int> <!-- EM SPACE --> + <int>0x2004</int> <!-- THREE-PER-EM SPACE --> + <int>0x2005</int> <!-- FOUR-PER-EM SPACE --> + <int>0x2006</int> <!-- SIX-PER-EM SPACE --> + <int>0x2007</int> <!-- FIGURE SPACE --> + <int>0x2008</int> <!-- PUNCTUATION SPACE --> + <int>0x2009</int> <!-- THIN SPACE --> + <int>0x200A</int> <!-- HAIR SPACE --> + <int>0x200B</int> <!-- ZERO WIDTH SPACE --> + <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER --> + <int>0x200D</int> <!-- ZERO WIDTH JOINER --> + <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK --> + <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK --> + <int>0x2028</int> <!-- LINE SEPARATOR --> + <int>0x2029</int> <!-- PARAGRAPH SEPARATOR --> + <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING --> + <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING --> + <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING --> + <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE --> + <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE --> + <int>0x202F</int> <!-- NARROW NO-BREAK SPACE --> + <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE --> + <int>0x2060</int> <!-- WORD JOINER --> + <int>0x2061</int> <!-- FUNCTION APPLICATION --> + <int>0x2062</int> <!-- INVISIBLE TIMES --> + <int>0x2063</int> <!-- INVISIBLE SEPARATOR --> + <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING --> + <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING --> + <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING --> + <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING --> + <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES --> + <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES --> + <int>0x3000</int> <!-- IDEOGRAPHIC SPACE --> + <int>0x3164</int> <!-- HANGUL FILLER --> + <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE --> + <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER --> + <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR --> + <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR --> + <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR --> + </blank> +<!-- + Rescan configuration every 30 seconds when FcFontSetList is called + --> + <rescan> + <int>30</int> + </rescan> + </config> + +<!-- + URW provides metric and shape compatible fonts for these 10 Adobe families. + + However, these fonts are quite ugly and do not render well on-screen, + so we avoid matching them if the application said `anymetrics'; in that + case, a more generic font with different metrics but better appearance + will be used. + --> + <match target="pattern"> + <test name="family"> + <string>Avant Garde</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>URW Gothic L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Bookman</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>URW Bookman L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Courier</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>Nimbus Mono L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Helvetica</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>Nimbus Sans L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>New Century Schoolbook</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>Century Schoolbook L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Palatino</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>URW Palladio L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Times</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>Nimbus Roman No9 L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Zapf Chancery</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>URW Chancery L</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Zapf Dingbats</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append"> + <string>Dingbats</string> + </edit> + </match> + <match target="pattern"> + <test name="family"> + <string>Symbol</string> + </test> + <test name="anymetrics" qual="all" compare="not_eq"> + <bool>true</bool> + </test> + <edit name="family" mode="append" binding="same"> + <string>Standard Symbols L</string> + </edit> + </match> + +<!-- + Serif faces + --> + <alias> + <family>Nimbus Roman No9 L</family> + <default><family>serif</family></default> + </alias> +<!-- + Sans-serif faces + --> + <alias> + <family>Nimbus Sans L</family> + <default><family>sans-serif</family></default> + </alias> +<!-- + Monospace faces + --> + <alias> + <family>Nimbus Mono L</family> + <default><family>monospace</family></default> + </alias> + + +</fontconfig> |