Changeset 50140 in webkit
- Timestamp:
- Oct 27, 2009 5:20:35 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50139 r50140 1 2009-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 1 24 2009-10-27 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 25 -
trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r50134 r50140 37 37 #include "AccessibilityListBox.h" 38 38 #include "AccessibilityRenderObject.h" 39 #include "AccessibilityTable.h" 40 #include "AccessibilityTableCell.h" 41 #include "AccessibilityTableColumn.h" 42 #include "AccessibilityTableRow.h" 39 43 #include "AtomicString.h" 40 44 #include "CString.h" … … 45 49 #include "HostWindow.h" 46 50 #include "HTMLNames.h" 51 #include "HTMLTableCaptionElement.h" 52 #include "HTMLTableElement.h" 47 53 #include "InlineTextBox.h" 48 54 #include "IntRect.h" … … 119 125 { 120 126 return core(ATK_OBJECT(image)); 127 } 128 129 static AccessibilityObject* core(AtkTable* table) 130 { 131 return core(ATK_OBJECT(table)); 121 132 } 122 133 … … 1056 1067 } 1057 1068 1069 // Table 1070 1071 static 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 1079 static 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 1092 static 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 1100 static 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 1107 static 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 1115 static 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 1123 static 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 1134 static 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 1145 static 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 1162 static 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 1058 1173 static const GInterfaceInfo AtkInterfacesInitFunctions[] = { 1059 1174 {(GInterfaceInitFunc)atk_action_interface_init, … … 1066 1181 (GInterfaceFinalizeFunc) NULL, NULL}, 1067 1182 {(GInterfaceInitFunc)atk_image_interface_init, 1183 (GInterfaceFinalizeFunc) NULL, NULL}, 1184 {(GInterfaceInitFunc)atk_table_interface_init, 1068 1185 (GInterfaceFinalizeFunc) NULL, NULL} 1069 1186 }; … … 1074 1191 WAI_TEXT, 1075 1192 WAI_COMPONENT, 1076 WAI_IMAGE 1193 WAI_IMAGE, 1194 WAI_TABLE 1077 1195 }; 1078 1196 … … 1090 1208 case WAI_IMAGE: 1091 1209 return ATK_TYPE_IMAGE; 1210 case WAI_TABLE: 1211 return ATK_TYPE_TABLE; 1092 1212 } 1093 1213 … … 1122 1242 if (coreObject->isImage()) 1123 1243 interfaceMask |= 1 << WAI_IMAGE; 1244 1245 // Table 1246 if (role == TableRole) 1247 interfaceMask |= 1 << WAI_TABLE; 1124 1248 1125 1249 return interfaceMask;
Note: See TracChangeset
for help on using the changeset viewer.