Changeset 144727 in webkit
- Timestamp:
- Mar 4, 2013 11:13:46 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r144726 r144727 1 2013-03-04 Chris Fleizach <cfleizach@apple.com> 2 3 AX: cellForColumnAndRow fails for tables with hidden table cells 4 https://bugs.webkit.org/show_bug.cgi?id=110050 5 6 Reviewed by Tim Horton. 7 8 * accessibility/table-with-hidden-head-section-expected.txt: Added. 9 * accessibility/table-with-hidden-head-section.html: Added. 10 * platform/chromium/TestExpectations: 11 1 12 2013-03-04 Arpita Bahuguna <a.bah@samsung.com> 2 13 -
trunk/LayoutTests/platform/chromium/TestExpectations
r144700 r144727 1437 1437 webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ] 1438 1438 #webkit.org/b/98787 accessibility/aria-hidden-negates-no-visibility.html [ Skip ] 1439 webkit.org/b/110508 accessibility/table-with-hidden-head-section.html [ Skip ] 1439 1440 webkit.org/b/111062 [ Linux Win Debug ] accessibility/svg-remote-element.html [ Failure ] 1440 1441 -
trunk/Source/WebCore/ChangeLog
r144726 r144727 1 2013-03-04 Chris Fleizach <cfleizach@apple.com> 2 3 AX: cellForColumnAndRow fails for tables with hidden table cells 4 https://bugs.webkit.org/show_bug.cgi?id=110050 5 6 Reviewed by Tim Horton. 7 8 If a table had hidden cells, then accessibility code was being confused in a few ways. 9 1) The cellForColumnAndRow method would return the wrong information since that was 10 using the RenderTableSection to retrieve a cell, which did not have the same data as the AXTable 11 2) The way we were adding children made it impossible to determine column and row range because we 12 would skip rows that had hidden children 13 3) AccessibilityARIAGrid and AccessibilityTable were using different methods for cellForColumnAndRow 14 15 The fix does a few things to make things right: 16 1) Always add an accessibility row, even if there are no visible cells in that row. 17 2) Have one method for AXTable and AXARIAGrid for cellForColumnAndRow. 18 3) Change cellForColumnAndRow to query the accessibility children rather than the RenderTableSection in determining the row, col info. 19 4) cellForColumnAndRow should use unsigned values instead of int values. 20 21 Test: accessibility/table-with-hidden-head-section.html 22 23 * accessibility/AccessibilityARIAGrid.cpp: 24 (WebCore): 25 * accessibility/AccessibilityARIAGrid.h: 26 (AccessibilityARIAGrid): 27 * accessibility/AccessibilityARIAGridCell.cpp: 28 (WebCore::AccessibilityARIAGridCell::rowIndexRange): 29 (WebCore::AccessibilityARIAGridCell::columnIndexRange): 30 * accessibility/AccessibilityARIAGridCell.h: 31 (AccessibilityARIAGridCell): 32 * accessibility/AccessibilityTable.cpp: 33 (WebCore::AccessibilityTable::addChildren): 34 (WebCore::AccessibilityTable::cellForColumnAndRow): 35 * accessibility/AccessibilityTable.h: 36 (WebCore): 37 (AccessibilityTable): 38 * accessibility/AccessibilityTableCell.cpp: 39 (WebCore::AccessibilityTableCell::rowIndexRange): 40 (WebCore::AccessibilityTableCell::columnIndexRange): 41 * accessibility/AccessibilityTableCell.h: 42 (AccessibilityTableCell): 43 * accessibility/atk/WebKitAccessibleInterfaceTable.cpp: 44 (webkitAccessibleTableGetColumnAtIndex): 45 (webkitAccessibleTableGetRowAtIndex): 46 (webkitAccessibleTableGetColumnExtentAt): 47 (webkitAccessibleTableGetRowExtentAt): 48 (webkitAccessibleTableGetColumnHeader): 49 (webkitAccessibleTableGetRowHeader): 50 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 51 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 52 * rendering/RenderTableSection.h: 53 (RenderTableSection): 54 (WebCore::RenderTableSection::rowRendererAt): 55 1 56 2013-03-04 Arpita Bahuguna <a.bah@samsung.com> 2 57 -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
r142895 r144727 133 133 } 134 134 135 AccessibilityTableCell* AccessibilityARIAGrid::cellForColumnAndRow(unsigned column, unsigned row)136 {137 if (!m_renderer)138 return 0;139 140 updateChildrenIfNecessary();141 142 if (column >= columnCount() || row >= rowCount())143 return 0;144 145 int intRow = (int)row;146 int intColumn = (int)column;147 148 pair<int, int> columnRange;149 pair<int, int> rowRange;150 151 // Iterate backwards through the rows in case the desired cell has a rowspan and exists152 // in a previous row.153 for (; intRow >= 0; --intRow) {154 AccessibilityObject* tableRow = m_rows[intRow].get();155 if (!tableRow)156 continue;157 158 AccessibilityChildrenVector children = tableRow->children();159 unsigned childrenLength = children.size();160 161 // Since some cells may have colspans, we have to check the actual range of each162 // cell to determine which is the right one.163 for (unsigned k = 0; k < childrenLength; ++k) {164 AccessibilityObject* child = children[k].get();165 if (!child->isTableCell())166 continue;167 168 AccessibilityTableCell* tableCellChild = static_cast<AccessibilityTableCell*>(child);169 tableCellChild->columnIndexRange(columnRange);170 tableCellChild->rowIndexRange(rowRange);171 172 if ((intColumn >= columnRange.first && intColumn < (columnRange.first + columnRange.second))173 && (intRow >= rowRange.first && intRow < (rowRange.first + rowRange.second)))174 return tableCellChild;175 }176 }177 178 return 0;179 }180 181 135 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.h
r142895 r144727 50 50 virtual void addChildren(); 51 51 52 virtual AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row);53 54 52 private: 55 53 // ARIA treegrids and grids support selected rows. -
trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
r140658 r144727 71 71 } 72 72 73 void AccessibilityARIAGridCell::rowIndexRange(pair< int, int>& rowRange)73 void AccessibilityARIAGridCell::rowIndexRange(pair<unsigned, unsigned>& rowRange) 74 74 { 75 75 AccessibilityObject* parent = parentObjectUnignored(); … … 101 101 } 102 102 103 void AccessibilityARIAGridCell::columnIndexRange(pair< int, int>& columnRange)103 void AccessibilityARIAGridCell::columnIndexRange(pair<unsigned, unsigned>& columnRange) 104 104 { 105 105 AccessibilityObject* parent = parentObjectUnignored(); -
trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h
r124582 r144727 43 43 44 44 // fills in the start location and row span of cell 45 virtual void rowIndexRange(pair< int, int>& rowRange);45 virtual void rowIndexRange(pair<unsigned, unsigned>& rowRange); 46 46 // fills in the start location and column span of cell 47 virtual void columnIndexRange(pair< int, int>& columnRange);47 virtual void columnIndexRange(pair<unsigned, unsigned>& columnRange); 48 48 49 49 protected: -
trunk/Source/WebCore/accessibility/AccessibilityTable.cpp
r142895 r144727 345 345 AXObjectCache* axCache = m_renderer->document()->axObjectCache(); 346 346 347 // go through all the available sections to pull out the rows 348 // and add them as children 349 // FIXME: This will skip a table with just a tfoot. Should fix by using RenderTable::topSection. 350 RenderTableSection* tableSection = table->header(); 351 if (!tableSection) 352 tableSection = table->firstBody(); 353 347 // Go through all the available sections to pull out the rows and add them as children. 348 RenderTableSection* tableSection = table->topSection(); 354 349 if (!tableSection) 355 350 return; 356 351 357 352 RenderTableSection* initialTableSection = tableSection; 358 359 353 while (tableSection) { 360 354 361 355 HashSet<AccessibilityObject*> appendedRows; 362 363 356 unsigned numRows = tableSection->numRows(); 364 unsigned numCols = tableSection->numColumns();365 357 for (unsigned rowIndex = 0; rowIndex < numRows; ++rowIndex) { 366 for (unsigned colIndex = 0; colIndex < numCols; ++colIndex) { 367 368 RenderTableCell* cell = tableSection->primaryCellAt(rowIndex, colIndex); 369 if (!cell) 370 continue; 371 372 AccessibilityObject* rowObject = axCache->getOrCreate(cell->parent()); 373 if (!rowObject->isTableRow()) 374 continue; 375 376 AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(rowObject); 377 // we need to check every cell for a new row, because cell spans 378 // can cause us to mess rows if we just check the first column 379 if (appendedRows.contains(row)) 380 continue; 381 382 row->setRowIndex((int)m_rows.size()); 383 m_rows.append(row); 384 if (!row->accessibilityIsIgnored()) 385 m_children.append(row); 358 359 RenderTableRow* renderRow = tableSection->rowRendererAt(rowIndex); 360 if (!renderRow) 361 continue; 362 363 AccessibilityObject* rowObject = axCache->getOrCreate(renderRow); 364 if (!rowObject->isTableRow()) 365 continue; 366 367 AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(rowObject); 368 // We need to check every cell for a new row, because cell spans 369 // can cause us to miss rows if we just check the first column. 370 if (appendedRows.contains(row)) 371 continue; 372 373 row->setRowIndex(static_cast<int>(m_rows.size())); 374 m_rows.append(row); 375 if (!row->accessibilityIsIgnored()) 376 m_children.append(row); 386 377 #if PLATFORM(GTK) 387 388 378 else 379 m_children.append(row->children()); 389 380 #endif 390 appendedRows.add(row); 391 } 381 appendedRows.add(row); 392 382 } 393 383 394 384 tableSection = table->sectionBelow(tableSection, SkipEmptySections); 395 385 } … … 510 500 AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column, unsigned row) 511 501 { 512 if (!m_renderer || !m_renderer->isTable()) 502 updateChildrenIfNecessary(); 503 if (column >= columnCount() || row >= rowCount()) 513 504 return 0; 514 505 515 updateChildrenIfNecessary(); 516 517 RenderTable* table = toRenderTable(m_renderer); 518 // FIXME: This will skip a table with just a tfoot. Should fix by using RenderTable::topSection. 519 RenderTableSection* tableSection = table->header(); 520 if (!tableSection) 521 tableSection = table->firstBody(); 522 523 RenderTableCell* cell = 0; 524 unsigned rowCount = 0; 525 unsigned rowOffset = 0; 526 while (tableSection) { 527 528 unsigned numRows = tableSection->numRows(); 529 unsigned numCols = tableSection->numColumns(); 530 531 rowCount += numRows; 532 533 unsigned sectionSpecificRow = row - rowOffset; 534 if (row < rowCount && column < numCols && sectionSpecificRow < numRows) { 535 cell = tableSection->primaryCellAt(sectionSpecificRow, column); 536 537 // we didn't find the cell, which means there's spanning happening 538 // search backwards to find the spanning cell 539 if (!cell) { 540 541 // first try rows 542 for (int testRow = sectionSpecificRow - 1; testRow >= 0; --testRow) { 543 cell = tableSection->primaryCellAt(testRow, column); 544 // cell overlapped. use this one 545 ASSERT(!cell || cell->rowSpan() >= 1); 546 if (cell && ((cell->rowIndex() + (cell->rowSpan() - 1)) >= sectionSpecificRow)) 547 break; 548 cell = 0; 549 } 550 551 if (!cell) { 552 // try cols 553 for (int testCol = column - 1; testCol >= 0; --testCol) { 554 cell = tableSection->primaryCellAt(sectionSpecificRow, testCol); 555 // cell overlapped. use this one 556 ASSERT(!cell || cell->rowSpan() >= 1); 557 if (cell && ((cell->col() + (cell->colSpan() - 1)) >= column)) 558 break; 559 cell = 0; 560 } 561 } 562 } 506 // Iterate backwards through the rows in case the desired cell has a rowspan and exists in a previous row. 507 for (unsigned rowIndexCounter = row + 1; rowIndexCounter > 0; --rowIndexCounter) { 508 unsigned rowIndex = rowIndexCounter - 1; 509 AccessibilityChildrenVector children = m_rows[rowIndex]->children(); 510 // Since some cells may have colspans, we have to check the actual range of each 511 // cell to determine which is the right one. 512 for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children.size()), column + 1); colIndexCounter > 0; --colIndexCounter) { 513 unsigned colIndex = colIndexCounter - 1; 514 AccessibilityObject* child = children[colIndex].get(); 515 ASSERT(child->isTableCell()); 516 if (!child->isTableCell()) 517 continue; 518 519 pair<unsigned, unsigned> columnRange; 520 pair<unsigned, unsigned> rowRange; 521 AccessibilityTableCell* tableCellChild = static_cast<AccessibilityTableCell*>(child); 522 tableCellChild->columnIndexRange(columnRange); 523 tableCellChild->rowIndexRange(rowRange); 524 525 if ((column >= columnRange.first && column < (columnRange.first + columnRange.second)) 526 && (row >= rowRange.first && row < (rowRange.first + rowRange.second))) 527 return tableCellChild; 563 528 } 564 565 if (cell) 566 break; 567 568 rowOffset += numRows; 569 // we didn't find anything between the rows we should have 570 if (row < rowCount) 571 break; 572 tableSection = table->sectionBelow(tableSection, SkipEmptySections); 573 } 574 575 if (!cell) 576 return 0; 577 578 AccessibilityObject* cellObject = axObjectCache()->getOrCreate(cell); 579 ASSERT_WITH_SECURITY_IMPLICATION(cellObject->isTableCell()); 580 581 return static_cast<AccessibilityTableCell*>(cellObject); 529 } 530 531 return 0; 582 532 } 583 533 -
trunk/Source/WebCore/accessibility/AccessibilityTable.h
r142895 r144727 36 36 37 37 class AccessibilityTableCell; 38 class RenderTableSection; 38 39 39 40 class AccessibilityTable : public AccessibilityRenderObject { … … 68 69 // all the cells in the table 69 70 void cells(AccessibilityChildrenVector&); 70 virtualAccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row);71 AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row); 71 72 72 73 void columnHeaders(AccessibilityChildrenVector&); -
trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp
r142382 r144727 103 103 } 104 104 105 void AccessibilityTableCell::rowIndexRange(pair< int, int>& rowRange)105 void AccessibilityTableCell::rowIndexRange(pair<unsigned, unsigned>& rowRange) 106 106 { 107 107 if (!m_renderer || !m_renderer->isTableCell()) … … 118 118 return; 119 119 120 // FIXME: This will skip a table with just a tfoot. Should fix by using RenderTable::topSection. 121 RenderTableSection* tableSection = table->header(); 122 if (!tableSection) 123 tableSection = table->firstBody(); 124 120 RenderTableSection* tableSection = table->topSection(); 125 121 unsigned rowOffset = 0; 126 122 while (tableSection) { … … 134 130 } 135 131 136 void AccessibilityTableCell::columnIndexRange(pair< int, int>& columnRange)132 void AccessibilityTableCell::columnIndexRange(pair<unsigned, unsigned>& columnRange) 137 133 { 138 134 if (!m_renderer || !m_renderer->isTableCell()) -
trunk/Source/WebCore/accessibility/AccessibilityTableCell.h
r142382 r144727 45 45 46 46 // fills in the start location and row span of cell 47 virtual void rowIndexRange(pair< int, int>& rowRange);47 virtual void rowIndexRange(pair<unsigned, unsigned>& rowRange); 48 48 // fills in the start location and column span of cell 49 virtual void columnIndexRange(pair< int, int>& columnRange);49 virtual void columnIndexRange(pair<unsigned, unsigned>& columnRange); 50 50 51 51 protected: -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
r142883 r144727 116 116 AccessibilityTableCell* axCell = cellAtIndex(table, index); 117 117 if (axCell) { 118 pair< int, int> columnRange;118 pair<unsigned, unsigned> columnRange; 119 119 axCell->columnIndexRange(columnRange); 120 120 return columnRange.first; … … 127 127 AccessibilityTableCell* axCell = cellAtIndex(table, index); 128 128 if (axCell) { 129 pair< int, int> rowRange;129 pair<unsigned, unsigned> rowRange; 130 130 axCell->rowIndexRange(rowRange); 131 131 return rowRange.first; … … 154 154 AccessibilityTableCell* axCell = cell(table, row, column); 155 155 if (axCell) { 156 pair< int, int> columnRange;156 pair<unsigned, unsigned> columnRange; 157 157 axCell->columnIndexRange(columnRange); 158 158 return columnRange.second; … … 165 165 AccessibilityTableCell* axCell = cell(table, row, column); 166 166 if (axCell) { 167 pair< int, int> rowRange;167 pair<unsigned, unsigned> rowRange; 168 168 axCell->rowIndexRange(rowRange); 169 169 return rowRange.second; … … 180 180 unsigned columnCount = allColumnHeaders.size(); 181 181 for (unsigned k = 0; k < columnCount; ++k) { 182 pair< int, int> columnRange;182 pair<unsigned, unsigned> columnRange; 183 183 AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allColumnHeaders.at(k).get()); 184 184 cell->columnIndexRange(columnRange); 185 if (columnRange.first <= column && column< columnRange.first + columnRange.second)185 if (columnRange.first <= static_cast<unsigned>(column) && static_cast<unsigned>(column) < columnRange.first + columnRange.second) 186 186 return allColumnHeaders[k]->wrapper(); 187 187 } … … 198 198 unsigned rowCount = allRowHeaders.size(); 199 199 for (unsigned k = 0; k < rowCount; ++k) { 200 pair< int, int> rowRange;200 pair<unsigned, unsigned> rowRange; 201 201 AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allRowHeaders.at(k).get()); 202 202 cell->rowIndexRange(rowRange); 203 if (rowRange.first <= row && row< rowRange.first + rowRange.second)203 if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second) 204 204 return allRowHeaders[k]->wrapper(); 205 205 } -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r144237 r144727 2382 2382 if (m_object->isTableCell()) { 2383 2383 if ([attributeName isEqualToString:NSAccessibilityRowIndexRangeAttribute]) { 2384 pair< int, int> rowRange;2384 pair<unsigned, unsigned> rowRange; 2385 2385 static_cast<AccessibilityTableCell*>(m_object)->rowIndexRange(rowRange); 2386 2386 return [NSValue valueWithRange:NSMakeRange(rowRange.first, rowRange.second)]; 2387 2387 } 2388 2388 if ([attributeName isEqualToString:NSAccessibilityColumnIndexRangeAttribute]) { 2389 pair< int, int> columnRange;2389 pair<unsigned, unsigned> columnRange; 2390 2390 static_cast<AccessibilityTableCell*>(m_object)->columnIndexRange(columnRange); 2391 2391 return [NSValue valueWithRange:NSMakeRange(columnRange.first, columnRange.second)]; -
trunk/Source/WebCore/rendering/RenderTableSection.h
r140640 r144727 154 154 } 155 155 156 RenderTableRow* rowRendererAt(unsigned row) const { return m_grid[row].rowRenderer; } 157 156 158 void appendColumn(unsigned pos); 157 159 void splitColumn(unsigned pos, unsigned first); -
trunk/Source/WebKit/chromium/ChangeLog
r144725 r144727 1 2013-03-04 Chris Fleizach <cfleizach@apple.com> 2 3 AX: cellForColumnAndRow fails for tables with hidden table cells 4 https://bugs.webkit.org/show_bug.cgi?id=110050 5 6 Reviewed by Tim Horton. 7 8 * src/WebAccessibilityObject.cpp: 9 (WebKit::WebAccessibilityObject::cellColumnIndex): 10 (WebKit::WebAccessibilityObject::cellColumnSpan): 11 (WebKit::WebAccessibilityObject::cellRowIndex): 12 (WebKit::WebAccessibilityObject::cellRowSpan): 13 1 14 2013-03-04 Kunihiko Sakamoto <ksakamoto@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/src/WebAccessibilityObject.cpp
r141655 r144727 900 900 return 0; 901 901 902 pair< int, int> columnRange;902 pair<unsigned, unsigned> columnRange; 903 903 static_cast<WebCore::AccessibilityTableCell*>(m_private.get())->columnIndexRange(columnRange); 904 904 return columnRange.first; … … 913 913 return 0; 914 914 915 pair< int, int> columnRange;915 pair<unsigned, unsigned> columnRange; 916 916 static_cast<WebCore::AccessibilityTableCell*>(m_private.get())->columnIndexRange(columnRange); 917 917 return columnRange.second; … … 926 926 return 0; 927 927 928 pair< int, int> rowRange;928 pair<unsigned, unsigned> rowRange; 929 929 static_cast<WebCore::AccessibilityTableCell*>(m_private.get())->rowIndexRange(rowRange); 930 930 return rowRange.first; … … 939 939 return 0; 940 940 941 pair< int, int> rowRange;941 pair<unsigned, unsigned> rowRange; 942 942 static_cast<WebCore::AccessibilityTableCell*>(m_private.get())->rowIndexRange(rowRange); 943 943 return rowRange.second;
Note: See TracChangeset
for help on using the changeset viewer.