Changeset 142451 in webkit


Ignore:
Timestamp:
Feb 11, 2013 3:51:43 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][EFL] Shares WebKit-GTK's DumpRenderTree accessibility implementation with other Webkit ports
https://bugs.webkit.org/show_bug.cgi?id=105007

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-02-11
Reviewed by Martin Robinson.

Shares specific ATK's accessibility implementation.
Keeps platform specific methods in EFL and GTK's directories.

  • DumpRenderTree/atk/AccessibilityCallbacks.h: Renamed from Tools/DumpRenderTree/gtk/AccessibilityCallbacks.h.
  • DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp: Renamed from Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp.

(printAccessibilityEvent):
(axObjectEventListener):
(connectAccessibilityCallbacks):
(disconnectAccessibilityCallbacks):

  • DumpRenderTree/atk/AccessibilityControllerAtk.cpp: Copied from Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp.

(AccessibilityController::AccessibilityController):
(AccessibilityController::~AccessibilityController):
(AccessibilityController::elementAtPoint):
(AccessibilityController::setLogFocusEvents):
(AccessibilityController::setLogScrollingStartEvents):
(AccessibilityController::setLogValueChangeEvents):
(AccessibilityController::setLogAccessibilityEvents):
(AccessibilityController::addNotificationListener):
(AccessibilityController::removeNotificationListener):

  • DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: Copied from Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp.

(coreAttributeToAtkAttribute):
(roleToString):
(replaceCharactersForResults):
(AccessibilityUIElement::AccessibilityUIElement):
(AccessibilityUIElement::~AccessibilityUIElement):
(AccessibilityUIElement::getLinkedUIElements):
(AccessibilityUIElement::getDocumentLinks):
(AccessibilityUIElement::getChildren):
(AccessibilityUIElement::getChildrenWithRange):
(AccessibilityUIElement::rowCount):
(AccessibilityUIElement::columnCount):
(AccessibilityUIElement::childrenCount):
(AccessibilityUIElement::elementAtPoint):
(AccessibilityUIElement::linkedUIElementAtIndex):
(AccessibilityUIElement::getChildAtIndex):
(AccessibilityUIElement::indexOfChild):
(attributeSetToString):
(AccessibilityUIElement::allAttributes):
(AccessibilityUIElement::attributesOfLinkedUIElements):
(AccessibilityUIElement::attributesOfDocumentLinks):
(AccessibilityUIElement::titleUIElement):
(AccessibilityUIElement::parentElement):
(AccessibilityUIElement::attributesOfChildren):
(AccessibilityUIElement::parameterizedAttributeNames):
(AccessibilityUIElement::role):
(AccessibilityUIElement::subrole):
(AccessibilityUIElement::roleDescription):
(AccessibilityUIElement::title):
(AccessibilityUIElement::description):
(AccessibilityUIElement::stringValue):
(AccessibilityUIElement::language):
(AccessibilityUIElement::x):
(AccessibilityUIElement::y):
(AccessibilityUIElement::width):
(AccessibilityUIElement::height):
(AccessibilityUIElement::clickPointX):
(AccessibilityUIElement::clickPointY):
(AccessibilityUIElement::orientation):
(AccessibilityUIElement::intValue):
(AccessibilityUIElement::minValue):
(AccessibilityUIElement::maxValue):
(AccessibilityUIElement::valueDescription):
(checkElementState):
(AccessibilityUIElement::isEnabled):
(AccessibilityUIElement::insertionPointLineNumber):
(AccessibilityUIElement::isPressActionSupported):
(AccessibilityUIElement::isIncrementActionSupported):
(AccessibilityUIElement::isDecrementActionSupported):
(AccessibilityUIElement::isRequired):
(AccessibilityUIElement::isFocused):
(AccessibilityUIElement::isSelected):
(AccessibilityUIElement::hierarchicalLevel):
(AccessibilityUIElement::ariaIsGrabbed):
(AccessibilityUIElement::ariaDropEffects):
(AccessibilityUIElement::isExpanded):
(AccessibilityUIElement::isChecked):
(AccessibilityUIElement::attributesOfColumnHeaders):
(AccessibilityUIElement::attributesOfRowHeaders):
(AccessibilityUIElement::attributesOfColumns):
(AccessibilityUIElement::attributesOfRows):
(AccessibilityUIElement::attributesOfVisibleCells):
(AccessibilityUIElement::attributesOfHeader):
(AccessibilityUIElement::indexInTable):
(indexRangeInTable):
(AccessibilityUIElement::rowIndexRange):
(AccessibilityUIElement::columnIndexRange):
(AccessibilityUIElement::lineForIndex):
(AccessibilityUIElement::boundsForRange):
(AccessibilityUIElement::stringForRange):
(AccessibilityUIElement::attributedStringForRange):
(AccessibilityUIElement::attributedStringRangeIsMisspelled):
(AccessibilityUIElement::uiElementForSearchPredicate):
(AccessibilityUIElement::cellForColumnAndRow):
(AccessibilityUIElement::selectedTextRange):
(AccessibilityUIElement::setSelectedTextRange):
(AccessibilityUIElement::stringAttributeValue):
(AccessibilityUIElement::numberAttributeValue):
(AccessibilityUIElement::boolAttributeValue):
(AccessibilityUIElement::isAttributeSettable):
(AccessibilityUIElement::isAttributeSupported):
(alterCurrentValue):
(AccessibilityUIElement::increment):
(AccessibilityUIElement::decrement):
(AccessibilityUIElement::press):
(AccessibilityUIElement::showMenu):
(AccessibilityUIElement::disclosedRowAtIndex):
(AccessibilityUIElement::ariaOwnsElementAtIndex):
(AccessibilityUIElement::ariaFlowToElementAtIndex):
(AccessibilityUIElement::selectedRowAtIndex):
(AccessibilityUIElement::rowAtIndex):
(AccessibilityUIElement::disclosedByRow):
(AccessibilityUIElement::accessibilityValue):
(AccessibilityUIElement::documentEncoding):
(AccessibilityUIElement::documentURI):
(AccessibilityUIElement::url):
(AccessibilityUIElement::addNotificationListener):
(AccessibilityUIElement::removeNotificationListener):
(AccessibilityUIElement::isFocusable):
(AccessibilityUIElement::isSelectable):
(AccessibilityUIElement::isMultiSelectable):
(AccessibilityUIElement::isSelectedOptionActive):
(AccessibilityUIElement::isVisible):
(AccessibilityUIElement::isOffScreen):
(AccessibilityUIElement::isCollapsed):
(AccessibilityUIElement::isIgnored):
(AccessibilityUIElement::hasPopup):
(AccessibilityUIElement::takeFocus):
(AccessibilityUIElement::takeSelection):
(AccessibilityUIElement::addSelection):
(AccessibilityUIElement::removeSelection):
(AccessibilityUIElement::scrollToMakeVisible):
(AccessibilityUIElement::scrollToMakeVisibleWithSubFocus):
(AccessibilityUIElement::scrollToGlobalPoint):

  • DumpRenderTree/efl/CMakeLists.txt: Adds ATK headers, libraries, new sources.
  • DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:

(AccessibilityController::focusedElement):
(AccessibilityController::rootElement):
(AccessibilityController::accessibleElementById):

  • DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:

