Changeset 261729 in webkit


Ignore:
Timestamp:
May 14, 2020 7:28:43 PM (4 years ago)
Author:
Andres Gonzalez
Message:

Expose isColumnHeaderCell and isRowHeaderCell through AXCoreObject.
https://bugs.webkit.org/show_bug.cgi?id=211919

Reviewed by Chris Fleizach.

Multiple tests including accessibility/crash-table-recursive-layout.html.

  • Expose isColumn/RowHeaderCell through AXCoreObject in order to make the

return value of AccessibilityTable::cellForColumnAndRow an AXCoreObject.

  • Implemented these methods for AXIsolatedObject.
  • isolatedCopy the accessibilityDescription property.
  • accessibility/AccessibilityObject.h:
  • accessibility/AccessibilityObjectInterface.h:
  • accessibility/AccessibilityTable.cpp:

(WebCore::AccessibilityTable::cellForColumnAndRow): Removed incorrect
assert since children are AXCoreObjects and not necessarily AccessibilityTableCells.

  • accessibility/AccessibilityTable.h:
  • accessibility/AccessibilityTableCell.cpp:

(WebCore::AccessibilityTableCell::isTableCellInSameRowGroup):
(WebCore::AccessibilityTableCell::isTableCellInSameColGroup):
(WebCore::AccessibilityTableCell::columnHeaders):
(WebCore::AccessibilityTableCell::rowHeaders):

  • accessibility/AccessibilityTableCell.h:
  • accessibility/AccessibilityTableColumn.cpp:

(WebCore::AccessibilityTableColumn::addChildren):

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]):

  • accessibility/isolatedtree/AXIsolatedObject.cpp:

