Title: [261729] trunk/Source/WebCore
Revision
261729
Author
andresg...@apple.com
Date
2020-05-14 19:28:43 -0700 (Thu, 14 May 2020)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261728 => 261729)


--- trunk/Source/WebCore/ChangeLog	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/ChangeLog	2020-05-15 02:28:43 UTC (rev 261729)
@@ -1,3 +1,37 @@
+2020-05-14  Andres Gonzalez  <andresg...@apple.com>
+
+        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:
+
 2020-05-14  Timothy Hatcher  <timo...@apple.com>
 
         Add baseURL version of _WKUserStyleSheet forWKWebView.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-05-15 02:28:43 UTC (rev 261729)
@@ -160,6 +160,8 @@
     std::pair<unsigned, unsigned> rowIndexRange() const override { return { 0, 1 }; }
     // Returns the start location and column span of the cell.
     std::pair<unsigned, unsigned> columnIndexRange() const override { return { 0, 1 }; }
+    bool isColumnHeaderCell() const override { return false; }
+    bool isRowHeaderCell() const override { return false; }
     int axColumnIndex() const override { return -1; }
     int axRowIndex() const override { return -1; }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2020-05-15 02:28:43 UTC (rev 261729)
@@ -563,6 +563,8 @@
     virtual std::pair<unsigned, unsigned> rowIndexRange() const = 0;
     // Returns the start location and column span of the cell.
     virtual std::pair<unsigned, unsigned> columnIndexRange() const = 0;
+    virtual bool isColumnHeaderCell() const = 0;
+    virtual bool isRowHeaderCell() const = 0;
     virtual int axColumnIndex() const = 0;
     virtual int axRowIndex() const = 0;
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2020-05-15 02:28:43 UTC (rev 261729)
@@ -619,7 +619,7 @@
     return level;
 }
 
-AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column, unsigned row)
+AXCoreObject* AccessibilityTable::cellForColumnAndRow(unsigned column, unsigned row)
 {
     updateChildrenIfNecessary();
     if (column >= columnCount() || row >= rowCount())
@@ -634,8 +634,7 @@
         for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children.size()), column + 1); colIndexCounter > 0; --colIndexCounter) {
             unsigned colIndex = colIndexCounter - 1;
             AXCoreObject* child = children[colIndex].get();
-            ASSERT(is<AccessibilityTableCell>(*child));
-            if (!is<AccessibilityTableCell>(*child))
+            if (!child)
                 continue;
 
             auto columnRange = child->columnIndexRange();
@@ -643,7 +642,7 @@
 
             if ((column >= columnRange.first && column < (columnRange.first + columnRange.second))
                 && (row >= rowRange.first && row < (rowRange.first + rowRange.second)))
-                return downcast<AccessibilityTableCell>(child);
+                return child;
         }
     }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.h (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityTable.h	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.h	2020-05-15 02:28:43 UTC (rev 261729)
@@ -61,7 +61,7 @@
 
     // all the cells in the table
     AccessibilityChildrenVector cells() override;
-    AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row) override;
+    AXCoreObject* cellForColumnAndRow(unsigned column, unsigned row) override;
 
     AccessibilityChildrenVector columnHeaders() override;
     AccessibilityChildrenVector rowHeaders() override;

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2020-05-15 02:28:43 UTC (rev 261729)
@@ -200,7 +200,7 @@
     return false;
 }
 