(AccessibilityUIElement::helpText):

  • GNUmakefile.am: Adds renamed sources.
Location:
trunk/Tools
Files:
2 added
5 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r142438 r142451  
     12013-02-11  Krzysztof Czech  <k.czech@samsung.com>
     2
     3        [GTK][EFL] Shares WebKit-GTK's DumpRenderTree accessibility implementation with other Webkit ports
     4        https://bugs.webkit.org/show_bug.cgi?id=105007
     5
     6        Reviewed by Martin Robinson.
     7
     8        Shares specific ATK's accessibility implementation.
     9        Keeps platform specific methods in EFL and GTK's directories.
     10
     11        * DumpRenderTree/atk/AccessibilityCallbacks.h: Renamed from Tools/DumpRenderTree/gtk/AccessibilityCallbacks.h.
     12        * DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp: Renamed from Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp.
     13        (printAccessibilityEvent):
     14        (axObjectEventListener):
     15        (connectAccessibilityCallbacks):
     16        (disconnectAccessibilityCallbacks):
     17        * DumpRenderTree/atk/AccessibilityControllerAtk.cpp: Copied from Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp.
     18        (AccessibilityController::AccessibilityController):
     19        (AccessibilityController::~AccessibilityController):
     20        (AccessibilityController::elementAtPoint):
     21        (AccessibilityController::setLogFocusEvents):
     22        (AccessibilityController::setLogScrollingStartEvents):
     23        (AccessibilityController::setLogValueChangeEvents):
     24        (AccessibilityController::setLogAccessibilityEvents):
     25        (AccessibilityController::addNotificationListener):
     26        (AccessibilityController::removeNotificationListener):
     27        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: Copied from Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp.
     28        (coreAttributeToAtkAttribute):
     29        (roleToString):
     30        (replaceCharactersForResults):
     31        (AccessibilityUIElement::AccessibilityUIElement):
     32        (AccessibilityUIElement::~AccessibilityUIElement):
     33        (AccessibilityUIElement::getLinkedUIElements):
     34        (AccessibilityUIElement::getDocumentLinks):
     35        (AccessibilityUIElement::getChildren):
     36        (AccessibilityUIElement::getChildrenWithRange):
     37        (AccessibilityUIElement::rowCount):
     38        (AccessibilityUIElement::columnCount):
     39        (AccessibilityUIElement::childrenCount):
     40        (AccessibilityUIElement::elementAtPoint):
     41        (AccessibilityUIElement::linkedUIElementAtIndex):
     42        (AccessibilityUIElement::getChildAtIndex):
     43        (AccessibilityUIElement::indexOfChild):
     44        (attributeSetToString):
     45        (AccessibilityUIElement::allAttributes):
     46        (AccessibilityUIElement::attributesOfLinkedUIElements):
     47        (AccessibilityUIElement::attributesOfDocumentLinks):
     48        (AccessibilityUIElement::titleUIElement):
     49        (AccessibilityUIElement::parentElement):
     50        (AccessibilityUIElement::attributesOfChildren):
     51        (AccessibilityUIElement::parameterizedAttributeNames):
     52        (AccessibilityUIElement::role):
     53        (AccessibilityUIElement::subrole):
     54        (AccessibilityUIElement::roleDescription):
     55        (AccessibilityUIElement::title):
     56        (AccessibilityUIElement::description):
     57        (AccessibilityUIElement::stringValue):
     58        (AccessibilityUIElement::language):
     59        (AccessibilityUIElement::x):
     60        (AccessibilityUIElement::y):
     61        (AccessibilityUIElement::width):
     62        (AccessibilityUIElement::height):
     63        (AccessibilityUIElement::clickPointX):
     64        (AccessibilityUIElement::clickPointY):
     65        (AccessibilityUIElement::orientation):
     66        (AccessibilityUIElement::intValue):
     67        (AccessibilityUIElement::minValue):
     68        (AccessibilityUIElement::maxValue):
     69        (AccessibilityUIElement::valueDescription):
     70        (checkElementState):
     71        (AccessibilityUIElement::isEnabled):
     72        (AccessibilityUIElement::insertionPointLineNumber):
     73        (AccessibilityUIElement::isPressActionSupported):
     74        (AccessibilityUIElement::isIncrementActionSupported):
     75        (AccessibilityUIElement::isDecrementActionSupported):
     76        (AccessibilityUIElement::isRequired):
     77        (AccessibilityUIElement::isFocused):
     78        (AccessibilityUIElement::isSelected):
     79        (AccessibilityUIElement::hierarchicalLevel):
     80        (AccessibilityUIElement::ariaIsGrabbed):
     81        (AccessibilityUIElement::ariaDropEffects):
     82        (AccessibilityUIElement::isExpanded):
     83        (AccessibilityUIElement::isChecked):
     84        (AccessibilityUIElement::attributesOfColumnHeaders):
     85        (AccessibilityUIElement::attributesOfRowHeaders):
     86        (AccessibilityUIElement::attributesOfColumns):
     87        (AccessibilityUIElement::attributesOfRows):
     88        (AccessibilityUIElement::attributesOfVisibleCells):
     89        (AccessibilityUIElement::attributesOfHeader):
     90        (AccessibilityUIElement::indexInTable):
     91        (indexRangeInTable):
     92        (AccessibilityUIElement::rowIndexRange):
     93        (AccessibilityUIElement::columnIndexRange):
     94        (AccessibilityUIElement::lineForIndex):
     95        (AccessibilityUIElement::boundsForRange):
     96        (AccessibilityUIElement::stringForRange):
     97        (AccessibilityUIElement::attributedStringForRange):
     98        (AccessibilityUIElement::attributedStringRangeIsMisspelled):
     99        (AccessibilityUIElement::uiElementForSearchPredicate):
     100        (AccessibilityUIElement::cellForColumnAndRow):
     101        (AccessibilityUIElement::selectedTextRange):
     102        (AccessibilityUIElement::setSelectedTextRange):
     103        (AccessibilityUIElement::stringAttributeValue):
     104        (AccessibilityUIElement::numberAttributeValue):
     105        (AccessibilityUIElement::boolAttributeValue):
     106        (AccessibilityUIElement::isAttributeSettable):
     107        (AccessibilityUIElement::isAttributeSupported):
     108        (alterCurrentValue):
     109        (AccessibilityUIElement::increment):
     110        (AccessibilityUIElement::decrement):
     111        (AccessibilityUIElement::press):
     112        (AccessibilityUIElement::showMenu):
     113        (AccessibilityUIElement::disclosedRowAtIndex):
     114        (AccessibilityUIElement::ariaOwnsElementAtIndex):
     115        (AccessibilityUIElement::ariaFlowToElementAtIndex):
     116        (AccessibilityUIElement::selectedRowAtIndex):
     117        (AccessibilityUIElement::rowAtIndex):
     118        (AccessibilityUIElement::disclosedByRow):
     119        (AccessibilityUIElement::accessibilityValue):
     120        (AccessibilityUIElement::documentEncoding):
     121        (AccessibilityUIElement::documentURI):
     122        (AccessibilityUIElement::url):
     123        (AccessibilityUIElement::addNotificationListener):
     124        (AccessibilityUIElement::removeNotificationListener):
     125        (AccessibilityUIElement::isFocusable):
     126        (AccessibilityUIElement::isSelectable):
     127        (AccessibilityUIElement::isMultiSelectable):
     128        (AccessibilityUIElement::isSelectedOptionActive):
     129        (AccessibilityUIElement::isVisible):
     130        (AccessibilityUIElement::isOffScreen):
     131        (AccessibilityUIElement::isCollapsed):
     132        (AccessibilityUIElement::isIgnored):
     133        (AccessibilityUIElement::hasPopup):
     134        (AccessibilityUIElement::takeFocus):
     135        (AccessibilityUIElement::takeSelection):
     136        (AccessibilityUIElement::addSelection):
     137        (AccessibilityUIElement::removeSelection):
     138        (AccessibilityUIElement::scrollToMakeVisible):
     139        (AccessibilityUIElement::scrollToMakeVisibleWithSubFocus):
     140        (AccessibilityUIElement::scrollToGlobalPoint):
     141        * DumpRenderTree/efl/CMakeLists.txt: Adds ATK headers, libraries, new sources.
     142        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
     143        (AccessibilityController::focusedElement):
     144        (AccessibilityController::rootElement):
     145        (AccessibilityController::accessibleElementById):
     146        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
     147        (AccessibilityUIElement::helpText):
     148        * GNUmakefile.am: Adds renamed sources.
     149
    11502013-02-11  Jochen Eisinger  <jochen@chromium.org>
    2151
  • trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp

    r142450 r142451  
    3030#include "AccessibilityCallbacks.h"
    3131
     32#if HAVE(ACCESSIBILITY)
     33
    3234#include "AccessibilityController.h"
    3335#include "DumpRenderTree.h"
     36#include <atk/atk.h>
     37#include <wtf/gobject/GOwnPtr.h>
     38
     39#if PLATFORM(GTK)
    3440#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
    35 #include <gtk/gtk.h>
    3641#include <webkit/webkit.h>
    37 #include <wtf/gobject/GOwnPtr.h>
     42#endif
     43
     44#if PLATFORM(EFL)
     45#include "DumpRenderTreeChrome.h"
     46#include "WebCoreSupport/DumpRenderTreeSupportEfl.h"
     47#endif
    3848
    3949static guint stateChangeListenerId = 0;
     
    6272
    6373    GOwnPtr<gchar> signalNameAndValue(signalValue ? g_strdup_printf("%s = %s", signalName, signalValue) : g_strdup(signalName));
    64     printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n",
    65            signalNameAndValue.get(), objectName, objectRole);
     74    printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n", signalNameAndValue.get(), objectName, objectRole);
    6675}
    6776
    68 static gboolean axObjectEventListener(GSignalInvocationHint *signalHint,
    69                                       guint numParamValues,
    70                                       const GValue *paramValues,
    71                                       gpointer data)
     77static gboolean axObjectEventListener(GSignalInvocationHint *signalHint, guint numParamValues, const GValue *paramValues, gpointer data)
    7278{
    7379    // At least we should receive the instance emitting the signal.
     
    7985        return TRUE;
    8086
    81     GSignalQuery signal_query;
     87    GSignalQuery signalQuery;
    8288    GOwnPtr<gchar> signalName;
    8389    GOwnPtr<gchar> signalValue;
    8490
    85     g_signal_query(signalHint->signal_id, &signal_query);
     91    g_signal_query(signalHint->signal_id, &signalQuery);
    8692
    87     if (!g_strcmp0(signal_query.signal_name, "state-change")) {
     93    if (!g_strcmp0(signalQuery.signal_name, "state-change")) {
    8894        signalName.set(g_strdup_printf("state-change:%s", g_value_get_string(&paramValues[1])));
    8995        signalValue.set(g_strdup_printf("%d", g_value_get_boolean(&paramValues[2])));
    90     } else if (!g_strcmp0(signal_query.signal_name, "focus-event")) {
     96    } else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) {
    9197        signalName.set(g_strdup("focus-event"));
    9298        signalValue.set(g_strdup_printf("%d", g_value_get_boolean(&paramValues[1])));
    93     } else if (!g_strcmp0(signal_query.signal_name, "children-changed")) {
     99    } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) {
    94100        signalName.set(g_strdup("children-changed"));
    95101        signalValue.set(g_strdup_printf("%d", g_value_get_uint(&paramValues[1])));
    96     } else if (!g_strcmp0(signal_query.signal_name, "property-change")) {
     102    } else if (!g_strcmp0(signalQuery.signal_name, "property-change"))
    97103        signalName.set(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail)));
    98     } else
    99         signalName.set(g_strdup(signal_query.signal_name));
     104    else
     105        signalName.set(g_strdup(signalQuery.signal_name));
    100106
    101107    printAccessibilityEvent(accessible, signalName.get(), signalValue.get());
     
    111117    // Ensure that accessibility is initialized for the WebView by querying for
    112118    // the root accessible object, which will create the full hierarchy.
     119#if PLATFORM(GTK)
    113120    DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame);
     121#elif PLATFORM(EFL)
     122    DumpRenderTreeSupportEfl::rootAccessibleElement(browser->mainFrame());
     123#endif
    114124
    115125    // Add global listeners for AtkObject's signals.
    116     stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:state-change");
    117     focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:focus-event");
    118     activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:active-descendant-changed");
    119     childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:children-changed");
    120     propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:property-change");
    121     visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:visible-data-changed");
     126    stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:state-change");
     127    focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:focus-event");
     128    activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:active-descendant-changed");
     129    childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:children-changed");
     130    propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:property-change");
     131    visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:visible-data-changed");
    122132
    123133    // Ensure the Atk interface types are registered, otherwise
     
    158168}
    159169
     170#endif
  • trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp

    r142450 r142451  
    2828#include "AccessibilityUIElement.h"
    2929
    30 #include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
     30#if HAVE(ACCESSIBILITY)
     31
    3132#include <JavaScriptCore/JSStringRef.h>
    3233#include <atk/atk.h>
    33 #include <gtk/gtk.h>
    3434#include <wtf/Assertions.h>
    3535#include <wtf/gobject/GOwnPtr.h>
    3636#include <wtf/gobject/GRefPtr.h>
     37#include <wtf/text/CString.h>
    3738#include <wtf/text/WTFString.h>
    3839#include <wtf/unicode/CharacterNames.h>
     
    440441}
    441442
    442 JSStringRef AccessibilityUIElement::helpText() const
    443 {
    444     if (!m_element)
    445         return JSStringCreateWithCharacters(0, 0);
    446 
    447     ASSERT(ATK_IS_OBJECT(m_element));
    448 
    449     CString helpText = DumpRenderTreeSupportGtk::accessibilityHelpText(ATK_OBJECT(m_element));
    450     GOwnPtr<gchar> axHelpText(g_strdup_printf("AXHelp: %s", helpText.data()));
    451     return JSStringCreateWithUTF8CString(axHelpText.get());
    452 }
    453 
    454443double AccessibilityUIElement::x()
    455444{
     
    554543{
    555544    if (!ATK_IS_OBJECT(element))
    556          return false;
     545        return false;
    557546
    558547    GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element)));
     
    621610    return false;
    622611}
    623  
     612
    624613JSStringRef AccessibilityUIElement::ariaDropEffects() const
    625614{   
     
    10571046    // FIXME: implement
    10581047}
     1048
     1049#endif
  • trunk/Tools/DumpRenderTree/efl/CMakeLists.txt

    r140389 r142451  
    11set(DumpRenderTree_SOURCES
     2    ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp
    23    ${TOOLS_DIR}/DumpRenderTree/DumpRenderTreeCommon.cpp
    34    ${TOOLS_DIR}/DumpRenderTree/CyclicRedundancyCheck.cpp
     
    8990    ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
    9091    ${TOOLS_DIR}/DumpRenderTree
     92    ${TOOLS_DIR}/DumpRenderTree/atk
    9193    ${TOOLS_DIR}/DumpRenderTree/cairo
    9294    ${TOOLS_DIR}/DumpRenderTree/efl
  • trunk/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp

    r139250 r142451  
    3838#include <wtf/gobject/GOwnPtr.h>
    3939
    40 static bool loggingAccessibilityEvents = false;
    41 
    42 AccessibilityController::AccessibilityController()
    43 {
    44 }
    45 
    46 AccessibilityController::~AccessibilityController()
    47 {
    48 }
    49 
    50 AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
    51 {
    52     // FIXME: implement
    53     return 0;
    54 }
    55 
    56 AccessibilityUIElement AccessibilityController::focusedElement()
    57 {
    58     AtkObject* accessible =  DumpRenderTreeSupportGtk::getFocusedAccessibleElement(mainFrame);
    59     if (!accessible)
    60         return 0;
    61 
    62     return AccessibilityUIElement(accessible);
    63 }
    64 
    65 AccessibilityUIElement AccessibilityController::rootElement()
    66 {
    67     AtkObject* accessible = DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame);
    68     if (!accessible)
    69         return 0;
    70 
    71     return AccessibilityUIElement(accessible);
    72 }
    73 
    7440static AtkObject* childElementById(AtkObject* parent, const char* id)
    7541{
     
    9763}
    9864
     65AccessibilityUIElement AccessibilityController::focusedElement()
     66{
     67    AtkObject* accessible =  DumpRenderTreeSupportGtk::getFocusedAccessibleElement(mainFrame);
     68    if (!accessible)
     69        return 0;
     70
     71    return AccessibilityUIElement(accessible);
     72}
     73
     74AccessibilityUIElement AccessibilityController::rootElement()
     75{
     76    AtkObject* accessible = DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame);
     77    if (!accessible)
     78        return 0;
     79
     80    return AccessibilityUIElement(accessible);
     81}
     82
    9983AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id)
    10084{
     
    11498
    11599}
    116 
    117 void AccessibilityController::setLogFocusEvents(bool)
    118 {
    119 }
    120 
    121 void AccessibilityController::setLogScrollingStartEvents(bool)
    122 {
    123 }
    124 
    125 void AccessibilityController::setLogValueChangeEvents(bool)
    126 {
    127 }
    128 
    129 void AccessibilityController::setLogAccessibilityEvents(bool logAccessibilityEvents)
    130 {
    131     if (logAccessibilityEvents == loggingAccessibilityEvents)
    132         return;
    133 
    134     if (!logAccessibilityEvents) {
    135         disconnectAccessibilityCallbacks();
    136         loggingAccessibilityEvents = false;
    137         return;
    138     }
    139 
    140     connectAccessibilityCallbacks();
    141     loggingAccessibilityEvents = true;
    142 }
    143 
    144 bool AccessibilityController::addNotificationListener(JSObjectRef)
    145 {
    146     return false;
    147 }
    148 
    149 void AccessibilityController::removeNotificationListener()
    150 {
    151 }
  • trunk/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp

    r139250 r142451  
    3838#include <wtf/unicode/CharacterNames.h>
    3939
    40 static String coreAttributeToAtkAttribute(JSStringRef attribute)
    41 {
    42     size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute);
    43     GOwnPtr<gchar> buffer(static_cast<gchar*>(g_malloc(bufferSize)));
    44     JSStringGetUTF8CString(attribute, buffer.get(), bufferSize);
    45 
    46     String attributeString = String::fromUTF8(buffer.get());
    47     if (attributeString == "AXPlaceholderValue")
    48         return "placeholder-text";
    49 
    50     return "";
    51 }
    52 
    53 static inline String roleToString(AtkRole role)
    54 {
    55     switch (role) {
    56     case ATK_ROLE_ALERT:
    57         return "AXRole: AXAlert";
    58     case ATK_ROLE_CANVAS:
    59         return "AXRole: AXCanvas";
    60     case ATK_ROLE_CHECK_BOX:
    61         return "AXRole: AXCheckBox";
    62     case ATK_ROLE_COLUMN_HEADER:
    63         return "AXRole: AXColumnHeader";
    64     case ATK_ROLE_COMBO_BOX:
    65         return "AXRole: AXComboBox";
    66     case ATK_ROLE_DOCUMENT_FRAME:
    67         return "AXRole: AXWebArea";
    68     case ATK_ROLE_ENTRY:
    69         return "AXRole: AXTextField";
    70     case ATK_ROLE_FOOTER:
    71         return "AXRole: AXFooter";
    72     case ATK_ROLE_FORM:
    73         return "AXRole: AXForm";
    74     case ATK_ROLE_GROUPING:
    75         return "AXRole: AXGroup";
    76     case ATK_ROLE_HEADING:
    77         return "AXRole: AXHeading";
    78     case ATK_ROLE_IMAGE:
    79         return "AXRole: AXImage";
    80     case ATK_ROLE_IMAGE_MAP:
    81         return "AXRole: AXImageMap";
    82     case ATK_ROLE_LABEL:
    83         return "AXRole: AXLabel";
    84     case ATK_ROLE_LINK:
    85         return "AXRole: AXLink";
    86     case ATK_ROLE_LIST:
    87         return "AXRole: AXList";
    88     case ATK_ROLE_LIST_BOX:
    89         return "AXRole: AXListBox";
    90     case ATK_ROLE_LIST_ITEM:
    91         return "AXRole: AXListItem";
    92     case ATK_ROLE_MENU:
    93         return "AXRole: AXMenu";
    94     case ATK_ROLE_MENU_BAR:
    95         return "AXRole: AXMenuBar";
    96     case ATK_ROLE_MENU_ITEM:
    97         return "AXRole: AXMenuItem";
    98     case ATK_ROLE_PAGE_TAB:
    99         return "AXRole: AXTab";
    100     case ATK_ROLE_PAGE_TAB_LIST:
    101         return "AXRole: AXTabGroup";
    102     case ATK_ROLE_PANEL:
    103         return "AXRole: AXGroup";
    104     case ATK_ROLE_PARAGRAPH:
    105         return "AXRole: AXParagraph";
    106     case ATK_ROLE_PASSWORD_TEXT:
    107         return "AXRole: AXPasswordField";
    108     case ATK_ROLE_PUSH_BUTTON:
    109         return "AXRole: AXButton";
    110     case ATK_ROLE_RADIO_BUTTON:
    111         return "AXRole: AXRadioButton";
    112     case ATK_ROLE_ROW_HEADER:
    113         return "AXRole: AXRowHeader";
    114     case ATK_ROLE_RULER:
    115         return "AXRole: AXRuler";
    116     case ATK_ROLE_SCROLL_BAR:
    117         return "AXRole: AXScrollBar";
    118     case ATK_ROLE_SCROLL_PANE:
    119         return "AXRole: AXScrollArea";
    120     case ATK_ROLE_SECTION:
    121         return "AXRole: AXDiv";
    122     case ATK_ROLE_SEPARATOR:
    123         return "AXRole: AXHorizontalRule";
    124     case ATK_ROLE_SLIDER:
    125         return "AXRole: AXSlider";
    126     case ATK_ROLE_SPIN_BUTTON:
    127         return "AXRole: AXSpinButton";
    128     case ATK_ROLE_TABLE:
    129         return "AXRole: AXTable";
    130     case ATK_ROLE_TABLE_CELL:
    131         return "AXRole: AXCell";
    132     case ATK_ROLE_TABLE_COLUMN_HEADER:
    133         return "AXRole: AXColumnHeader";
    134     case ATK_ROLE_TABLE_ROW:
    135         return "AXRole: AXRow";
    136     case ATK_ROLE_TABLE_ROW_HEADER:
    137         return "AXRole: AXRowHeader";
    138     case ATK_ROLE_TOGGLE_BUTTON:
    139         return "AXRole: AXToggleButton";
    140     case ATK_ROLE_TOOL_BAR:
    141         return "AXRole: AXToolbar";
    142     case ATK_ROLE_TOOL_TIP:
    143         return "AXRole: AXUserInterfaceTooltip";
    144     case ATK_ROLE_TREE:
    145         return "AXRole: AXTree";
    146     case ATK_ROLE_TREE_TABLE:
    147         return "AXRole: AXTreeGrid";
    148     case ATK_ROLE_TREE_ITEM:
    149         return "AXRole: AXTreeItem";
    150     case ATK_ROLE_WINDOW:
    151         return "AXRole: AXWindow";
    152     case ATK_ROLE_UNKNOWN:
    153         return "AXRole: AXUnknown";
    154     default:
    155         // We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which
    156         // our DRT isn't properly handling.
    157         return "AXRole: FIXME not identified";
    158     }
    159 }
    160 
    161 static inline gchar* replaceCharactersForResults(gchar* str)
    162 {
    163     String uString = String::fromUTF8(str);
    164 
    165     // The object replacement character is passed along to ATs so we need to be
    166     // able to test for their presence and do so without causing test failures.
    167     uString.replace(objectReplacementCharacter, "<obj>");
    168 
    169     // The presence of newline characters in accessible text of a single object
    170     // is appropriate, but it makes test results (especially the accessible tree)
    171     // harder to read.
    172     uString.replace("\n", "<\\n>");
    173 
    174     return g_strdup(uString.utf8().data());
    175 }
    176 
    177 AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
    178     : m_element(element)
    179 {
    180     if (m_element)
    181         g_object_ref(m_element);
    182 }
    183 
    184 AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
    185     : m_element(other.m_element)
    186 {
    187     if (m_element)
    188         g_object_ref(m_element);
    189 }
    190 
    191 AccessibilityUIElement::~AccessibilityUIElement()
    192 {
    193     if (m_element)
    194         g_object_unref(m_element);
    195 }
    196 
    197 void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements)
    198 {
    199     // FIXME: implement
    200 }
    201 
    202 void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
    203 {
    204     // FIXME: implement
    205 }
    206 
    207 void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
    208 {
    209     int count = childrenCount();
    210     for (int i = 0; i < count; i++) {
    211         AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
    212         children.append(AccessibilityUIElement(child));
    213     }
    214 }
    215 
    216 void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end)
    217 {
    218     for (unsigned i = start; i < end; i++) {
    219         AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
    220         elementVector.append(AccessibilityUIElement(child));
    221     }
    222 }
    223 
    224 int AccessibilityUIElement::rowCount()
    225 {
    226     if (!m_element)
    227         return 0;
    228 
    229     ASSERT(ATK_IS_TABLE(m_element));
    230 
    231     return atk_table_get_n_rows(ATK_TABLE(m_element));
    232 }
    233 
    234 int AccessibilityUIElement::columnCount()
    235 {
    236     if (!m_element)
    237         return 0;
    238 
    239     ASSERT(ATK_IS_TABLE(m_element));
    240 
    241     return atk_table_get_n_columns(ATK_TABLE(m_element));
    242 }
    243 
    244 int AccessibilityUIElement::childrenCount()
    245 {
    246     if (!m_element)
    247         return 0;
    248 
    249     ASSERT(ATK_IS_OBJECT(m_element));
    250 
    251     return atk_object_get_n_accessible_children(ATK_OBJECT(m_element));
    252 }
    253 
    254 AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
    255 {
    256     if (!m_element)
    257         return 0;
    258 
    259     return AccessibilityUIElement(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element), x, y, ATK_XY_WINDOW));
    260 }
    261 
    262 AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
    263 {
    264     // FIXME: implement
    265     return 0;
    266 }
    267 
    268 AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
    269 {
    270     Vector<AccessibilityUIElement> children;
    271     getChildrenWithRange(children, index, index + 1);
    272 
    273     if (children.size() == 1)
    274         return children.at(0);
    275 
    276     return 0;
    277 }
    278 
    279 unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element)
    280 {
    281     // FIXME: implement
    282     return 0;
    283 }
    284 
    285 gchar* attributeSetToString(AtkAttributeSet* attributeSet)
    286 {
    287     GString* str = g_string_new(0);
    288     for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
    289         AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
    290         GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
    291         g_string_append(str, attributeData.get());
    292         if (attributes->next)
    293             g_string_append(str, ", ");
    294     }
    295 
    296     return g_string_free(str, FALSE);
    297 }
    298 
    299 JSStringRef AccessibilityUIElement::allAttributes()
    300 {
    301     if (!m_element)
    302         return JSStringCreateWithCharacters(0, 0);
    303 
    304     ASSERT(ATK_IS_OBJECT(m_element));
    305     GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element))));
    306     return JSStringCreateWithUTF8CString(attributeData.get());
    307 }
    308 
    309 JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
    310 {
    311     // FIXME: implement
    312     return JSStringCreateWithCharacters(0, 0);
    313 }
    314 
    315 JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
    316 {
    317     // FIXME: implement
    318     return JSStringCreateWithCharacters(0, 0);
    319 }
    320 
    321 AccessibilityUIElement AccessibilityUIElement::titleUIElement()
    322 {
    323     if (!m_element)
    324         return 0;
    325 
    326     AtkRelationSet* set = atk_object_ref_relation_set(ATK_OBJECT(m_element));
    327     if (!set)
    328         return 0;
    329 
    330     AtkObject* target = 0;
    331     int count = atk_relation_set_get_n_relations(set);
    332     for (int i = 0; i < count; i++) {
    333         AtkRelation* relation = atk_relation_set_get_relation(set, i);
    334         if (atk_relation_get_relation_type(relation) == ATK_RELATION_LABELLED_BY) {
    335             GPtrArray* targetList = atk_relation_get_target(relation);
    336             if (targetList->len)
    337                 target = static_cast<AtkObject*>(g_ptr_array_index(targetList, 0));
    338         }
    339     }
    340 
    341     g_object_unref(set);
    342     return target ? AccessibilityUIElement(target) : 0;
    343 }
    344 
    345 AccessibilityUIElement AccessibilityUIElement::parentElement()
    346 {
    347     if (!m_element)
    348         return 0;
    349 
    350     ASSERT(ATK_IS_OBJECT(m_element));
    351 
    352     AtkObject* parent =  atk_object_get_parent(ATK_OBJECT(m_element));
    353     return parent ? AccessibilityUIElement(parent) : 0;
    354 }
    355 
    356 JSStringRef AccessibilityUIElement::attributesOfChildren()
    357 {
    358     // FIXME: implement
    359     return JSStringCreateWithCharacters(0, 0);
    360 }
    361 
    362 JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
    363 {
    364     // FIXME: implement
    365     return JSStringCreateWithCharacters(0, 0);
    366 }
    367 
    368 JSStringRef AccessibilityUIElement::role()
    369 {
    370     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
    371     if (!role)
    372         return JSStringCreateWithCharacters(0, 0);
    373 
    374     String roleString = roleToString(role);
    375     return JSStringCreateWithUTF8CString(roleString.utf8().data());
    376 }
    377 
    378 JSStringRef AccessibilityUIElement::subrole()
    379 {
    380     return 0;
    381 }
    382 
    383 JSStringRef AccessibilityUIElement::roleDescription()
    384 {
    385     return 0;
    386 }
    387 
    388 JSStringRef AccessibilityUIElement::title()
    389 {
    390     const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
    391     GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name ? name : ""));
    392 
    393     return JSStringCreateWithUTF8CString(axTitle.get());
    394 }
    395 
    396 JSStringRef AccessibilityUIElement::description()
    397 {
    398     const gchar* description = atk_object_get_description(ATK_OBJECT(m_element));
    399 
    400     if (!description)
    401         return JSStringCreateWithCharacters(0, 0);
    402 
    403     GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description));
    404 
    405     return JSStringCreateWithUTF8CString(axDesc.get());
    406 }
    407 
    408 JSStringRef AccessibilityUIElement::stringValue()
    409 {
    410     if (!m_element || !ATK_IS_TEXT(m_element))
    411         return JSStringCreateWithCharacters(0, 0);
    412 
    413     gchar* text = atk_text_get_text(ATK_TEXT(m_element), 0, -1);
    414     GOwnPtr<gchar> axValue(g_strdup_printf("AXValue: %s", replaceCharactersForResults(text)));
    415     g_free(text);
    416 
    417     return JSStringCreateWithUTF8CString(axValue.get());
    418 }
    419 
    420 JSStringRef AccessibilityUIElement::language()
    421 {
    422     if (!m_element)
    423         return JSStringCreateWithCharacters(0, 0);
    424 
    425     // In ATK, the document language is exposed as the document's locale.
    426     if (atk_object_get_role(ATK_OBJECT(m_element)) == ATK_ROLE_DOCUMENT_FRAME)
    427         return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atk_document_get_locale(ATK_DOCUMENT(m_element))));
    428 
    429     // For all other objects, the language is exposed as an AtkText attribute.
    430     if (!ATK_IS_TEXT(m_element))
    431         return JSStringCreateWithCharacters(0, 0);
    432 
    433     for (GSList* textAttributes = atk_text_get_default_attributes(ATK_TEXT(m_element)); textAttributes; textAttributes = textAttributes->next) {
    434         AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(textAttributes->data);
    435         if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE)))
    436             return JSStringCreateWithUTF8CString(g_strdup_printf("AXLanguage: %s", atkAttribute->value));
    437     }
    438 
    439     return JSStringCreateWithCharacters(0, 0);
    440 }
    441 
    44240JSStringRef AccessibilityUIElement::helpText() const
    44341{
     
    45149    return JSStringCreateWithUTF8CString(axHelpText.get());
    45250}
    453 
    454 double AccessibilityUIElement::x()
    455 {
    456     int x, y;
    457 
    458     atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
    459 
    460     return x;
    461 }
    462 
    463 double AccessibilityUIElement::y()
    464 {
    465     int x, y;
    466 
    467     atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
    468 
    469     return y;
    470 }
    471 
    472 double AccessibilityUIElement::width()
    473 {
    474     int width, height;
    475 
    476     atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
    477 
    478     return width;
    479 }
    480 
    481 double AccessibilityUIElement::height()
    482 {
    483     int width, height;
    484 
    485     atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
    486 
    487     return height;
    488 }
    489 
    490 double AccessibilityUIElement::clickPointX()
    491 {
    492     // Note: This is not something we have in ATK.
    493     return 0.f;
    494 }
    495 
    496 double AccessibilityUIElement::clickPointY()
    497 {
    498     // Note: This is not something we have in ATK.
    499     return 0.f;
    500 }
    501 
    502 JSStringRef AccessibilityUIElement::orientation() const
    503 {
    504     return 0;
    505 }
    506 
    507 double AccessibilityUIElement::intValue() const
    508 {
    509     GValue value = { 0, { { 0 } } };
    510 
    511     if (!ATK_IS_VALUE(m_element))
    512         return 0.0f;
    513 
    514     atk_value_get_current_value(ATK_VALUE(m_element), &value);
    515     if (!G_VALUE_HOLDS_FLOAT(&value))
    516         return 0.0f;
    517     return g_value_get_float(&value);
    518 }
    519 
    520 double AccessibilityUIElement::minValue()
    521 {
    522     GValue value = { 0, { { 0 } } };
    523 
    524     if (!ATK_IS_VALUE(m_element))
    525         return 0.0f;
    526 
    527     atk_value_get_minimum_value(ATK_VALUE(m_element), &value);
    528     if (!G_VALUE_HOLDS_FLOAT(&value))
    529         return 0.0f;
    530     return g_value_get_float(&value);
    531 }
    532 
    533 double AccessibilityUIElement::maxValue()
    534 {
    535     GValue value = { 0, { { 0 } } };
    536 
    537     if (!ATK_IS_VALUE(m_element))
    538         return 0.0f;
    539 
    540     atk_value_get_maximum_value(ATK_VALUE(m_element), &value);
    541     if (!G_VALUE_HOLDS_FLOAT(&value))
    542         return 0.0f;
    543     return g_value_get_float(&value);
    544 }
    545 
    546 JSStringRef AccessibilityUIElement::valueDescription()
    547 {
    548     // FIXME: implement after it has been implemented in ATK.
    549     // See: https://bugzilla.gnome.org/show_bug.cgi?id=684576
    550     return JSStringCreateWithCharacters(0, 0);
    551 }
    552 
    553 static bool checkElementState(PlatformUIElement element, AtkStateType stateType)
    554 {
    555     if (!ATK_IS_OBJECT(element))
    556          return false;
    557 
    558     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element)));
    559     return atk_state_set_contains_state(stateSet.get(), stateType);
    560 }
    561 
    562 bool AccessibilityUIElement::isEnabled()
    563 {
    564     return checkElementState(m_element, ATK_STATE_ENABLED);
    565 }
    566 
    567 int AccessibilityUIElement::insertionPointLineNumber()
    568 {
    569     // FIXME: implement
    570     return 0;
    571 }
    572 
    573 bool AccessibilityUIElement::isPressActionSupported()
    574 {
    575     // FIXME: implement
    576     return false;
    577 }
    578 
    579 bool AccessibilityUIElement::isIncrementActionSupported()
    580 {
    581     // FIXME: implement
    582     return false;
    583 }
    584 
    585 bool AccessibilityUIElement::isDecrementActionSupported()
    586 {
    587     // FIXME: implement
    588     return false;
    589 }
    590 
    591 bool AccessibilityUIElement::isRequired() const
    592 {
    593     // FIXME: implement
    594     return false;
    595 }
    596 
    597 bool AccessibilityUIElement::isFocused() const
    598 {
    599     if (!ATK_IS_OBJECT(m_element))
    600         return false;
    601 
    602     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    603     gboolean isFocused = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSED);
    604 
    605     return isFocused;
    606 }
    607 
    608 bool AccessibilityUIElement::isSelected() const
    609 {
    610     return checkElementState(m_element, ATK_STATE_SELECTED);
    611 }
    612 
    613 int AccessibilityUIElement::hierarchicalLevel() const
    614 {
    615     // FIXME: implement
    616     return 0;
    617 }
    618 
    619 bool AccessibilityUIElement::ariaIsGrabbed() const
    620 {
    621     return false;
    622 }
    623  
    624 JSStringRef AccessibilityUIElement::ariaDropEffects() const
    625 {   
    626     return 0;
    627 }
    628 
    629 bool AccessibilityUIElement::isExpanded() const
    630 {
    631     if (!ATK_IS_OBJECT(m_element))
    632         return false;
    633 
    634     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    635     gboolean isExpanded = atk_state_set_contains_state(stateSet.get(), ATK_STATE_EXPANDED);
    636 
    637     return isExpanded;
    638 }
    639 
    640 bool AccessibilityUIElement::isChecked() const
    641 {
    642     if (!ATK_IS_OBJECT(m_element))
    643         return false;
    644 
    645     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    646     gboolean isChecked = atk_state_set_contains_state(stateSet.get(), ATK_STATE_CHECKED);
    647 
    648     return isChecked;
    649 }
    650 
    651 JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
    652 {
    653     // FIXME: implement
    654     return JSStringCreateWithCharacters(0, 0);
    655 }
    656 
    657 JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
    658 {
    659     // FIXME: implement
    660     return JSStringCreateWithCharacters(0, 0);
    661 }
    662 
    663 JSStringRef AccessibilityUIElement::attributesOfColumns()
    664 {
    665     // FIXME: implement
    666     return JSStringCreateWithCharacters(0, 0);
    667 }
    668 
    669 JSStringRef AccessibilityUIElement::attributesOfRows()
    670 {
    671     // FIXME: implement
    672     return JSStringCreateWithCharacters(0, 0);
    673 }
    674 
    675 JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
    676 {
    677     // FIXME: implement
    678     return JSStringCreateWithCharacters(0, 0);
    679 }
    680 
    681 JSStringRef AccessibilityUIElement::attributesOfHeader()
    682 {
    683     // FIXME: implement
    684     return JSStringCreateWithCharacters(0, 0);
    685 }
    686 
    687 int AccessibilityUIElement::indexInTable()
    688 {
    689     // FIXME: implement
    690     return 0;
    691 }
    692 
    693 static JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
    694 {
    695     GOwnPtr<gchar> rangeString(g_strdup("{0, 0}"));
    696 
    697     if (!element)
    698         return JSStringCreateWithUTF8CString(rangeString.get());
    699 
    700     ASSERT(ATK_IS_OBJECT(element));
    701 
    702     AtkObject* axTable = atk_object_get_parent(ATK_OBJECT(element));
    703     if (!axTable || !ATK_IS_TABLE(axTable))
    704         return JSStringCreateWithUTF8CString(rangeString.get());
    705 
    706     // Look for the cell in the table.
    707     gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element));
    708     if (indexInParent == -1)
    709         return JSStringCreateWithUTF8CString(rangeString.get());
    710 
    711     int row = -1;
    712     int column = -1;
    713     row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
    714     column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
    715 
    716     // Get the actual values, if row and columns are valid values.
    717     if (row != -1 && column != -1) {
    718         int base = 0;
    719         int length = 0;
    720         if (isRowRange) {
    721             base = row;
    722             length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
    723         } else {
    724             base = column;
    725             length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
    726         }
    727         rangeString.set(g_strdup_printf("{%d, %d}", base, length));
    728     }
    729 
    730     return JSStringCreateWithUTF8CString(rangeString.get());
    731 }
    732 
    733 JSStringRef AccessibilityUIElement::rowIndexRange()
    734 {
    735     // Range in table for rows.
    736     return indexRangeInTable(m_element, true);
    737 }
    738 
    739 JSStringRef AccessibilityUIElement::columnIndexRange()
    740 {
    741     // Range in table for columns.
    742     return indexRangeInTable(m_element, false);
    743 }
    744 
    745 int AccessibilityUIElement::lineForIndex(int)
    746 {
    747     // FIXME: implement
    748     return 0;
    749 }
    750 
    751 JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
    752 {
    753     // FIXME: implement
    754     return JSStringCreateWithCharacters(0, 0);
    755 }
    756 
    757 JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned)
    758 {
    759     // FIXME: implement
    760     return JSStringCreateWithCharacters(0, 0);
    761 }
    762 
    763 JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
    764 {
    765     // FIXME: implement
    766     return JSStringCreateWithCharacters(0, 0);
    767 }
    768 
    769 bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
    770 {
    771     // FIXME: implement
    772     return false;
    773 }
    774 
    775 AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText)
    776 {
    777     // FIXME: implement
    778     return 0;
    779 }
    780 
    781 AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
    782 {
    783     if (!m_element)
    784         return 0;
    785 
    786     ASSERT(ATK_IS_TABLE(m_element));
    787 
    788     AtkObject* foundCell = atk_table_ref_at(ATK_TABLE(m_element), row, column);
    789     return foundCell ? AccessibilityUIElement(foundCell) : 0;
    790 }
    791 
    792 JSStringRef AccessibilityUIElement::selectedTextRange()
    793 {
    794     // FIXME: implement
    795     return JSStringCreateWithCharacters(0, 0);
    796 }
    797 
    798 void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
    799 {
    800     // FIXME: implement
    801 }
    802 
    803 JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
    804 {
    805     if (!m_element)
    806         return JSStringCreateWithCharacters(0, 0);
    807 
    808     String atkAttributeName = coreAttributeToAtkAttribute(attribute);
    809     if (atkAttributeName.isEmpty())
    810         return JSStringCreateWithCharacters(0, 0);
    811 
    812     for (GSList* atkAttributes = atk_object_get_attributes(ATK_OBJECT(m_element)); atkAttributes; atkAttributes = atkAttributes->next) {
    813         AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(atkAttributes->data);
    814         if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data()))
    815             return JSStringCreateWithUTF8CString(atkAttribute->value);
    816     }
    817 
    818     return JSStringCreateWithCharacters(0, 0);
    819 }
    820 
    821 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
    822 {
    823     // FIXME: implement
    824     return 0.0f;
    825 }
    826 
    827 bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
    828 {
    829     // FIXME: implement
    830     return false;
    831 }
    832 
    833 bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
    834 {
    835     // FIXME: implement
    836     return false;
    837 }
    838 
    839 bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
    840 {
    841     return false;
    842 }
    843 
    844 static void alterCurrentValue(PlatformUIElement element, int factor)
    845 {
    846     if (!element)
    847         return;
    848 
    849     ASSERT(ATK_IS_VALUE(element));
    850 
    851     GValue currentValue = G_VALUE_INIT;
    852     atk_value_get_current_value(ATK_VALUE(element), &currentValue);
    853 
    854     GValue increment = G_VALUE_INIT;
    855     atk_value_get_minimum_increment(ATK_VALUE(element), &increment);
    856 
    857     GValue newValue = G_VALUE_INIT;
    858     g_value_init(&newValue, G_TYPE_FLOAT);
    859 
    860     g_value_set_float(&newValue, g_value_get_float(&currentValue) + factor * g_value_get_float(&increment));
    861     atk_value_set_current_value(ATK_VALUE(element), &newValue);
    862 
    863     g_value_unset(&newValue);
    864     g_value_unset(&increment);
    865     g_value_unset(&currentValue);
    866 }
    867 
    868 void AccessibilityUIElement::increment()
    869 {
    870     alterCurrentValue(m_element, 1);
    871 }
    872 
    873 void AccessibilityUIElement::decrement()
    874 {
    875     alterCurrentValue(m_element, -1);
    876 }
    877 
    878 void AccessibilityUIElement::press()
    879 {
    880     if (!m_element)
    881         return;
    882 
    883     ASSERT(ATK_IS_OBJECT(m_element));
    884 
    885     if (!ATK_IS_ACTION(m_element))
    886         return;
    887 
    888     // Only one action per object is supported so far.
    889     atk_action_do_action(ATK_ACTION(m_element), 0);
    890 }
    891 
    892 void AccessibilityUIElement::showMenu()
    893 {
    894     // FIXME: implement
    895 }
    896 
    897 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
    898 {
    899     return 0;
    900 }
    901 
    902 AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
    903 {
    904     return 0;
    905 }
    906 
    907 AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
    908 {
    909     return 0;
    910 }
    911 
    912 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
    913 {
    914     return 0;
    915 }
    916 
    917 AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index)
    918 {
    919     return 0;
    920 }
    921 
    922 AccessibilityUIElement AccessibilityUIElement::disclosedByRow()
    923 {
    924     return 0;
    925 }
    926 
    927 JSStringRef AccessibilityUIElement::accessibilityValue() const
    928 {
    929     // FIXME: implement
    930     return JSStringCreateWithCharacters(0, 0);
    931 }
    932 
    933 JSStringRef AccessibilityUIElement::documentEncoding()
    934 {
    935     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
    936     if (role != ATK_ROLE_DOCUMENT_FRAME)
    937         return JSStringCreateWithCharacters(0, 0);
    938 
    939     return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding"));
    940 }
    941 
    942 JSStringRef AccessibilityUIElement::documentURI()
    943 {
    944     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
    945     if (role != ATK_ROLE_DOCUMENT_FRAME)
    946         return JSStringCreateWithCharacters(0, 0);
    947 
    948     return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI"));
    949 }
    950 
    951 JSStringRef AccessibilityUIElement::url()
    952 {
    953     // FIXME: implement
    954     return JSStringCreateWithCharacters(0, 0);
    955 }
    956 
    957 bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback)
    958 {
    959     // FIXME: implement
    960     return false;
    961 }
    962 
    963 void AccessibilityUIElement::removeNotificationListener()
    964 {
    965     // FIXME: implement
    966 }
    967 
    968 bool AccessibilityUIElement::isFocusable() const
    969 {
    970     if (!ATK_IS_OBJECT(m_element))
    971         return false;
    972 
    973     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
    974     gboolean isFocusable = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSABLE);
    975 
    976     return isFocusable;
    977 }
    978 
    979 bool AccessibilityUIElement::isSelectable() const
    980 {
    981     return checkElementState(m_element, ATK_STATE_SELECTABLE);
    982 }
    983 
    984 bool AccessibilityUIElement::isMultiSelectable() const
    985 {
    986     return checkElementState(m_element, ATK_STATE_MULTISELECTABLE);
    987 }
    988 
    989 bool AccessibilityUIElement::isSelectedOptionActive() const
    990 {
    991     // FIXME: implement
    992     return false;
    993 }
    994 
    995 bool AccessibilityUIElement::isVisible() const
    996 {
    997     // FIXME: implement
    998     return false;
    999 }
    1000 
    1001 bool AccessibilityUIElement::isOffScreen() const
    1002 {
    1003     // FIXME: implement
    1004     return false;
    1005 }
    1006 
    1007 bool AccessibilityUIElement::isCollapsed() const
    1008 {
    1009     // FIXME: implement
    1010     return false;
    1011 }
    1012 
    1013 bool AccessibilityUIElement::isIgnored() const
    1014 {
    1015     // FIXME: implement
    1016     return false;
    1017 }
    1018 
    1019 bool AccessibilityUIElement::hasPopup() const
    1020 {
    1021     // FIXME: implement
    1022     return false;
    1023 }
    1024 
    1025 void AccessibilityUIElement::takeFocus()
    1026 {
    1027     // FIXME: implement
    1028 }
    1029 
    1030 void AccessibilityUIElement::takeSelection()
    1031 {
    1032     // FIXME: implement
    1033 }
    1034 
    1035 void AccessibilityUIElement::addSelection()
    1036 {
    1037     // FIXME: implement
    1038 }
    1039 
    1040 void AccessibilityUIElement::removeSelection()
    1041 {
    1042     // FIXME: implement
    1043 }
    1044 
    1045 void AccessibilityUIElement::scrollToMakeVisible()
    1046 {
    1047     // FIXME: implement
    1048 }
    1049 
    1050 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height)
    1051 {
    1052     // FIXME: implement
    1053 }
    1054 
    1055 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y)
    1056 {
    1057     // FIXME: implement
    1058 }
  • trunk/Tools/GNUmakefile.am

    r142394 r142451  
    107107        -DTOP_LEVEL_DIR=\"${shell pwd}/${srcdir}\" \
    108108        -I$(srcdir)/Tools/DumpRenderTree \
     109        -I$(srcdir)/Tools/DumpRenderTree/atk \
    109110        -I$(srcdir)/Tools/DumpRenderTree/cairo \
    110111        -I$(srcdir)/Tools/DumpRenderTree/gtk \
     
    146147        Tools/DumpRenderTree/WorkQueueItem.h \
    147148        Tools/DumpRenderTree/config.h \
     149        Tools/DumpRenderTree/atk/AccessibilityCallbacks.h \
     150        Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp \
     151        Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp \
     152        Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp \
    148153        Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp \
    149154        Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.h \
    150         Tools/DumpRenderTree/gtk/AccessibilityCallbacks.h \
    151         Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp \
    152155        Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp \
    153156        Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp \
Note: See TracChangeset for help on using the changeset viewer.