(WebCore::AXIsolatedObject::initializeAttributeData):

  • accessibility/isolatedtree/AXIsolatedObject.h:
Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261726 r261729  
     12020-05-14  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Expose isColumnHeaderCell and isRowHeaderCell through AXCoreObject.
     4        https://bugs.webkit.org/show_bug.cgi?id=211919
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Multiple tests including accessibility/crash-table-recursive-layout.html.
     9
     10        - Expose isColumn/RowHeaderCell through AXCoreObject in order to make the
     11        return value of AccessibilityTable::cellForColumnAndRow an AXCoreObject.
     12        - Implemented these methods for AXIsolatedObject.
     13        - isolatedCopy the accessibilityDescription property.
     14
     15        * accessibility/AccessibilityObject.h:
     16        * accessibility/AccessibilityObjectInterface.h:
     17        * accessibility/AccessibilityTable.cpp:
     18        (WebCore::AccessibilityTable::cellForColumnAndRow): Removed incorrect
     19        assert since children are AXCoreObjects and not necessarily AccessibilityTableCells.
     20        * accessibility/AccessibilityTable.h:
     21        * accessibility/AccessibilityTableCell.cpp:
     22        (WebCore::AccessibilityTableCell::isTableCellInSameRowGroup):
     23        (WebCore::AccessibilityTableCell::isTableCellInSameColGroup):
     24        (WebCore::AccessibilityTableCell::columnHeaders):
     25        (WebCore::AccessibilityTableCell::rowHeaders):
     26        * accessibility/AccessibilityTableCell.h:
     27        * accessibility/AccessibilityTableColumn.cpp:
     28        (WebCore::AccessibilityTableColumn::addChildren):
     29        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     30        (-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]):
     31        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     32        (WebCore::AXIsolatedObject::initializeAttributeData):
     33        * accessibility/isolatedtree/AXIsolatedObject.h:
     34
    1352020-05-14  Timothy Hatcher  <timothy@apple.com>
    236
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r261705 r261729  
    161161    // Returns the start location and column span of the cell.
    162162    std::pair<unsigned, unsigned> columnIndexRange() const override { return { 0, 1 }; }
     163    bool isColumnHeaderCell() const override { return false; }
     164    bool isRowHeaderCell() const override { return false; }
    163165    int axColumnIndex() const override { return -1; }
    164166    int axRowIndex() const override { return -1; }
  • trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h

    r261705 r261729  
    564564    // Returns the start location and column span of the cell.
    565565    virtual std::pair<unsigned, unsigned> columnIndexRange() const = 0;
     566    virtual bool isColumnHeaderCell() const = 0;
     567    virtual bool isRowHeaderCell() const = 0;
    566568    virtual int axColumnIndex() const = 0;
    567569    virtual int axRowIndex() const = 0;
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r257548 r261729  
    620620}
    621621
    622 AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column, unsigned row)
     622AXCoreObject* AccessibilityTable::cellForColumnAndRow(unsigned column, unsigned row)
    623623{
    624624    updateChildrenIfNecessary();
     
    635635            unsigned colIndex = colIndexCounter - 1;
    636636            AXCoreObject* child = children[colIndex].get();
    637             ASSERT(is<AccessibilityTableCell>(*child));
    638             if (!is<AccessibilityTableCell>(*child))
     637            if (!child)
    639638                continue;
    640639
     
    644643            if ((column >= columnRange.first && column < (columnRange.first + columnRange.second))
    645644                && (row >= rowRange.first && row < (rowRange.first + rowRange.second)))
    646                 return downcast<AccessibilityTableCell>(child);
     645                return child;
    647646        }
    648647    }
  • trunk/Source/WebCore/accessibility/AccessibilityTable.h

    r257200 r261729  
    6262    // all the cells in the table
    6363    AccessibilityChildrenVector cells() override;
    64     AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row) override;
     64    AXCoreObject* cellForColumnAndRow(unsigned column, unsigned row) override;
    6565
    6666    AccessibilityChildrenVector columnHeaders() override;
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp

    r257548 r261729  
    201201}
    202202
    203 bool AccessibilityTableCell::isTableCellInSameRowGroup(AccessibilityTableCell* otherTableCell)
     203bool AccessibilityTableCell::isTableCellInSameRowGroup(AXCoreObject* otherTableCell)
    204204{
    205205    Node* parentNode = node();
     
    218218}
    219219
    220 
    221 bool AccessibilityTableCell::isTableCellInSameColGroup(AccessibilityTableCell* tableCell)
     220bool AccessibilityTableCell::isTableCellInSameColGroup(AXCoreObject* tableCell)
    222221{
    223222    auto colRange = columnIndexRange();
     
    256255
    257256    for (unsigned row = 0; row < rowRange.first; row++) {
    258         AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(colRange.first, row);
     257        auto* tableCell = parent->cellForColumnAndRow(colRange.first, row);
    259258        if (!tableCell || tableCell == this || headers.contains(tableCell))
    260259            continue;
     
    281280
    282281    for (unsigned column = 0; column < colRange.first; column++) {
    283         AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(column, rowRange.first);
     282        auto* tableCell = parent->cellForColumnAndRow(column, rowRange.first);
    284283        if (!tableCell || tableCell == this || headers.contains(tableCell))
    285284            continue;
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.h

    r257548 r261729  
    4343    bool isTableCell() const final;
    4444    bool isTableHeaderCell() const;
    45     bool isColumnHeaderCell() const;
    46     bool isRowHeaderCell() const;
     45    bool isColumnHeaderCell() const override;
     46    bool isRowHeaderCell() const override;
    4747
    4848    // Returns the start location and row span of the cell.
     
    7878    bool supportsExpandedTextValue() const final;
    7979
    80     bool isTableCellInSameRowGroup(AccessibilityTableCell*);
    81     bool isTableCellInSameColGroup(AccessibilityTableCell*);
     80    bool isTableCellInSameRowGroup(AXCoreObject*);
     81    bool isTableCellInSameColGroup(AXCoreObject*);
    8282};
    8383
  • trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp

    r257473 r261729  
    195195   
    196196    for (int i = 0; i < numRows; ++i) {
    197         AccessibilityTableCell* cell = parentTable.cellForColumnAndRow(m_columnIndex, i);
     197        auto* cell = parentTable.cellForColumnAndRow(m_columnIndex, i);
    198198        if (!cell)
    199199            continue;
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp

    r257548 r261729  
    5555}
    5656
    57 static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
    58 {
    59     AccessibilityObject* accTable = core(table);
    60     if (is<AccessibilityTable>(*accTable))
    61         return downcast<AccessibilityTable>(*accTable).cellForColumnAndRow(column, row);
    62     return nullptr;
    63 }
    64 
    65 static gint cellIndex(AccessibilityTableCell* axCell, AccessibilityTable* axTable)
     57static AXCoreObject* cell(AtkTable* table, guint row, guint column)
     58{
     59    auto* accTable = core(table);
     60    return accTable ? accTable->cellForColumnAndRow(column, row) : nullptr;
     61}
     62
     63static gint cellIndex(AXCoreObject* axCell, AccessibilityTable* axTable)
    6664{
    6765    // Calculate the cell's index as if we had a traditional Gtk+ table in
    6866    // which cells are all direct children of the table, arranged row-first.
    6967    auto allCells = axTable->cells();
    70     AccessibilityObject::AccessibilityChildrenVector::iterator position;
     68    AXCoreObject::AccessibilityChildrenVector::iterator position;
    7169    position = std::find(allCells.begin(), allCells.end(), axCell);
    7270    if (position == allCells.end())
     
    9189    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
    9290
    93     AccessibilityTableCell* axCell = cell(table, row, column);
     91    auto* axCell = cell(table, row, column);
    9492    if (!axCell)
    9593        return 0;
     
    109107    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1);
    110108
    111     AccessibilityTableCell* axCell = cell(table, row, column);
     109    auto* axCell = cell(table, row, column);
    112110    AccessibilityTable* axTable = downcast<AccessibilityTable>(core(table));
    113111    return cellIndex(axCell, axTable);
     
    175173    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
    176174
    177     AccessibilityTableCell* axCell = cell(table, row, column);
     175    auto* axCell = cell(table, row, column);
    178176    if (axCell) {
    179177        auto columnRange = axCell->columnIndexRange();
     
    188186    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
    189187
    190     AccessibilityTableCell* axCell = cell(table, row, column);
     188    auto* axCell = cell(table, row, column);
    191189    if (axCell) {
    192190        auto rowRange = axCell->rowIndexRange();
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r260725 r261729  
    12681268        return nil;
    12691269
    1270     AccessibilityTableCell* cell = table->cellForColumnAndRow(column, row);
    1271     if (!cell)
    1272         return nil;
    1273     return cell->wrapper();
     1270    auto* cell = table->cellForColumnAndRow(column, row);
     1271    return cell ? cell->wrapper() : nil;
    12741272}
    12751273
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r261705 r261729  
    6161{
    6262    setProperty(AXPropertyName::ARIALandmarkRoleDescription, object.ariaLandmarkRoleDescription().isolatedCopy());
    63     setProperty(AXPropertyName::AccessibilityDescription, object.accessibilityDescription());
     63    setProperty(AXPropertyName::AccessibilityDescription, object.accessibilityDescription().isolatedCopy());
    6464    setProperty(AXPropertyName::BoundingBoxRect, object.boundingBoxRect());
    6565    setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
     
    251251        setObjectVectorProperty(AXPropertyName::ColumnHeaders, object.columnHeaders());
    252252        setObjectVectorProperty(AXPropertyName::RowHeaders, object.rowHeaders());
     253        setProperty(AXPropertyName::IsColumnHeaderCell, object.isColumnHeaderCell());
     254        setProperty(AXPropertyName::IsRowHeaderCell, object.isRowHeaderCell());
    253255        setProperty(AXPropertyName::AXColumnIndex, object.axColumnIndex());
    254256        setProperty(AXPropertyName::AXRowIndex, object.axRowIndex());
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

    r261705 r261729  
    175175        IsChecked,
    176176        IsCollapsed,
     177        IsColumnHeaderCell,
    177178        IsControl,
    178179        IsDataTable,
     
    239240        IsRangeControl,
    240241        IsRequired,
     242        IsRowHeaderCell,
    241243        IsScrollbar,
    242244        IsSearchField,
     
    427429    // Returns the start location and column span of the cell.
    428430    std::pair<unsigned, unsigned> columnIndexRange() const override { return pairAttributeValue<unsigned>(AXPropertyName::ColumnIndexRange); }
     431    bool isColumnHeaderCell() const override { return boolAttributeValue(AXPropertyName::IsColumnHeaderCell); }
     432    bool isRowHeaderCell() const override { return boolAttributeValue(AXPropertyName::IsRowHeaderCell); }
    429433    int axColumnIndex() const override { return intAttributeValue(AXPropertyName::AXColumnIndex); }
    430434    int axRowIndex() const override { return intAttributeValue(AXPropertyName::AXRowIndex); }
Note: See TracChangeset for help on using the changeset viewer.