Title: [179065] branches/safari-600.1.4.15-branch

Diff

Modified: branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog (179064 => 179065)


--- branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog	2015-01-24 17:00:30 UTC (rev 179064)
+++ branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog	2015-01-24 17:27:38 UTC (rev 179065)
@@ -1,5 +1,19 @@
 2015-01-24  David Kilzer  <[email protected]>
 
+        Merge r174860.
+
+    2014-10-18  Chris Fleizach  <[email protected]>
+
+        AX: Tables with <colgroups> are not reporting table column headers
+        https://bugs.webkit.org/show_bug.cgi?id=137846
+
+        Reviewed by Mario Sanchez Prada.
+
+        * accessibility/table-column-headers-with-captions-expected.txt: Added.
+        * accessibility/table-column-headers-with-captions.html: Added.
+
+2015-01-24  David Kilzer  <[email protected]>
+
         Merge r175085.
 
     2014-10-22  Simon Fraser  <[email protected]>

Added: branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions-expected.txt (0 => 179065)


--- branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions-expected.txt	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions-expected.txt	2015-01-24 17:27:38 UTC (rev 179065)
@@ -0,0 +1,14 @@
+caption
+header1	header2
+a	b
+This tests that a table with a caption and an empty colgroup will still correctly report its headers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS colHeaders[0].isEqual(table.rowAtIndex(0).childAtIndex(0)) is true
+PASS colHeaders[1].isEqual(table.rowAtIndex(0).childAtIndex(1)) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions.html (0 => 179065)


--- branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions.html	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/accessibility/table-column-headers-with-captions.html	2015-01-24 17:27:38 UTC (rev 179065)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body id="body">
+
+<table id="table" width="100%" border="0" cellspacing="2" cellpadding="1">
+    <caption>caption</caption>
+    <colgroup width="100%" span="2"><col width="50%"><col width="50%"></colgroup>
+    <tbody>
+        <tr><th>header1</th><th>header2</th></tr>
+        <tr><td>a</td><td>b</td></tr>
+    </tbody>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that a table with a caption and an empty colgroup will still correctly report its headers.");
+
+    if (window.accessibilityController) {
+
+        var table = accessibilityController.accessibleElementById("table");
+        var colHeaders = table.columnHeaders();
+
+        shouldBeTrue("colHeaders[0].isEqual(table.rowAtIndex(0).childAtIndex(0))");
+        shouldBeTrue("colHeaders[1].isEqual(table.rowAtIndex(0).childAtIndex(1))");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179064 => 179065)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-24 17:00:30 UTC (rev 179064)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-24 17:27:38 UTC (rev 179065)
@@ -1,5 +1,25 @@
 2015-01-24  David Kilzer  <[email protected]>
 
+        Merge r174860.
+
+    2014-10-18  Chris Fleizach  <[email protected]>
+
+        AX: Tables with <colgroups> are not reporting table column headers
+        https://bugs.webkit.org/show_bug.cgi?id=137846
+
+        Reviewed by Mario Sanchez Prada.
+
+        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):
+
+2015-01-24  David Kilzer  <[email protected]>
+
         Merge r175085.
 
     2014-10-22  Simon Fraser  <[email protected]>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (179064 => 179065)


--- branches/safari-600.1.4.15-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2015-01-24 17:00:30 UTC (rev 179064)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2015-01-24 17:27:38 UTC (rev 179065)
@@ -102,10 +102,12 @@
     if (headerObject)
         return headerObject;
     
-    // now try for <th> tags in the first body
-    headerObject = headerObjectForSection(table->firstBody(), true);
-
-    return headerObject;
+    RenderTableSection* bodySection = table->firstBody();
+    while (bodySection && bodySection->isAnonymous())
+        bodySection = table->sectionBelow(bodySection, SkipEmptySections);
+    
+    // now try for <th> tags in the first body. If the first body is 
+    return headerObjectForSection(bodySection, true);
 }
 
 AccessibilityObject* AccessibilityTableColumn::headerObjectForSection(RenderTableSection* section, bool thTagRequired)
@@ -123,22 +125,30 @@
     RenderTableCell* cell = 0;
     // also account for cells that have a span
     for (int testCol = m_columnIndex; testCol >= 0; --testCol) {
-        RenderTableCell* testCell = section->primaryCellAt(0, testCol);
-        if (!testCell)
-            continue;
         
-        // we've reached a cell that doesn't even overlap our column 
-        // it can't be our header
-        if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex)
+        // Run down the rows in case initial rows are invalid (like when a <caption> is used).
+        unsigned rowCount = section->numRows();
+        for (unsigned testRow = 0; testRow < rowCount; testRow++) {
+            RenderTableCell* testCell = section->primaryCellAt(testRow, testCol);
+            // No cell at this index, keep checking more rows and columns.
+            if (!testCell)
+                continue;
+            
+            // If we've reached a cell that doesn't even overlap our column it can't be the header.
+            if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex)
+                break;
+            
+            // If this does not have an element (like a <caption>) then check the next row
+            if (!testCell->element())
+                continue;
+            
+            // If th is required, but we found an element that doesn't have a th tag, we can stop looking.
+            if (thTagRequired && !testCell->element()->hasTagName(thTag))
+                break;
+            
+            cell = testCell;
             break;
-        
-        if (!testCell->element())
-            continue;
-        
-        if (thTagRequired && !testCell->element()->hasTagName(thTag))
-            continue;
-        
-        cell = testCell;
+        }
     }
     
     if (!cell)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to