diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk')
5 files changed, 212 insertions, 61 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp index df06cea..12653fc 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * Copyright (C) 2009 Jan Michael Alonzo * * Redistribution and use in source and binary forms, with or without @@ -73,3 +73,15 @@ void AccessibilityController::setLogFocusEvents(bool) void AccessibilityController::setLogScrollingStartEvents(bool) { } + +void AccessibilityController::setLogValueChangeEvents(bool) +{ +} + +void AccessibilityController::addNotificationListener(PlatformUIElement, JSObjectRef) +{ +} + +void AccessibilityController::notificationReceived(PlatformUIElement, const std::string&) +{ +} diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index 13d313d..abfe115 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -102,6 +102,12 @@ AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) return 0; } +unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) +{ + // FIXME: implement + return 0; +} + JSStringRef AccessibilityUIElement::allAttributes() { // FIXME: implement @@ -249,7 +255,7 @@ JSStringRef AccessibilityUIElement::orientation() const return 0; } -double AccessibilityUIElement::intValue() +double AccessibilityUIElement::intValue() const { GValue value = { 0, { { 0 } } }; @@ -359,6 +365,11 @@ bool AccessibilityUIElement::isExpanded() const return false; } +bool AccessibilityUIElement::isChecked() const +{ + return intValue(); +} + JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() { // FIXME: implement @@ -448,12 +459,18 @@ void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned le // FIXME: implement } -JSStringRef AccessibilityUIElement::attributeValue(JSStringRef attribute) +JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) { // FIXME: implement return JSStringCreateWithCharacters(0, 0); } +bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) +{ + // FIXME: implement + return false; +} + bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) { // FIXME: implement @@ -528,3 +545,71 @@ JSStringRef AccessibilityUIElement::documentURI() return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI")); } + +JSStringRef AccessibilityUIElement::url() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isSelectable() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isMultiSelectable() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isVisible() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isOffScreen() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isCollapsed() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::hasPopup() const +{ + // FIXME: implement + return false; +} + +void AccessibilityUIElement::takeFocus() +{ + // FIXME: implement +} + +void AccessibilityUIElement::takeSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::addSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::removeSelection() +{ + // FIXME: implement +} diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index fd1e3c6..39430cf 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -333,6 +333,8 @@ static void resetDefaultsToConsistentValues() "default-font-size", 16, "default-monospace-font-size", 13, "minimum-font-size", 1, + "enable-caret-browsing", FALSE, + "enable-page-cache", FALSE, NULL); webkit_web_frame_clear_main_frame_name(mainFrame); @@ -340,6 +342,8 @@ static void resetDefaultsToConsistentValues() WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL); + webkit_web_view_set_zoom_level(webView, 1.0); + webkit_reset_origin_access_white_lists(); setlocale(LC_ALL, ""); @@ -780,6 +784,11 @@ static WebKitWebView* createWebView() "signal::close-window", webInspectorCloseWindow, 0, NULL); + if (webView) { + WebKitWebSettings* settings = webkit_web_view_get_settings(webView); + webkit_web_view_set_settings(view, settings); + } + return view; } diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index 6268b5b..458e0ba 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -76,6 +76,14 @@ static unsigned startOfQueue; static const float zoomMultiplierRatio = 1.2f; +// Key event location code defined in DOM Level 3. +enum KeyLocationCode { + DOM_KEY_LOCATION_STANDARD = 0x00, + DOM_KEY_LOCATION_LEFT = 0x01, + DOM_KEY_LOCATION_RIGHT = 0x02, + DOM_KEY_LOCATION_NUMPAD = 0x03 +}; + static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { return JSValueMakeBoolean(context, dragMode); @@ -120,10 +128,10 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio return JSValueMakeUndefined(context); } -static void updateClickCount(int /* button */) +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 || currentEventButton != button) clickCount = 1; else clickCount++; @@ -180,7 +188,7 @@ static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, event.button.x_root = x_root; event.button.y_root = y_root; - updateClickCount(1); + updateClickCount(event.button.button); if (!msgQueue[endOfQueue].delay) { webkit_web_frame_layout(mainFrame); @@ -449,66 +457,93 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS } } + // handle location argument. + int location = DOM_KEY_LOCATION_STANDARD; + if (argumentCount > 2) + location = (int)JSValueToNumber(context, arguments[2], exception); + 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') + int gdkKeySym = GDK_VoidSymbol; + if (location == DOM_KEY_LOCATION_NUMPAD) { + if (JSStringIsEqualToUTF8CString(character, "leftArrow")) + gdkKeySym = GDK_KP_Left; + else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) + gdkKeySym = GDK_KP_Right; + else if (JSStringIsEqualToUTF8CString(character, "upArrow")) + gdkKeySym = GDK_KP_Up; + else if (JSStringIsEqualToUTF8CString(character, "downArrow")) + gdkKeySym = GDK_KP_Down; + else if (JSStringIsEqualToUTF8CString(character, "pageUp")) + gdkKeySym = GDK_KP_Page_Up; + else if (JSStringIsEqualToUTF8CString(character, "pageDown")) + gdkKeySym = GDK_KP_Page_Down; + else if (JSStringIsEqualToUTF8CString(character, "home")) + gdkKeySym = GDK_KP_Home; + else if (JSStringIsEqualToUTF8CString(character, "end")) + gdkKeySym = GDK_KP_End; + else + // Assume we only get arrow/pgUp/pgDn/home/end keys with + // location=NUMPAD for now. + g_assert_not_reached(); + } else { + 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 { - gdkKeySym = gdk_unicode_to_keyval(charCode); - if (WTF::isASCIIUpper(charCode)) - state |= GDK_SHIFT_MASK; + 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); diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 6e94c1c..a74f7ad 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -68,6 +68,8 @@ static gchar* copyWebSettingKey(gchar* preferenceKey) 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")); + g_hash_table_insert(keyTable, g_strdup("WebKitEnableCaretBrowsing"), g_strdup("enable-caret-browsing")); + g_hash_table_insert(keyTable, g_strdup("WebKitUsesPageCachePreferenceKey"), g_strdup("enable-page-cache")); } return g_strdup(static_cast<gchar*>(g_hash_table_lookup(keyTable, preferenceKey))); @@ -424,6 +426,11 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota) webkit_security_origin_set_web_database_quota(origin, quota); } +void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef) +{ + // FIXME: implement +} + void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) { webkit_application_cache_set_maximum_size(size); @@ -489,9 +496,12 @@ void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value 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)) { + char* lowered = g_utf8_strdown(strValue, -1); g_object_set(G_OBJECT(settings), webSettingKey, - g_str_equal(g_utf8_strdown(strValue, -1), "true"), + g_str_equal(lowered, "true") + || g_str_equal(strValue, "1"), NULL); + g_free(lowered); } else if (G_VALUE_HOLDS_INT(&propValue)) { std::string str(strValue); std::stringstream ss(str); |