Changeset 174860 in webkit


Ignore:
Timestamp:
Oct 18, 2014 8:20:38 AM (10 years ago)
Author:
Chris Fleizach
Message:

AX: Tables with <colgroups> are not reporting table column headers
https://bugs.webkit.org/show_bug.cgi?id=137846

Reviewed by Mario Sanchez Prada.

Source/WebCore:

The code to search for header objects was getting stuck on anonymous RenderTableSections.
We also need to check more rows for headers, in case the first row or more is not visible or is empty.

Test: accessibility/table-column-headers-with-captions.html

  • accessibility/AccessibilityTableColumn.cpp:

(WebCore::AccessibilityTableColumn::headerObject):
(WebCore::AccessibilityTableColumn::headerObjectForSection):

LayoutTests:

  • accessibility/table-column-headers-with-captions-expected.txt: Added.
  • accessibility/table-column-headers-with-captions.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r174847 r174860  
     12014-10-18  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Tables with <colgroups> are not reporting table column headers
     4        https://bugs.webkit.org/show_bug.cgi?id=137846
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        * accessibility/table-column-headers-with-captions-expected.txt: Added.
     9        * accessibility/table-column-headers-with-captions.html: Added.
     10
    1112014-10-17  Michael Saboff  <msaboff@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r174859 r174860  
     12014-10-18  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Tables with <colgroups> are not reporting table column headers
     4        https://bugs.webkit.org/show_bug.cgi?id=137846
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        The code to search for header objects was getting stuck on anonymous RenderTableSections.
     9        We also need to check more rows for headers, in case the first row or more is not visible or is empty.
     10
     11        Test: accessibility/table-column-headers-with-captions.html
     12
     13        * accessibility/AccessibilityTableColumn.cpp:
     14        (WebCore::AccessibilityTableColumn::headerObject):
     15        (WebCore::AccessibilityTableColumn::headerObjectForSection):
     16
    1172014-10-18  KwangHyuk Kim  <hyuki.kim@samsung.com>
    218
  • trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp

    r174653 r174860  
    9999        return headerObject;
    100100   
    101     // now try for <th> tags in the first body
    102     return headerObjectForSection(table.firstBody(), true);
     101    RenderTableSection* bodySection = table.firstBody();
     102    while (bodySection && bodySection->isAnonymous())
     103        bodySection = table.sectionBelow(bodySection, SkipEmptySections);
     104   
     105    // now try for <th> tags in the first body. If the first body is
     106    return headerObjectForSection(bodySection, true);
    103107}
    104108
     
    118122    // also account for cells that have a span
    119123    for (int testCol = m_columnIndex; testCol >= 0; --testCol) {
    120         RenderTableCell* testCell = section->primaryCellAt(0, testCol);
    121         if (!testCell)
    122             continue;
    123124       
    124         // we've reached a cell that doesn't even overlap our column
    125         // it can't be our header
    126         if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex)
     125        // Run down the rows in case initial rows are invalid (like when a <caption> is used).
     126        unsigned rowCount = section->numRows();
     127        for (unsigned testRow = 0; testRow < rowCount; testRow++) {
     128            RenderTableCell* testCell = section->primaryCellAt(testRow, testCol);
     129            // No cell at this index, keep checking more rows and columns.
     130            if (!testCell)
     131                continue;
     132           
     133            // If we've reached a cell that doesn't even overlap our column it can't be the header.
     134            if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex)
     135                break;
     136           
     137            // If this does not have an element (like a <caption>) then check the next row
     138            if (!testCell->element())
     139                continue;
     140           
     141            // If th is required, but we found an element that doesn't have a th tag, we can stop looking.
     142            if (thTagRequired && !testCell->element()->hasTagName(thTag))
     143                break;
     144           
     145            cell = testCell;
    127146            break;
    128        
    129         if (!testCell->element())
    130             continue;
    131        
    132         if (thTagRequired && !testCell->element()->hasTagName(thTag))
    133             continue;
    134        
    135         cell = testCell;
     147        }
    136148    }
    137149   
Note: See TracChangeset for help on using the changeset viewer.