2009-08-08 Jan Michael Alonzo <jmalonzo@webkit.org>
authorjmalonzo@webkit.org <jmalonzo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Aug 2009 07:39:48 +0000 (07:39 +0000)
committerjmalonzo@webkit.org <jmalonzo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Aug 2009 07:39:48 +0000 (07:39 +0000)
        Reviewed by Xan Lopez.

        [Gtk] Enable accessibility in Gtk DRT
        https://bugs.webkit.org/show_bug.cgi?id=25989

        Add SPI to get the focused accessible element to be used by DRT.

        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
        (webkit_accessible_get_focused_element):
        * accessibility/gtk/AccessibilityObjectWrapperAtk.h:
        * webkit/webkitprivate.h:
        * webkit/webkitwebframe.cpp:
        (webkit_web_frame_get_focused_accessible_element):

        Remove passing accessibility tests from the Skipped list

        * platform/gtk/Skipped:

        Add Accessibility support to the GTK DRT.

        * DumpRenderTree/AccessibilityUIElement.h:
        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp: Added.
        (AccessibilityController::AccessibilityController):
        (AccessibilityController::~AccessibilityController):
        (AccessibilityController::focusedElement):
        (AccessibilityController::rootElement):
        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp: Added.
        (AccessibilityUIElement::AccessibilityUIElement):
        (AccessibilityUIElement::~AccessibilityUIElement):
        (AccessibilityUIElement::getLinkedUIElements):
        (AccessibilityUIElement::getDocumentLinks):
        (AccessibilityUIElement::getChildren):
        (AccessibilityUIElement::getChildrenWithRange):
        (AccessibilityUIElement::childrenCount):
        (AccessibilityUIElement::elementAtPoint):
        (AccessibilityUIElement::getChildAtIndex):
        (AccessibilityUIElement::allAttributes):
        (AccessibilityUIElement::attributesOfLinkedUIElements):
        (AccessibilityUIElement::attributesOfDocumentLinks):
        (AccessibilityUIElement::titleUIElement):
        (AccessibilityUIElement::parentElement):
        (AccessibilityUIElement::attributesOfChildren):
        (AccessibilityUIElement::parameterizedAttributeNames):
        (AccessibilityUIElement::role):
        (AccessibilityUIElement::title):
        (AccessibilityUIElement::description):
        (AccessibilityUIElement::language):
        (AccessibilityUIElement::x):
        (AccessibilityUIElement::y):
        (AccessibilityUIElement::width):
        (AccessibilityUIElement::height):
        (AccessibilityUIElement::clickPointX):
        (AccessibilityUIElement::clickPointY):
        (AccessibilityUIElement::intValue):
        (AccessibilityUIElement::minValue):
        (AccessibilityUIElement::maxValue):
        (AccessibilityUIElement::valueDescription):
        (AccessibilityUIElement::isEnabled):
        (AccessibilityUIElement::insertionPointLineNumber):
        (AccessibilityUIElement::isActionSupported):
        (AccessibilityUIElement::isRequired):
        (AccessibilityUIElement::attributesOfColumnHeaders):
        (AccessibilityUIElement::attributesOfRowHeaders):
        (AccessibilityUIElement::attributesOfColumns):
        (AccessibilityUIElement::attributesOfRows):
        (AccessibilityUIElement::attributesOfVisibleCells):
        (AccessibilityUIElement::attributesOfHeader):
        (AccessibilityUIElement::indexInTable):
        (AccessibilityUIElement::rowIndexRange):
        (AccessibilityUIElement::columnIndexRange):
        (AccessibilityUIElement::lineForIndex):
        (AccessibilityUIElement::boundsForRange):
        (AccessibilityUIElement::cellForColumnAndRow):
        (AccessibilityUIElement::selectedTextRange):
        (AccessibilityUIElement::setSelectedTextRange):
        (AccessibilityUIElement::attributeValue):
        (AccessibilityUIElement::isAttributeSettable):
        (AccessibilityUIElement::increment):
        (AccessibilityUIElement::decrement):
        * DumpRenderTree/gtk/DumpRenderTree.cpp:
        (webViewWindowObjectCleared):
        (main):
        * GNUmakefile.am:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/gtk/Skipped
