Diff
Modified: trunk/LayoutTests/ChangeLog (174674 => 174675)
--- trunk/LayoutTests/ChangeLog 2014-10-14 08:14:01 UTC (rev 174674)
+++ trunk/LayoutTests/ChangeLog 2014-10-14 08:18:32 UTC (rev 174675)
@@ -1,3 +1,16 @@
+2014-10-14 Andrzej Badowski <[email protected]>
+
+ [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:
+
2014-10-13 Benjamin Poulain <[email protected]>
Add test coverage for the more complex cases of :not()
Added: trunk/LayoutTests/accessibility/table-headers-expected.txt (0 => 174675)
--- 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)
@@ -0,0 +1,14 @@
+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).
+
+
Added: trunk/LayoutTests/accessibility/table-headers.html (0 => 174675)
--- trunk/LayoutTests/accessibility/table-headers.html (rev 0)
+++ trunk/LayoutTests/accessibility/table-headers.html 2014-10-14 08:18:32 UTC (rev 174675)
@@ -0,0 +1,61 @@
+<!-- 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>
Modified: trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt (174674 => 174675)
--- 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)
@@ -99,7 +99,7 @@
AXRowIndexRange: NSRange: {0, 2}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -131,7 +131,7 @@
AXRowIndexRange: NSRange: {0, 1}
AXColumnIndexRange: NSRange: {3, 2}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -163,7 +163,7 @@
AXRowIndexRange: NSRange: {0, 1}
AXColumnIndexRange: NSRange: {3, 2}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -230,8 +230,8 @@
AXDOMClassList: <array of size 1>
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -262,7 +262,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 2}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 1>
+AXColumnHeaderUIElements: <array of size 0>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -294,8 +294,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {1, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -638,7 +638,7 @@
AXRowIndexRange: NSRange: {0, 2}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -670,7 +670,7 @@
AXRowIndexRange: NSRange: {0, 1}
AXColumnIndexRange: NSRange: {3, 2}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -701,8 +701,8 @@
AXDOMClassList: <array of size 1>
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -733,8 +733,8 @@
AXDOMClassList: <array of size 1>
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {4, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -765,7 +765,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 2}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 1>
+AXColumnHeaderUIElements: <array of size 0>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -797,8 +797,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {1, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -829,8 +829,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {2, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -861,8 +861,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -893,8 +893,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {4, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -925,8 +925,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {1, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -957,8 +957,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {2, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -989,8 +989,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -1021,8 +1021,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {4, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
Modified: trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt (174674 => 174675)
--- 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)
@@ -69,8 +69,8 @@
AXDOMClassList: <array of size 1>
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -135,8 +135,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {2, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -168,8 +168,8 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {5, 1}
AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 2>
-AXRowHeaderUIElements: <array of size 0>
+AXColumnHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
Modified: trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt (174674 => 174675)
--- 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)
@@ -207,7 +207,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 2>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -585,7 +585,7 @@
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {1, 1}
AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -617,7 +617,7 @@
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -648,7 +648,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 2>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -681,7 +681,7 @@
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {1, 1}
AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -713,7 +713,7 @@
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -744,7 +744,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 3>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -1043,7 +1043,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 2>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -1421,7 +1421,7 @@
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {1, 1}
AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -1453,7 +1453,7 @@
AXRowIndexRange: NSRange: {1, 1}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -1484,7 +1484,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 2>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
@@ -1517,7 +1517,7 @@
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {1, 1}
AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -1549,7 +1549,7 @@
AXRowIndexRange: NSRange: {2, 1}
AXColumnIndexRange: NSRange: {2, 1}
AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
+AXRowHeaderUIElements: <array of size 1>
AXElementBusy: 0
AXRequired: 0
@@ -1580,7 +1580,7 @@
AXDOMClassList: <array of size 0>
AXRowIndexRange: NSRange: {3, 1}
AXColumnIndexRange: NSRange: {0, 1}
-AXColumnHeaderUIElements: <array of size 3>
+AXColumnHeaderUIElements: <array of size 1>
AXRowHeaderUIElements: <array of size 0>
AXElementBusy: 0
AXRequired: 0
Modified: trunk/Source/WebCore/ChangeLog (174674 => 174675)
--- 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)
@@ -1,3 +1,27 @@
+2014-10-14 Andrzej Badowski <[email protected]>
+
+ [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.
+
2014-10-14 Csaba Osztrogonác <[email protected]>
Fix the !ENABLE(VIDEO) build after r174353
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp (174674 => 174675)
--- 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)
@@ -98,7 +98,7 @@
rowRange.second = 1;
}
-void AccessibilityARIAGridCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange)
+void AccessibilityARIAGridCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const
{
AccessibilityObject* parent = parentObjectUnignored();
if (!parent)
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h (174674 => 174675)
--- 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)
@@ -44,7 +44,7 @@
// fills in the start location and row span of cell
virtual void rowIndexRange(std::pair<unsigned, unsigned>& rowRange) override;
// fills in the start location and column span of cell
- virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) override;
+ virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const override;
protected:
virtual AccessibilityTable* parentTable() const override;
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (174674 => 174675)
--- 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)
@@ -32,6 +32,7 @@
#include "AXObjectCache.h"
#include "AccessibilityTable.h"
#include "AccessibilityTableRow.h"
+#include "ElementIterator.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
#include "RenderObject.h"
@@ -122,6 +123,55 @@
return node() && node()->hasTagName(thTag);
}
+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;
+}
+
bool AccessibilityTableCell::isTableCellInSameRowGroup(AccessibilityTableCell* otherTableCell)
{
Node* parentNode = node();
@@ -190,9 +240,9 @@
tableCell->rowIndexRange(childRowRange);
const AtomicString& scope = tableCell->getAttribute(scopeAttr);
- if (scope == "col" || tableCell->isTableHeaderCell())
+ if (scope == "colgroup" && isTableCellInSameColGroup(tableCell))
headers.append(tableCell);
- else if (scope == "colgroup" && isTableCellInSameColGroup(tableCell))
+ else if (tableCell->isColumnHeaderCell())
headers.append(tableCell);
}
}
@@ -215,9 +265,9 @@
continue;
const AtomicString& scope = tableCell->getAttribute(scopeAttr);
- if (scope == "row")
+ if (scope == "rowgroup" && isTableCellInSameRowGroup(tableCell))
headers.append(tableCell);
- else if (scope == "rowgroup" && isTableCellInSameRowGroup(tableCell))
+ else if (tableCell->isRowHeaderCell())
headers.append(tableCell);
}
}
@@ -251,7 +301,7 @@
rowRange.first += rowOffset;
}
-void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange)
+void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const
{
if (!is<RenderTableCell>(m_renderer))
return;
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (174674 => 174675)
--- 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)
@@ -45,11 +45,13 @@
virtual bool isTableCell() const override;
bool isTableHeaderCell() const;
+ bool isColumnHeaderCell() const;
+ bool isRowHeaderCell() const;
// fills in the start location and row span of cell
virtual void rowIndexRange(std::pair<unsigned, unsigned>& rowRange);
// fills in the start location and column span of cell
- virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange);
+ virtual void columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const;
void columnHeaders(AccessibilityChildrenVector&);
void rowHeaders(AccessibilityChildrenVector&);