Changeset 188769 in webkit


Ignore:
Timestamp:
Aug 21, 2015 12:55:53 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
https://bugs.webkit.org/show_bug.cgi?id=148293

Patch by Doug Russell <d_russell@apple.com> on 2015-08-21
Reviewed by Chris Fleizach.

When RenderTableRows are anonymous, they may not be added to the accessible data
table's internal row list. However, when calculating the row range for a cell,
we were still accounting for those anonymous sections.
Change how the row range is calculated to directly ask the accessible parent row
for its index. This will ensure it’s more inline with what’s being represented to
the accessibility API.

Source/WebCore:

Test: accessibility/aria-table-content.html

  • accessibility/AccessibilityTableCell.cpp:

(WebCore::AccessibilityTableCell::parentRow):
(WebCore::AccessibilityTableCell::rowIndexRange):

  • accessibility/AccessibilityTableCell.h:

LayoutTests:

  • accessibility/aria-table-content-expected.txt: Added.
  • accessibility/aria-table-content.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r188768 r188769  
     12015-08-21  Doug Russell  <d_russell@apple.com>
     2
     3        AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
     4        https://bugs.webkit.org/show_bug.cgi?id=148293
     5
     6        Reviewed by Chris Fleizach.
     7
     8        When RenderTableRows are anonymous, they may not be added to the accessible data
     9        table's internal row list. However, when calculating the row range for a cell,
     10        we were still accounting for those anonymous sections.
     11        Change how the row range is calculated to directly ask the accessible parent row
     12        for its index. This will ensure it’s more inline with what’s being represented to
     13        the accessibility API.
     14
     15        * accessibility/aria-table-content-expected.txt: Added.
     16        * accessibility/aria-table-content.html: Added.
     17
    1182015-08-21  Joseph Pecoraro  <pecoraro@apple.com>
    219
  • trunk/Source/WebCore/ChangeLog

    r188768 r188769  
     12015-08-21  Doug Russell  <d_russell@apple.com>
     2
     3        AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
     4        https://bugs.webkit.org/show_bug.cgi?id=148293
     5
     6        Reviewed by Chris Fleizach.
     7
     8        When RenderTableRows are anonymous, they may not be added to the accessible data
     9        table's internal row list. However, when calculating the row range for a cell,
     10        we were still accounting for those anonymous sections.
     11        Change how the row range is calculated to directly ask the accessible parent row
     12        for its index. This will ensure it’s more inline with what’s being represented to
     13        the accessibility API.
     14
     15        Test: accessibility/aria-table-content.html
     16
     17        * accessibility/AccessibilityTableCell.cpp:
     18        (WebCore::AccessibilityTableCell::parentRow):
     19        (WebCore::AccessibilityTableCell::rowIndexRange):
     20        * accessibility/AccessibilityTableCell.h:
     21
    1222015-08-21  Joseph Pecoraro  <pecoraro@apple.com>
    223
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp

    r188203 r188769  
    303303    }
    304304}
    305    
     305
     306AccessibilityTableRow* AccessibilityTableCell::parentRow() const
     307{
     308    AccessibilityObject* parent = parentObjectUnignored();
     309    if (!is<AccessibilityTableRow>(*parent))
     310        return nullptr;
     311    return downcast<AccessibilityTableRow>(parent);
     312}
     313
    306314void AccessibilityTableCell::rowIndexRange(std::pair<unsigned, unsigned>& rowRange) const
    307315{
     
    310318   
    311319    RenderTableCell& renderCell = downcast<RenderTableCell>(*m_renderer);
    312     rowRange.first = renderCell.rowIndex();
    313320    rowRange.second = renderCell.rowSpan();
    314321   
    315     // since our table might have multiple sections, we have to offset our row appropriately
    316     RenderTableSection* section = renderCell.section();
    317     RenderTable* table = renderCell.table();
    318     if (!table || !section)
    319         return;
    320 
    321     RenderTableSection* footerSection = table->footer();
    322     unsigned rowOffset = 0;
    323     for (RenderTableSection* tableSection = table->topSection(); tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
    324         // Don't add row offsets for bottom sections that are placed in before the body section.
    325         if (tableSection == footerSection)
    326             continue;
    327         if (tableSection == section) {
    328             // If the table section is anonymous, we should to use the parent row's API to get the rowIndex
    329             if (tableSection->isAnonymous()) {
    330                 AccessibilityObject* parent = parentObjectUnignored();
    331                 if (is<AccessibilityTableRow>(*parent))
    332                     rowOffset = downcast<AccessibilityTableRow>(*parent).rowIndex();
    333             }
    334             break;
    335         }
    336         rowOffset += tableSection->numRows();
    337     }
    338 
    339     rowRange.first += rowOffset;
     322    if (AccessibilityTableRow* parentRow = this->parentRow())
     323        rowRange.first = parentRow->rowIndex();
    340324}
    341325   
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.h

    r177733 r188769  
    3535   
    3636class AccessibilityTable;
    37    
     37class AccessibilityTableRow;
     38
    3839class AccessibilityTableCell : public AccessibilityRenderObject {
    3940public:
     
    5758    explicit AccessibilityTableCell(RenderObject*);
    5859
     60    AccessibilityTableRow* parentRow() const;
    5961    virtual AccessibilityTable* parentTable() const;
    6062    virtual AccessibilityRole determineAccessibilityRole() override final;
Note: See TracChangeset for help on using the changeset viewer.