-bool AccessibilityTableCell::isTableCellInSameRowGroup(AccessibilityTableCell* otherTableCell)
+bool AccessibilityTableCell::isTableCellInSameRowGroup(AXCoreObject* otherTableCell)
 {
     Node* parentNode = node();
     for ( ; parentNode; parentNode = parentNode->parentNode()) {
@@ -217,8 +217,7 @@
     return otherParentNode == parentNode;
 }
 
-
-bool AccessibilityTableCell::isTableCellInSameColGroup(AccessibilityTableCell* tableCell)
+bool AccessibilityTableCell::isTableCellInSameColGroup(AXCoreObject* tableCell)
 {
     auto colRange = columnIndexRange();
     auto otherColRange = tableCell->columnIndexRange();
@@ -255,7 +254,7 @@
     auto colRange = columnIndexRange();
 
     for (unsigned row = 0; row < rowRange.first; row++) {
-        AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(colRange.first, row);
+        auto* tableCell = parent->cellForColumnAndRow(colRange.first, row);
         if (!tableCell || tableCell == this || headers.contains(tableCell))
             continue;
 
@@ -280,7 +279,7 @@
     auto colRange = columnIndexRange();
 
     for (unsigned column = 0; column < colRange.first; column++) {
-        AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(column, rowRange.first);
+        auto* tableCell = parent->cellForColumnAndRow(column, rowRange.first);
         if (!tableCell || tableCell == this || headers.contains(tableCell))
             continue;
         

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.h	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.h	2020-05-15 02:28:43 UTC (rev 261729)
@@ -42,8 +42,8 @@
 
     bool isTableCell() const final;
     bool isTableHeaderCell() const;
-    bool isColumnHeaderCell() const;
-    bool isRowHeaderCell() const;
+    bool isColumnHeaderCell() const override;
+    bool isRowHeaderCell() const override;
 
     // Returns the start location and row span of the cell.
     std::pair<unsigned, unsigned> rowIndexRange() const override;
@@ -77,8 +77,8 @@
     String expandedTextValue() const final;
     bool supportsExpandedTextValue() const final;
 
-    bool isTableCellInSameRowGroup(AccessibilityTableCell*);
-    bool isTableCellInSameColGroup(AccessibilityTableCell*);
+    bool isTableCellInSameRowGroup(AXCoreObject*);
+    bool isTableCellInSameColGroup(AXCoreObject*);
 };
 
 } // namespace WebCore 

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (261728 => 261729)


--- trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2020-05-15 02:28:43 UTC (rev 261729)
@@ -194,7 +194,7 @@
     int numRows = parentTable.rowCount();
     
     for (int i = 0; i < numRows; ++i) {
-        AccessibilityTableCell* cell = parentTable.cellForColumnAndRow(m_columnIndex, i);
+        auto* cell = parentTable.cellForColumnAndRow(m_columnIndex, i);
         if (!cell)
             continue;
         

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp (261728 => 261729)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp	2020-05-15 02:28:43 UTC (rev 261729)
@@ -54,20 +54,18 @@
     return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(table));
 }
 
-static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
+static AXCoreObject* cell(AtkTable* table, guint row, guint column)
 {
-    AccessibilityObject* accTable = core(table);
-    if (is<AccessibilityTable>(*accTable))
-        return downcast<AccessibilityTable>(*accTable).cellForColumnAndRow(column, row);
-    return nullptr;
+    auto* accTable = core(table);
+    return accTable ? accTable->cellForColumnAndRow(column, row) : nullptr;
 }
 
-static gint cellIndex(AccessibilityTableCell* axCell, AccessibilityTable* axTable)
+static gint cellIndex(AXCoreObject* axCell, AccessibilityTable* axTable)
 {
     // Calculate the cell's index as if we had a traditional Gtk+ table in
     // which cells are all direct children of the table, arranged row-first.
     auto allCells = axTable->cells();
-    AccessibilityObject::AccessibilityChildrenVector::iterator position;
+    AXCoreObject::AccessibilityChildrenVector::iterator position;
     position = std::find(allCells.begin(), allCells.end(), axCell);
     if (position == allCells.end())
         return -1;
@@ -90,7 +88,7 @@
     g_return_val_if_fail(ATK_TABLE(table), 0);
     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
 
-    AccessibilityTableCell* axCell = cell(table, row, column);
+    auto* axCell = cell(table, row, column);
     if (!axCell)
         return 0;
 
@@ -108,7 +106,7 @@
     g_return_val_if_fail(ATK_TABLE(table), -1);
     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1);
 
-    AccessibilityTableCell* axCell = cell(table, row, column);
+    auto* axCell = cell(table, row, column);
     AccessibilityTable* axTable = downcast<AccessibilityTable>(core(table));
     return cellIndex(axCell, axTable);
 }
