<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174675] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174675">174675</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-14 01:18:32 -0700 (Tue, 14 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[AX] Improve AccessibilityTableCell columnHeaders and rowHeaders functions.
https://bugs.webkit.org/show_bug.cgi?id=136818
Patch by Andrzej Badowski <a.badowski@samsung.com> on 2014-10-14
Reviewed by Chris Fleizach.
Source/WebCore:
Take into account that <th> elements can be both the column headers and row headers
improved the operation of two functions: columnHeaders and rowHeaders.
Test: accessibility/table-headers.html
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::isColumnHeaderCell):
A new function that helps the main goal.
(WebCore::AccessibilityTableCell::isRowHeaderCell):
A new function that helps the main goal.
(WebCore::AccessibilityTableCell::columnHeaders):
Use isColumnHeaderCell instead of isTableHeaderCell.
(WebCore::AccessibilityTableCell::rowHeaders):
Use isRowHeaderCell also includes <th> row header element next to the scope attribute.
* accessibility/AccessibilityTableCell.h:
Adds new functions to the header file.
LayoutTests:
* accessibility/table-headers-expected.txt: Added.
* accessibility/table-headers.html: Added.
* platform/mac/accessibility/table-attributes-expected.txt:
* platform/mac/accessibility/table-cells-expected.txt:
* platform/mac/accessibility/table-sections-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitytableattributesexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitytablecellsexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitytablesectionsexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityARIAGridCellcpp">trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityARIAGridCellh">trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityTableCellcpp">trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityTableCellh">trunk/Source/WebCore/accessibility/AccessibilityTableCell.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilitytableheadersexpectedtxt">trunk/LayoutTests/accessibility/table-headers-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitytableheadershtml">trunk/LayoutTests/accessibility/table-headers.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/LayoutTests/ChangeLog        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-10-14 Andrzej Badowski <a.badowski@samsung.com>
+
+ [AX] Improve AccessibilityTableCell columnHeaders and rowHeaders functions.
+ https://bugs.webkit.org/show_bug.cgi?id=136818
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/table-headers-expected.txt: Added.
+ * accessibility/table-headers.html: Added.
+ * platform/mac/accessibility/table-attributes-expected.txt:
+ * platform/mac/accessibility/table-cells-expected.txt:
+ * platform/mac/accessibility/table-sections-expected.txt:
+
</ins><span class="cx"> 2014-10-13 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> Add test coverage for the more complex cases of :not()
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitytableheadersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/table-headers-expected.txt (0 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/table-headers-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/table-headers-expected.txt        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+No        Country        Capital
+1.        Poland        Warsaw
+2.        Russia        Moscow
+3.        Ukraine        Kiev
+
+This tests that the columnHeaders() and rowHeaders() functions return the correct headers for a table cell.
+
+The table cell at (0,3) should have exactly one column header, currently it has 1 column header(s).
+The table cell at (0,3) should have exactly 0 row headers, currently it has 0 row header(s).
+
+The table cell at (1,2) should have exactly one column header, currently it has 1 column header(s).
+The table cell at (1,2) should have exactly one row header, currently it has 1 row header(s).
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitytableheadershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/table-headers.html (0 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/table-headers.html         (rev 0)
+++ trunk/LayoutTests/accessibility/table-headers.html        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+<!-- This test was made after noticing that all th elements in the table were included in the columnHeaders,
+ and the only criterion for including a cell to rowHeaders was only scope attribute (but not th).
+-->
+<html>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<body>
+
+<table id="table1">
+ <thead>
+ <tr>
+ <th>No</th>
+ <th>Country</th>
+ <th>Capital</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th>1.</th>
+ <td>Poland</td>
+ <td>Warsaw</td>
+ </tr>
+ <tr>
+ <th>2.</th>
+ <td>Russia</td>
+ <td>Moscow</td>
+ </tr>
+ <tr>
+ <th>3.</th>
+ <td>Ukraine</td>
+ <td>Kiev</td>
+ </tr>
+ </tbody>
+</table>
+
+<br>
+<br>
+<p>This tests that the columnHeaders() and rowHeaders() functions return the correct headers for a table cell.</p>
+<div id="result"></div>
+
+<script>
+ if (window.accessibilityController) {
+ var table = accessibilityController.accessibleElementById("table1");
+ var cell1 = table.cellForColumnAndRow(0, 3);
+ var colHeaders1 = cell1.columnHeaders();
+ var rowHeaders1 = cell1.rowHeaders();
+ var cell2 = table.cellForColumnAndRow(1, 2);
+ var colHeaders2 = cell2.columnHeaders();
+ var rowHeaders2 = cell2.rowHeaders();
+
+ result.innerText += "The table cell at (0,3) should have exactly one column header, currently it has " + colHeaders1.length + " column header(s).\n";
+ result.innerText += "The table cell at (0,3) should have exactly 0 row headers, currently it has " + rowHeaders1.length + " row header(s).\n\n";
+ result.innerText += "The table cell at (1,2) should have exactly one column header, currently it has " + colHeaders2.length + " column header(s).\n";
+ result.innerText += "The table cell at (1,2) should have exactly one row header, currently it has " + rowHeaders2.length + " row header(s).\n\n";
+ }
+</script>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitytableattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {0, 2}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -131,7 +131,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {0, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 2}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {0, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 2}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -230,8 +230,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 1>
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -262,7 +262,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 2}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -294,8 +294,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -638,7 +638,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {0, 2}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -670,7 +670,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {0, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 2}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -701,8 +701,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 1>
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -733,8 +733,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 1>
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {4, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -765,7 +765,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 2}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -797,8 +797,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -829,8 +829,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -861,8 +861,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -893,8 +893,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {4, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -925,8 +925,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -957,8 +957,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -989,8 +989,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -1021,8 +1021,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {4, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitytablecellsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -69,8 +69,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 1>
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -135,8 +135,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -168,8 +168,8 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {5, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {3, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitytablesectionsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -585,7 +585,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 1>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -617,7 +617,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -648,7 +648,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -681,7 +681,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 1>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -713,7 +713,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -744,7 +744,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 3>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -1043,7 +1043,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -1421,7 +1421,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 1>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -1453,7 +1453,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -1484,7 +1484,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 2>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="lines">@@ -1517,7 +1517,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {1, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 1>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -1549,7 +1549,7 @@
</span><span class="cx"> AXRowIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {2, 1}
</span><span class="cx"> AXColumnHeaderUIElements: <array of size 0>
</span><del>-AXRowHeaderUIElements: <array of size 0>
</del><ins>+AXRowHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span><span class="cx">
</span><span class="lines">@@ -1580,7 +1580,7 @@
</span><span class="cx"> AXDOMClassList: <array of size 0>
</span><span class="cx"> AXRowIndexRange: NSRange: {3, 1}
</span><span class="cx"> AXColumnIndexRange: NSRange: {0, 1}
</span><del>-AXColumnHeaderUIElements: <array of size 3>
</del><ins>+AXColumnHeaderUIElements: <array of size 1>
</ins><span class="cx"> AXRowHeaderUIElements: <array of size 0>
</span><span class="cx"> AXElementBusy: 0
</span><span class="cx"> AXRequired: 0
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/Source/WebCore/ChangeLog        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-10-14 Andrzej Badowski <a.badowski@samsung.com>
+
+ [AX] Improve AccessibilityTableCell columnHeaders and rowHeaders functions.
+ https://bugs.webkit.org/show_bug.cgi?id=136818
+
+ Reviewed by Chris Fleizach.
+
+ Take into account that <th> elements can be both the column headers and row headers
+ improved the operation of two functions: columnHeaders and rowHeaders.
+
+ Test: accessibility/table-headers.html
+
+ * accessibility/AccessibilityTableCell.cpp:
+ (WebCore::AccessibilityTableCell::isColumnHeaderCell):
+ A new function that helps the main goal.
+ (WebCore::AccessibilityTableCell::isRowHeaderCell):
+ A new function that helps the main goal.
+ (WebCore::AccessibilityTableCell::columnHeaders):
+ Use isColumnHeaderCell instead of isTableHeaderCell.
+ (WebCore::AccessibilityTableCell::rowHeaders):
+ Use isRowHeaderCell also includes <th> row header element next to the scope attribute.
+ * accessibility/AccessibilityTableCell.h:
+ Adds new functions to the header file.
+
</ins><span class="cx"> 2014-10-14 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix the !ENABLE(VIDEO) build after r174353
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityARIAGridCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> rowRange.second = 1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AccessibilityARIAGridCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange)
</del><ins>+void AccessibilityARIAGridCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const
</ins><span class="cx"> {
</span><span class="cx"> AccessibilityObject* parent = parentObjectUnignored();
</span><span class="cx"> if (!parent)
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityARIAGridCellh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> // fills in the start location and row span of cell
</span><span class="cx"> virtual void rowIndexRange(std::pair<unsigned, unsigned>& rowRange) override;
</span><span class="cx"> // fills in the start location and column span of cell
</span><del>- virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) override;
</del><ins>+ virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const override;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual AccessibilityTable* parentTable() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityTableCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "AXObjectCache.h"
</span><span class="cx"> #include "AccessibilityTable.h"
</span><span class="cx"> #include "AccessibilityTableRow.h"
</span><ins>+#include "ElementIterator.h"
</ins><span class="cx"> #include "HTMLElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "RenderObject.h"
</span><span class="lines">@@ -122,6 +123,55 @@
</span><span class="cx"> return node() && node()->hasTagName(thTag);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool AccessibilityTableCell::isColumnHeaderCell() const
+{
+ const AtomicString& scope = getAttribute(scopeAttr);
+ if (scope == "col" || scope == "colgroup")
+ return true;
+ if (scope == "row" || scope == "rowgroup")
+ return false;
+ if (!isTableHeaderCell())
+ return false;
+
+ // We are in a situation after checking the scope attribute.
+ // It is an attempt to resolve the type of th element without support in the specification.
+ // Checking tableTag lets stop the loop at the table level.
+ for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentNode()) {
+ if (parentNode->hasTagName(theadTag))
+ return true;
+ if (parentNode->hasTagName(tbodyTag) || parentNode->hasTagName(tfootTag) || parentNode->hasTagName(tableTag))
+ return false;
+ }
+ return false;
+}
+
+bool AccessibilityTableCell::isRowHeaderCell() const
+{
+ const AtomicString& scope = getAttribute(scopeAttr);
+ if (scope == "row" || scope == "rowgroup")
+ return true;
+ if (scope == "col" || scope == "colgroup")
+ return false;
+ if (!isTableHeaderCell())
+ return false;
+
+ // We are in a situation after checking the scope attribute.
+ // It is an attempt to resolve the type of th element without support in the specification.
+ // Checking tableTag lets stop the loop at the table level.
+ for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentNode()) {
+ if (parentNode->hasTagName(tfootTag) || parentNode->hasTagName(tbodyTag)) {
+ std::pair<unsigned, unsigned> colRange;
+ columnIndexRange(colRange);
+ if (!colRange.first)
+ return true;
+ return false;
+ }
+ if (parentNode->hasTagName(theadTag) || parentNode->hasTagName(tableTag))
+ return false;
+ }
+ return false;
+}
+
</ins><span class="cx"> bool AccessibilityTableCell::isTableCellInSameRowGroup(AccessibilityTableCell* otherTableCell)
</span><span class="cx"> {
</span><span class="cx"> Node* parentNode = node();
</span><span class="lines">@@ -190,9 +240,9 @@
</span><span class="cx"> tableCell->rowIndexRange(childRowRange);
</span><span class="cx">
</span><span class="cx"> const AtomicString& scope = tableCell->getAttribute(scopeAttr);
</span><del>- if (scope == "col" || tableCell->isTableHeaderCell())
</del><ins>+ if (scope == "colgroup" && isTableCellInSameColGroup(tableCell))
</ins><span class="cx"> headers.append(tableCell);
</span><del>- else if (scope == "colgroup" && isTableCellInSameColGroup(tableCell))
</del><ins>+ else if (tableCell->isColumnHeaderCell())
</ins><span class="cx"> headers.append(tableCell);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -215,9 +265,9 @@
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> const AtomicString& scope = tableCell->getAttribute(scopeAttr);
</span><del>- if (scope == "row")
</del><ins>+ if (scope == "rowgroup" && isTableCellInSameRowGroup(tableCell))
</ins><span class="cx"> headers.append(tableCell);
</span><del>- else if (scope == "rowgroup" && isTableCellInSameRowGroup(tableCell))
</del><ins>+ else if (tableCell->isRowHeaderCell())
</ins><span class="cx"> headers.append(tableCell);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -251,7 +301,7 @@
</span><span class="cx"> rowRange.first += rowOffset;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange)
</del><ins>+void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const
</ins><span class="cx"> {
</span><span class="cx"> if (!is<RenderTableCell>(m_renderer))
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityTableCellh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (174674 => 174675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.h        2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.h        2014-10-14 08:18:32 UTC (rev 174675)
</span><span class="lines">@@ -45,11 +45,13 @@
</span><span class="cx">
</span><span class="cx"> virtual bool isTableCell() const override;
</span><span class="cx"> bool isTableHeaderCell() const;
</span><ins>+ bool isColumnHeaderCell() const;
+ bool isRowHeaderCell() const;
</ins><span class="cx">
</span><span class="cx"> // fills in the start location and row span of cell
</span><span class="cx"> virtual void rowIndexRange(std::pair<unsigned, unsigned>& rowRange);
</span><span class="cx"> // fills in the start location and column span of cell
</span><del>- virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange);
</del><ins>+ virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const;
</ins><span class="cx">
</span><span class="cx"> void columnHeaders(AccessibilityChildrenVector&);
</span><span class="cx"> void rowHeaders(AccessibilityChildrenVector&);
</span></span></pre>
</div>
</div>
</body>
</html>