Changeset 216123 in webkit


Ignore:
Timestamp:
May 3, 2017 10:18:43 AM (7 years ago)
Author:
jdiggs@igalia.com
Message:

AX: Treat cells with ARIA table cell properties as cells
https://bugs.webkit.org/show_bug.cgi?id=171178

Reviewed by Chris Fleizach.

Source/WebCore:

Add the following checks to heuristics in AccessibilityTable::isDataTable():

  1. If the author has provided a valid aria-rowcount or aria-colcount value on the table element, expose it as a data table.
  2. If the author has provided a valid aria-colindex or aria-rowindex on the cell element, expose it as a data table.
  3. If the author has provided a valid aria-rowindex on the row element, expose it as a data table.
  4. If the author has provided a value for aria-colspan or aria-rowspan on a cell, expose it as a data table (even though we are supposed to ignore the value for the purpose of exposing the span via platform accessibility APIs)

Remove the heuristic that a table with only one cell is "not a good AXTable candidate."
It prevents us from ever doing the above checks.

Test: accessibility/minimal-table-with-aria-is-data-table.html

  • accessibility/AccessibilityTable.cpp:

(WebCore::AccessibilityTable::isDataTable):

LayoutTests:

  • accessibility/minimal-table-with-aria-is-data-table-expected.txt: Added.
  • accessibility/minimal-table-with-aria-is-data-table.html: Added.
  • platform/gtk/accessibility/minimal-table-with-aria-is-data-table-expected.txt: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r216122 r216123  
     12017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: Treat cells with ARIA table cell properties as cells
     4        https://bugs.webkit.org/show_bug.cgi?id=171178
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/minimal-table-with-aria-is-data-table-expected.txt: Added.
     9        * accessibility/minimal-table-with-aria-is-data-table.html: Added.
     10        * platform/gtk/accessibility/minimal-table-with-aria-is-data-table-expected.txt: Added.
     11
    1122017-05-03  Andy VanWagoner  <thetalecrafter@gmail.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r216121 r216123  
     12017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: Treat cells with ARIA table cell properties as cells
     4        https://bugs.webkit.org/show_bug.cgi?id=171178
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Add the following checks to heuristics in AccessibilityTable::isDataTable():
     9        1. If the author has provided a valid aria-rowcount or aria-colcount value on
     10           the table element, expose it as a data table.
     11        2. If the author has provided a valid aria-colindex or aria-rowindex on the
     12           cell element, expose it as a data table.
     13        3. If the author has provided a valid aria-rowindex on the row element, expose
     14           it as a data table.
     15        4. If the author has provided a value for aria-colspan or aria-rowspan on a cell,
     16           expose it as a data table (even though we are supposed to ignore the value for
     17           the purpose of exposing the span via platform accessibility APIs)
     18
     19        Remove the heuristic that a table with only one cell is "not a good AXTable candidate."
     20        It prevents us from ever doing the above checks.
     21
     22        Test: accessibility/minimal-table-with-aria-is-data-table.html
     23
     24        * accessibility/AccessibilityTable.cpp:
     25        (WebCore::AccessibilityTable::isDataTable):
     26
    1272017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
    228
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r216009 r216123  
    155155        return false;
    156156   
     157    // If the author has used ARIA to specify a valid column or row count, assume they
     158    // want us to treat the table as a data table.
     159    int ariaColumnCount = getAttribute(aria_colcountAttr).toInt();
     160    if (ariaColumnCount == -1 || ariaColumnCount > 0)
     161        return true;
     162
     163    int ariaRowCount = getAttribute(aria_rowcountAttr).toInt();
     164    if (ariaRowCount == -1 || ariaRowCount > 0)
     165        return true;
     166
    157167    RenderTable& table = downcast<RenderTable>(*m_renderer);
    158168    // go through the cell's and check for tell-tale signs of "data" table status
     
    166176    int numRows = firstBody->numRows();
    167177   
    168     // If there's only one cell, it's not a good AXTable candidate.
    169     if (numRows == 1 && numCols == 1)
    170         return false;
    171 
    172178    // If there are at least 20 rows, we'll call it a data table.
    173179    if (numRows >= 20)
     
    182188    //   1) must have at least one valid cell (and)
    183189    //   2) at least half of cells have borders (or)
    184     //   3) at least half of cells have different bg colors than the table, and there is cell spacing
     190    //   3) at least half of cells have different bg colors than the table, and there is cell spacing (or)
     191    //   4) the valid cell has an ARIA cell-related property
    185192    unsigned validCellCount = 0;
    186193    unsigned borderedCellCount = 0;
     
    228235                    return true;
    229236            }
     237
     238            // If the author has used ARIA to specify a valid column or row index, assume they want us
     239            // to treat the table as a data table.
     240            int ariaColumnIndex = cellElement->attributeWithoutSynchronization(aria_colindexAttr).toInt();
     241            if (ariaColumnIndex >= 1)
     242                return true;
     243
     244            int ariaRowIndex = cellElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
     245            if (ariaRowIndex >= 1)
     246                return true;
     247
     248            if (auto cellParentElement = cellElement->parentElement()) {
     249                ariaRowIndex = cellParentElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
     250                if (ariaRowIndex >= 1)
     251                    return true;
     252            }
     253
     254            // If the author has used ARIA to specify a column or row span, we're supposed to ignore
     255            // the value for the purposes of exposing the span. But assume they want us to treat the
     256            // table as a data table.
     257            int ariaColumnSpan = cellElement->attributeWithoutSynchronization(aria_colspanAttr).toInt();
     258            if (ariaColumnSpan >= 1)
     259                return true;
     260
     261            int ariaRowSpan = cellElement->attributeWithoutSynchronization(aria_rowspanAttr).toInt();
     262            if (ariaRowSpan >= 1)
     263                return true;
     264
    230265            const RenderStyle& renderStyle = cell->style();
    231266
Note: See TracChangeset for help on using the changeset viewer.