@@ -174,7 +172,7 @@
     g_return_val_if_fail(ATK_TABLE(table), 0);
     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
 
-    AccessibilityTableCell* axCell = cell(table, row, column);
+    auto* axCell = cell(table, row, column);
     if (axCell) {
         auto columnRange = axCell->columnIndexRange();
         return columnRange.second;
@@ -187,7 +185,7 @@
     g_return_val_if_fail(ATK_TABLE(table), 0);
     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
 
-    AccessibilityTableCell* axCell = cell(table, row, column);
+    auto* axCell = cell(table, row, column);
     if (axCell) {
         auto rowRange = axCell->rowIndexRange();
         return rowRange.second;

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (261728 => 261729)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2020-05-15 02:28:43 UTC (rev 261729)
@@ -1267,10 +1267,8 @@
     if (!table)
         return nil;
 
-    AccessibilityTableCell* cell = table->cellForColumnAndRow(column, row);
-    if (!cell)
-        return nil;
-    return cell->wrapper();
+    auto* cell = table->cellForColumnAndRow(column, row);
+    return cell ? cell->wrapper() : nil;
 }
 
 - (NSUInteger)accessibilityRowCount

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (261728 => 261729)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-15 02:28:43 UTC (rev 261729)
@@ -60,7 +60,7 @@
 void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot)
 {
     setProperty(AXPropertyName::ARIALandmarkRoleDescription, object.ariaLandmarkRoleDescription().isolatedCopy());
-    setProperty(AXPropertyName::AccessibilityDescription, object.accessibilityDescription());
+    setProperty(AXPropertyName::AccessibilityDescription, object.accessibilityDescription().isolatedCopy());
     setProperty(AXPropertyName::BoundingBoxRect, object.boundingBoxRect());
     setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
     setProperty(AXPropertyName::ElementRect, object.elementRect());
@@ -250,6 +250,8 @@
         setProperty(AXPropertyName::RowIndexRange, object.rowIndexRange());
         setObjectVectorProperty(AXPropertyName::ColumnHeaders, object.columnHeaders());
         setObjectVectorProperty(AXPropertyName::RowHeaders, object.rowHeaders());
+        setProperty(AXPropertyName::IsColumnHeaderCell, object.isColumnHeaderCell());
+        setProperty(AXPropertyName::IsRowHeaderCell, object.isRowHeaderCell());
         setProperty(AXPropertyName::AXColumnIndex, object.axColumnIndex());
         setProperty(AXPropertyName::AXRowIndex, object.axRowIndex());
     }

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (261728 => 261729)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-05-15 02:00:30 UTC (rev 261728)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-05-15 02:28:43 UTC (rev 261729)
@@ -174,6 +174,7 @@
         IsBusy,
         IsChecked,
         IsCollapsed,
+        IsColumnHeaderCell,
         IsControl,
         IsDataTable,
         IsDescriptionList,
@@ -238,6 +239,7 @@
         IsProgressIndicator,
         IsRangeControl,
         IsRequired,
+        IsRowHeaderCell,
         IsScrollbar,
         IsSearchField,
         IsSelected,
@@ -426,6 +428,8 @@
     std::pair<unsigned, unsigned> rowIndexRange() const override { return pairAttributeValue<unsigned>(AXPropertyName::RowIndexRange); }
     // Returns the start location and column span of the cell.
     std::pair<unsigned, unsigned> columnIndexRange() const override { return pairAttributeValue<unsigned>(AXPropertyName::ColumnIndexRange); }
+    bool isColumnHeaderCell() const override { return boolAttributeValue(AXPropertyName::IsColumnHeaderCell); }
+    bool isRowHeaderCell() const override { return boolAttributeValue(AXPropertyName::IsRowHeaderCell); }
     int axColumnIndex() const override { return intAttributeValue(AXPropertyName::AXColumnIndex); }
     int axRowIndex() const override { return intAttributeValue(AXPropertyName::AXRowIndex); }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to