Changeset 50140 in webkit


Ignore:
Timestamp:
Oct 27, 2009 5:20:35 AM (14 years ago)
Author:
xan@webkit.org
Message:

2009-10-27 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Xan Lopez.

https://bugs.webkit.org/show_bug.cgi?id=25534
[GTK] Objects of ROLE_TABLE should implement the accessible table interface

First part of the implementation of AtkTable.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (getCell): (getCellIndex): (webkit_accessible_table_ref_at): (webkit_accessible_table_get_index_at): (webkit_accessible_table_get_n_columns): (webkit_accessible_table_get_n_rows): (webkit_accessible_table_get_column_extent_at): (webkit_accessible_table_get_row_extent_at): (webkit_accessible_table_get_row_header): (atk_table_interface_init): (AtkInterfacesInitFunctions): (GetAtkInterfaceTypeFromWAIType):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50139 r50140  
     12009-10-27  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25534
     6        [GTK] Objects of ROLE_TABLE should implement the accessible table interface
     7
     8        First part of the implementation of AtkTable.
     9
     10        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     11        (getCell):
     12        (getCellIndex):
     13        (webkit_accessible_table_ref_at):
     14        (webkit_accessible_table_get_index_at):
     15        (webkit_accessible_table_get_n_columns):
     16        (webkit_accessible_table_get_n_rows):
     17        (webkit_accessible_table_get_column_extent_at):
     18        (webkit_accessible_table_get_row_extent_at):
     19        (webkit_accessible_table_get_row_header):
     20        (atk_table_interface_init):
     21        (AtkInterfacesInitFunctions):
     22        (GetAtkInterfaceTypeFromWAIType):
     23
    1242009-10-27  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    225
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r50134 r50140  
    3737#include "AccessibilityListBox.h"
    3838#include "AccessibilityRenderObject.h"
     39#include "AccessibilityTable.h"
     40#include "AccessibilityTableCell.h"
     41#include "AccessibilityTableColumn.h"
     42#include "AccessibilityTableRow.h"
    3943#include "AtomicString.h"
    4044#include "CString.h"
     
    4549#include "HostWindow.h"
    4650#include "HTMLNames.h"
     51#include "HTMLTableCaptionElement.h"
     52#include "HTMLTableElement.h"
    4753#include "InlineTextBox.h"
    4854#include "IntRect.h"
     
    119125{
    120126    return core(ATK_OBJECT(image));
     127}
     128
     129static AccessibilityObject* core(AtkTable* table)
     130{
     131    return core(ATK_OBJECT(table));
    121132}
    122133
     
    10561067}
    10571068
     1069// Table
     1070
     1071static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
     1072{
     1073    AccessibilityObject* accTable = core(table);
     1074    if (accTable->isAccessibilityRenderObject())
     1075        return static_cast<AccessibilityTable*>(accTable)->cellForColumnAndRow(column, row);
     1076    return 0;
     1077}
     1078
     1079static gint cellIndex(AccessibilityTableCell* AXCell, AccessibilityTable* AXTable)
     1080{
     1081    // Calculate the cell's index as if we had a traditional Gtk+ table in
     1082    // which cells are all direct children of the table, arranged row-first.
     1083    AccessibilityObject::AccessibilityChildrenVector allCells;
     1084    AXTable->cells(allCells);
     1085    AccessibilityObject::AccessibilityChildrenVector::iterator position;
     1086    position = std::find(allCells.begin(), allCells.end(), AXCell);
     1087    if (position == allCells.end())
     1088        return -1;
     1089    return position - allCells.begin();
     1090}
     1091
     1092static AtkObject* webkit_accessible_table_ref_at(AtkTable* table, gint row, gint column)
     1093{
     1094    AccessibilityTableCell* AXCell = cell(table, row, column);
     1095    if (!AXCell)
     1096        return 0;
     1097    return AXCell->wrapper();
     1098}
     1099
     1100static gint webkit_accessible_table_get_index_at(AtkTable* table, gint row, gint column)
     1101{
     1102    AccessibilityTableCell* AXCell = cell(table, row, column);
     1103    AccessibilityTable* AXTable = static_cast<AccessibilityTable*>(core(table));
     1104    return cellIndex(AXCell, AXTable);
     1105}
     1106
     1107static gint webkit_accessible_table_get_n_columns(AtkTable* table)
     1108{
     1109    AccessibilityObject* accTable = core(table);
     1110    if (accTable->isAccessibilityRenderObject())
     1111        return static_cast<AccessibilityTable*>(accTable)->columnCount();
     1112    return 0;
     1113}
     1114
     1115static gint webkit_accessible_table_get_n_rows(AtkTable* table)
     1116{
     1117    AccessibilityObject* accTable = core(table);
     1118    if (accTable->isAccessibilityRenderObject())
     1119        return static_cast<AccessibilityTable*>(accTable)->rowCount();
     1120    return 0;
     1121}
     1122
     1123static gint webkit_accessible_table_get_column_extent_at(AtkTable* table, gint row, gint column)
     1124{
     1125    AccessibilityTableCell* AXCell = cell(table, row, column);
     1126    if (AXCell) {
     1127        pair<int, int> columnRange;
     1128        AXCell->columnIndexRange(columnRange);
     1129        return columnRange.second;
     1130    }
     1131    return 0;
     1132}
     1133
     1134static gint webkit_accessible_table_get_row_extent_at(AtkTable* table, gint row, gint column)
     1135{
     1136    AccessibilityTableCell* AXCell = cell(table, row, column);
     1137    if (AXCell) {
     1138        pair<int, int> rowRange;
     1139        AXCell->rowIndexRange(rowRange);
     1140        return rowRange.second;
     1141    }
     1142    return 0;
     1143}
     1144
     1145static AtkObject* webkit_accessible_table_get_row_header(AtkTable* table, gint row)
     1146{
     1147    AccessibilityObject* accTable = core(table);
     1148    if (accTable->isAccessibilityRenderObject()) {
     1149        AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
     1150        static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
     1151
     1152        unsigned rowCount = allRowHeaders.size();
     1153        for (unsigned k = 0; k < rowCount; ++k) {
     1154            AccessibilityObject* rowObject = allRowHeaders[k]->parentObject();
     1155            if (static_cast<AccessibilityTableRow*>(rowObject)->rowIndex() == row)
     1156                return allRowHeaders[k]->wrapper();
     1157        }
     1158    }
     1159    return 0;
     1160}
     1161
     1162static void atk_table_interface_init(AtkTableIface* iface)
     1163{
     1164    iface->ref_at = webkit_accessible_table_ref_at;
     1165    iface->get_index_at = webkit_accessible_table_get_index_at;
     1166    iface->get_n_columns = webkit_accessible_table_get_n_columns;
     1167    iface->get_n_rows = webkit_accessible_table_get_n_rows;
     1168    iface->get_column_extent_at = webkit_accessible_table_get_column_extent_at;
     1169    iface->get_row_extent_at = webkit_accessible_table_get_row_extent_at;
     1170    iface->get_row_header = webkit_accessible_table_get_row_header;
     1171}
     1172
    10581173static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
    10591174    {(GInterfaceInitFunc)atk_action_interface_init,
     
    10661181     (GInterfaceFinalizeFunc) NULL, NULL},
    10671182    {(GInterfaceInitFunc)atk_image_interface_init,
     1183     (GInterfaceFinalizeFunc) NULL, NULL},
     1184    {(GInterfaceInitFunc)atk_table_interface_init,
    10681185     (GInterfaceFinalizeFunc) NULL, NULL}
    10691186};
     
    10741191    WAI_TEXT,
    10751192    WAI_COMPONENT,
    1076     WAI_IMAGE
     1193    WAI_IMAGE,
     1194    WAI_TABLE
    10771195};
    10781196
     
    10901208  case WAI_IMAGE:
    10911209      return ATK_TYPE_IMAGE;
     1210  case WAI_TABLE:
     1211      return ATK_TYPE_TABLE;
    10921212  }
    10931213
     
    11221242    if (coreObject->isImage())
    11231243        interfaceMask |= 1 << WAI_IMAGE;
     1244
     1245    // Table
     1246    if (role == TableRole)
     1247        interfaceMask |= 1 << WAI_TABLE;
    11241248
    11251249    return interfaceMask;
Note: See TracChangeset for help on using the changeset viewer.