WebCore/ChangeLog
WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h
WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitprivate.h
WebKit/gtk/webkit/webkitwebframe.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityUIElement.h
WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp [new file with mode: 0644]
WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp [new file with mode: 0644]
WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
WebKitTools/GNUmakefile.am

index adba3c6..1bea337 100644 (file)
@@ -1,3 +1,14 @@
+2009-08-08  Jan Michael Alonzo  <jmalonzo@webkit.org>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] Enable accessibility in Gtk DRT
+        https://bugs.webkit.org/show_bug.cgi?id=25989
+
+        Remove passing accessibility tests from the Skipped list
+
+        * platform/gtk/Skipped:
+
 2009-08-07  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Cameron Zwarich.
index 2bb4ac3..f6bd448 100644 (file)
@@ -72,20 +72,14 @@ accessibility/button-press-action.html
 accessibility/canvas.html
 accessibility/editable-webarea-context-menu-point.html
 accessibility/iframe-bastardization.html
-accessibility/ignore-spacer-elements.html
 accessibility/img-aria-button-alt-tag.html
 accessibility/input-image-alt.html
 accessibility/input-slider.html
 accessibility/language-attribute.html
 accessibility/onclick-handlers.html
-accessibility/non-data-table-cell-title-ui-element.html
-accessibility/nochildren-elements.html
 accessibility/placeholder.html
-accessibility/radio-button-checkbox-size.html
 accessibility/radio-button-title-label.html
 accessibility/secure-textfield-title-ui.html
-accessibility/table-modification-crash.html
-accessibility/table-nofirstbody.html
 accessibility/table-notbody.html
 accessibility/textarea-insertion-point-line-number.html
 accessibility/textarea-line-for-index.html
index 999099a..1df1fc6 100644 (file)
@@ -1,3 +1,16 @@
+2009-08-08  Jan Michael Alonzo  <jmalonzo@webkit.org>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] Enable accessibility in Gtk DRT
+        https://bugs.webkit.org/show_bug.cgi?id=25989
+
+        Add SPI to get the focused accessible element to be used by DRT.
+
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+        (webkit_accessible_get_focused_element):
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.h:
+
 2009-08-07  Jan Michael Alonzo  <jmalonzo@webkit.org>
 
         Gtk build fix - add html/canvas to the binding generator's include path
index 2a04ebc..6d3729b 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2009 Igalia S.L.
+ * Copyright (C) 2009 Jan Alonzo
  *
  * Portions from Mozilla a11y, copyright as follows:
  *
@@ -1078,4 +1079,16 @@ void webkit_accessible_detach(WebKitAccessible* accessible)
     accessible->m_object = fallbackObject();
 }
 
+AtkObject* webkit_accessible_get_focused_element(WebKitAccessible* accessible)
+{
+    if (!accessible->m_object)
+        return 0;
+
+    RefPtr<AccessibilityObject> focusedObj = accessible->m_object->focusedUIElement();
+    if (!focusedObj)
+        return 0;
+
+    return focusedObj->wrapper();
+}
+
 #endif // HAVE(ACCESSIBILITY)
index ecfb99e..0b31b82 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -57,6 +58,8 @@ WebCore::AccessibilityObject* webkit_accessible_get_accessibility_object (WebKit
 
 void webkit_accessible_detach (WebKitAccessible* accessible);
 
+AtkObject* webkit_accessible_get_focused_element(WebKitAccessible* accessible);
+
 G_END_DECLS
 
 #endif // AccessibilityObjectWrapperAtk_h
index bbcd57f..a166554 100644 (file)
@@ -1,3 +1,16 @@
+2009-08-08  Jan Michael Alonzo  <jmalonzo@webkit.org>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] Enable accessibility in Gtk DRT
+        https://bugs.webkit.org/show_bug.cgi?id=25989
+
+        Add SPI to get the focused accessible element to be used by DRT.
+
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebframe.cpp:
+        (webkit_web_frame_get_focused_accessible_element):
+
 2009-07-30  Martin Robinson  <mrobinson@appcelerator.com>
 
         Reviewed by Xan Lopez, Gustavo Noronha and Jan Alonzo.
index f829167..0c3fbd3 100644 (file)
@@ -53,6 +53,7 @@
 #include "ResourceResponse.h"
 #include "WindowFeatures.h"
 
+#include <atk/atk.h>
 #include <glib.h>
 #include <libsoup/soup.h>
 
@@ -217,6 +218,9 @@ extern "C" {
     WEBKIT_API void
     webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
 
+    WEBKIT_API AtkObject*
+    webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame);
+
     WEBKIT_API gchar*
     webkit_web_view_get_selected_text (WebKitWebView* web_view);
 
index c46581d..fba084e 100644 (file)
@@ -32,7 +32,9 @@
 #include "webkitmarshal.h"
 #include "webkitprivate.h"
 
+#include "AccessibilityObjectWrapperAtk.h"
 #include "AnimationController.h"
+#include "AXObjectCache.h"
 #include "CString.h"
 #include "DocumentLoader.h"
 #include "FrameLoader.h"
@@ -52,6 +54,7 @@
 #include "ScriptController.h"
 #include "SubstituteData.h"
 
+#include <atk/atk.h>
 #include <JavaScriptCore/APICast.h>
 
 /**
@@ -855,3 +858,28 @@ gsize webkit_gc_count_javascript_objects()
 
 }
 
+AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
+
+#if HAVE(ACCESSIBILITY)
+    if (!AXObjectCache::accessibilityEnabled())
+        AXObjectCache::enableAccessibility();
+
+    WebKitWebFramePrivate* priv = frame->priv;
+    if (!priv->coreFrame || !priv->coreFrame->document())
+        return NULL;
+
+    RenderView* root = toRenderView(priv->coreFrame->document()->renderer());
+    if (!root)
+        return NULL;
+
+    AtkObject* wrapper =  priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
+    if (!wrapper)
+        return NULL;
+
+    return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(wrapper));
+#else
+    return NULL;
+#endif
+}
index 18d7db1..32d8a7a 100644 (file)
@@ -1,3 +1,76 @@
+2009-08-08  Jan Michael Alonzo  <jmalonzo@webkit.org>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] Enable accessibility in Gtk DRT
+        https://bugs.webkit.org/show_bug.cgi?id=25989
+
+        Add Accessibility support to the GTK DRT.
+
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp: Added.
+        (AccessibilityController::AccessibilityController):
+        (AccessibilityController::~AccessibilityController):
+        (AccessibilityController::focusedElement):
+        (AccessibilityController::rootElement):
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp: Added.
+        (AccessibilityUIElement::AccessibilityUIElement):
+        (AccessibilityUIElement::~AccessibilityUIElement):
+        (AccessibilityUIElement::getLinkedUIElements):
+        (AccessibilityUIElement::getDocumentLinks):
+        (AccessibilityUIElement::getChildren):
+        (AccessibilityUIElement::getChildrenWithRange):
+        (AccessibilityUIElement::childrenCount):
+        (AccessibilityUIElement::elementAtPoint):
+        (AccessibilityUIElement::getChildAtIndex):
+        (AccessibilityUIElement::allAttributes):
+        (AccessibilityUIElement::attributesOfLinkedUIElements):
+        (AccessibilityUIElement::attributesOfDocumentLinks):
+        (AccessibilityUIElement::titleUIElement):
+        (AccessibilityUIElement::parentElement):
+        (AccessibilityUIElement::attributesOfChildren):
+        (AccessibilityUIElement::parameterizedAttributeNames):
+        (AccessibilityUIElement::role):
+        (AccessibilityUIElement::title):
+        (AccessibilityUIElement::description):
+        (AccessibilityUIElement::language):
+        (AccessibilityUIElement::x):
+        (AccessibilityUIElement::y):
+        (AccessibilityUIElement::width):
+        (AccessibilityUIElement::height):
+        (AccessibilityUIElement::clickPointX):
+        (AccessibilityUIElement::clickPointY):
+        (AccessibilityUIElement::intValue):
+        (AccessibilityUIElement::minValue):
+        (AccessibilityUIElement::maxValue):
+        (AccessibilityUIElement::valueDescription):
+        (AccessibilityUIElement::isEnabled):
+        (AccessibilityUIElement::insertionPointLineNumber):
+        (AccessibilityUIElement::isActionSupported):
+        (AccessibilityUIElement::isRequired):
+        (AccessibilityUIElement::attributesOfColumnHeaders):
+        (AccessibilityUIElement::attributesOfRowHeaders):
+        (AccessibilityUIElement::attributesOfColumns):
+        (AccessibilityUIElement::attributesOfRows):
+        (AccessibilityUIElement::attributesOfVisibleCells):
+        (AccessibilityUIElement::attributesOfHeader):
+        (AccessibilityUIElement::indexInTable):
+        (AccessibilityUIElement::rowIndexRange):
+        (AccessibilityUIElement::columnIndexRange):
+        (AccessibilityUIElement::lineForIndex):
+        (AccessibilityUIElement::boundsForRange):
+        (AccessibilityUIElement::cellForColumnAndRow):
+        (AccessibilityUIElement::selectedTextRange):
+        (AccessibilityUIElement::setSelectedTextRange):
+        (AccessibilityUIElement::attributeValue):
+        (AccessibilityUIElement::isAttributeSettable):
+        (AccessibilityUIElement::increment):
+        (AccessibilityUIElement::decrement):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (webViewWindowObjectCleared):
+        (main):
+        * GNUmakefile.am:
+
 2009-08-07  Jan Michael Alonzo  <jmalonzo@webkit.org>
 
         Unreviewed Gtk build fix.
index 0bf0fef..d0b63c3 100644 (file)
@@ -27,6 +27,7 @@
 #define AccessibilityUIElement_h
 
 #include <JavaScriptCore/JSObjectRef.h>
+#include <wtf/Platform.h>
 #include <wtf/Vector.h>
 
 #if PLATFORM(MAC)
@@ -43,6 +44,9 @@ typedef struct objc_object* PlatformUIElement;
 #include <WebCore/COMPtr.h>
 
 typedef COMPtr<IAccessible> PlatformUIElement;
+#elif PLATFORM(GTK)
+#include <atk/atk.h>
+typedef AtkObject* PlatformUIElement;
 #else
 typedef void* PlatformUIElement;
 #endif
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
new file mode 100644 (file)
index 0000000..ab92e1d
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Jan Michael Alonzo
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * 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 "AccessibilityController.h"
+
+#include "AccessibilityUIElement.h"
+#include "DumpRenderTree.h"
+
+#include <atk/atk.h>
+#include <gtk/gtk.h>
+#include <webkit/webkit.h>
+
+extern "C" {
+extern AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame*);
+}
+
+AccessibilityController::AccessibilityController()
+{
+}
+
+AccessibilityController::~AccessibilityController()
+{
+}
+
+AccessibilityUIElement AccessibilityController::focusedElement()
+{
+    AtkObject* accessible =  webkit_web_frame_get_focused_accessible_element(mainFrame);
+    if (!accessible)
+        return 0;
+
+    return AccessibilityUIElement(accessible);
+}
+
+AccessibilityUIElement AccessibilityController::rootElement()
+{
+    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+    AtkObject* axObject = gtk_widget_get_accessible(GTK_WIDGET(view));
+    return AccessibilityUIElement(axObject);
+}
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
new file mode 100644 (file)
index 0000000..be1bbed
--- /dev/null
@@ -0,0 +1,417 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Jan Michael Alonzo
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * 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 "AccessibilityUIElement.h"
+
+#include <JavaScriptCore/JSStringRef.h>
+#include <wtf/Assertions.h>
+
+#include <atk/atk.h>
+#include <gtk/gtk.h>
+
+
+AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
+    : m_element(element)
+{
+}
+
+AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
+    : m_element(other.m_element)
+{
+}
+
+AccessibilityUIElement::~AccessibilityUIElement()
+{
+}
+
+void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements)
+{
+    // FIXME: implement
+}
+
+void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
+{
+    // FIXME: implement
+}
+
+void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
+{
+    int count = childrenCount();
+    for (int i = 0; i < count; i++) {
+        AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
+        children.append(AccessibilityUIElement(child));
+    }
+}
+
+void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length)
+{
+    for (unsigned i = location; i < length; i++) {
+        AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
+        elementVector.append(AccessibilityUIElement(child));
+    }
+}
+
+int AccessibilityUIElement::childrenCount()
+{
+    if (!m_element)
+        return 0;
+
+    ASSERT(ATK_IS_OBJECT(m_element));
+
+    return atk_object_get_n_accessible_children(ATK_OBJECT(m_element));
+}
+
+AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
+{
+    // FIXME: implement
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
+{
+    Vector<AccessibilityUIElement> children;
+    getChildrenWithRange(children, index, 1);
+
+    if (children.size() == 1)
+        return children.at(0);
+
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::allAttributes()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+AccessibilityUIElement AccessibilityUIElement::titleUIElement()
+{
+    // FIXME: implement
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::parentElement()
+{
+    ASSERT(m_element);
+    AtkObject* parent =  atk_object_get_parent(ATK_OBJECT(m_element));
+
+    return parent ? AccessibilityUIElement(parent) : 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfChildren()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::role()
+{
+    AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
+
+    if (!role)
+        return JSStringCreateWithCharacters(0, 0);
+
+    return JSStringCreateWithUTF8CString(atk_role_get_name(role));
+}
+
+JSStringRef AccessibilityUIElement::title()
+{
+    const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
+
+    if (!name)
+        return JSStringCreateWithCharacters(0, 0);
+
+    return JSStringCreateWithUTF8CString(name);
+}
+
+JSStringRef AccessibilityUIElement::description()
+{
+    const gchar* description = atk_object_get_description(ATK_OBJECT(m_element));
+
+    if (!description)
+        return JSStringCreateWithCharacters(0, 0);
+
+    return JSStringCreateWithUTF8CString(description);
+}
+
+JSStringRef AccessibilityUIElement::language()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+double AccessibilityUIElement::x()
+{
+    int x, y;
+
+    atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
+
+    return x;
+}
+
+double AccessibilityUIElement::y()
+{
+    int x, y;
+
+    atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
+
+    return y;
+}
+
+double AccessibilityUIElement::width()
+{
+    int width, height;
+
+    atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
+
+    return width;
+}
+
+double AccessibilityUIElement::height()
+{
+    int width, height;
+
+    atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
+
+    return height;
+}
+
+double AccessibilityUIElement::clickPointX()
+{
+    return 0.f;
+}
+
+double AccessibilityUIElement::clickPointY()
+{
+    return 0.f;
+}
+
+
+double AccessibilityUIElement::intValue()
+{
+    GValue value = { 0, { { 0 } } };
+
+    if (!ATK_IS_VALUE(m_element))
+        return 0.0f;
+
+    atk_value_get_current_value(ATK_VALUE(m_element), &value);
+
+    if (G_VALUE_HOLDS_DOUBLE(&value))
+        return g_value_get_double(&value);
+    else if (G_VALUE_HOLDS_INT(&value))
+        return static_cast<double>(g_value_get_int(&value));
+    else
+        return 0.0f;
+}
+
+double AccessibilityUIElement::minValue()
+{
+    GValue value = { 0, { { 0 } } };
+
+    if (!ATK_IS_VALUE(m_element))
+        return 0.0f;
+
+    atk_value_get_minimum_value(ATK_VALUE(m_element), &value);
+
+    if (G_VALUE_HOLDS_DOUBLE(&value))
+        return g_value_get_double(&value);
+    else if (G_VALUE_HOLDS_INT(&value))
+        return static_cast<double>(g_value_get_int(&value));
+    else
+        return 0.0f;
+}
+
+double AccessibilityUIElement::maxValue()
+{
+    GValue value = { 0, { { 0 } } };
+
+    if (!ATK_IS_VALUE(m_element))
+        return 0.0f;
+
+    atk_value_get_maximum_value(ATK_VALUE(m_element), &value);
+
+    if (G_VALUE_HOLDS_DOUBLE(&value))
+        return g_value_get_double(&value);
+    else if (G_VALUE_HOLDS_INT(&value))
+        return static_cast<double>(g_value_get_int(&value));
+    else
+        return 0.0f;
+}
+
+JSStringRef AccessibilityUIElement::valueDescription()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+bool AccessibilityUIElement::isEnabled()
+{
+    // FIXME: implement
+    return false;
+}
+
+
+int AccessibilityUIElement::insertionPointLineNumber()
+{
+    // FIXME: implement
+    return 0;
+}
+
+bool AccessibilityUIElement::isActionSupported(JSStringRef action)
+{
+    // FIXME: implement
+    return false;
+}
+
+bool AccessibilityUIElement::isRequired() const
+{
+    // FIXME: implement
+    return false;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumns()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRows()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfHeader()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+int AccessibilityUIElement::indexInTable()
+{
+    // FIXME: implement
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::rowIndexRange()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::columnIndexRange()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+int AccessibilityUIElement::lineForIndex(int)
+{
+    // FIXME: implement
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
+{
+    // FIXME: implement
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::selectedTextRange()
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
+{
+    // FIXME: implement
+}
+
+JSStringRef AccessibilityUIElement::attributeValue(JSStringRef attribute)
+{
+    // FIXME: implement
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
+{
+    // FIXME: implement
+    return false;
+}
+
+void AccessibilityUIElement::increment()
+{
+    // FIXME: implement
+}
+
+void AccessibilityUIElement::decrement()
+{
+    // FIXME: implement
+}
index bfeffc2..ac82dd8 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "DumpRenderTree.h"
 
+#include "AccessibilityController.h"
 #include "GCController.h"
 #include "LayoutTestController.h"
 #include "WorkQueue.h"
@@ -68,6 +69,7 @@ static bool printSeparators;
 static int dumpPixels;
 static int dumpTree = 1;
 
+AccessibilityController* axController = 0;
 LayoutTestController* gLayoutTestController = 0;
 static GCController* gcController = 0;
 static WebKitWebView* webView;
@@ -479,13 +481,17 @@ static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void
 static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef windowObject, gpointer data)
 {
     JSValueRef exception = 0;
-    assert(gLayoutTestController);
+    ASSERT(gLayoutTestController);
 
     gLayoutTestController->makeWindowObject(context, windowObject, &exception);
-    assert(!exception);
+    ASSERT(!exception);
 
     gcController->makeWindowObject(context, windowObject, &exception);
     ASSERT(!exception);
+
+    axController->makeWindowObject(context, windowObject, &exception);
+    ASSERT(!exception);
+
 }
 
 static gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId, gpointer data)
@@ -666,6 +672,7 @@ int main(int argc, char* argv[])
     setDefaultsToConsistentStateValuesForTesting();
 
     gcController = new GCController();
+    axController = new AccessibilityController();
 
     if (argc == optind+1 && strcmp(argv[optind], "-") == 0) {
         char filenameBuffer[2048];
@@ -689,6 +696,9 @@ int main(int argc, char* argv[])
     delete gcController;
     gcController = 0;
 
+    delete axController;
+    axController = 0;
+
     g_object_unref(webView);
 
     return 0;
index a8b6dad..487a479 100644 (file)
@@ -40,10 +40,12 @@ dumprendertree_cppflags := \
 Programs_DumpRenderTree_CPPFLAGS = $(dumprendertree_cppflags)
 
 Programs_DumpRenderTree_SOURCES = \
-       WebKitTools/DumpRenderTree/AccessibilityController.h \
-       WebKitTools/DumpRenderTree/AccessibilityUIElement.h \
        WebKitTools/DumpRenderTree/DumpRenderTree.h \
        WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h \
+       WebKitTools/DumpRenderTree/AccessibilityController.cpp \
+       WebKitTools/DumpRenderTree/AccessibilityController.h \
+       WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp \
+       WebKitTools/DumpRenderTree/AccessibilityUIElement.h \
        WebKitTools/DumpRenderTree/GCController.cpp \
        WebKitTools/DumpRenderTree/GCController.h \
        WebKitTools/DumpRenderTree/JavaScriptThreading.h \
@@ -54,6 +56,8 @@ Programs_DumpRenderTree_SOURCES = \
        WebKitTools/DumpRenderTree/WorkQueue.h \
        WebKitTools/DumpRenderTree/WorkQueueItem.h \
        WebKitTools/DumpRenderTree/config.h \
+       WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp \
+       WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp \
        WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp \
        WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h \
        WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp \