Title: [167558] trunk
Revision
167558
Author
[email protected]
Date
2014-04-19 18:25:28 -0700 (Sat, 19 Apr 2014)

Log Message

AX: Malformed tables exposing incorrect col and colSpans
https://bugs.webkit.org/show_bug.cgi?id=131796

Reviewed by Darin Adler.

Source/WebCore: 
Test: accessibility/table-incorrect-colspan-cell.html

When a developer has specified malformed colspans, accessibility is reporting those values instead of the effective column information.

* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::columnIndexRange):

LayoutTests: 
* accessibility/table-incorrect-colspan-cell-expected.txt: Added.
* accessibility/table-incorrect-colspan-cell.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167557 => 167558)


--- trunk/LayoutTests/ChangeLog	2014-04-20 01:22:06 UTC (rev 167557)
+++ trunk/LayoutTests/ChangeLog	2014-04-20 01:25:28 UTC (rev 167558)
@@ -1,3 +1,13 @@
+2014-04-19  Chris Fleizach  <[email protected]>
+
+        AX: Malformed tables exposing incorrect col and colSpans
+        https://bugs.webkit.org/show_bug.cgi?id=131796
+
+        Reviewed by Darin Adler.
+
+        * accessibility/table-incorrect-colspan-cell-expected.txt: Added.
+        * accessibility/table-incorrect-colspan-cell.html: Added.
+
 2014-04-19  Zalan Bujtas  <[email protected]>
 
        [Mac] Unreviewed gardening.

Added: trunk/LayoutTests/accessibility/table-incorrect-colspan-cell-expected.txt (0 => 167558)


--- trunk/LayoutTests/accessibility/table-incorrect-colspan-cell-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/table-incorrect-colspan-cell-expected.txt	2014-04-20 01:25:28 UTC (rev 167558)
@@ -0,0 +1,22 @@
+Home	Help	Login
+	Tip us on news
+This tests the rowRange and columnRange attributes of table cells in a table with colspans that are invalid.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Table: Rows: 2, Columns: 3
+[Table cell at row: 0, column: 0] Row range: {0, 1}, Column range: {0, 1}
+	PASSED Cell is same cell at (0, 0)
+[Table cell at row: 1, column: 0] Row range: {1, 1}, Column range: {0, 2}
+	PASSED Cell is same cell at (1, 0)
+	PASSED Cell is same cell at (1, 1)
+[Table cell at row: 1, column: 1] Row range: {1, 1}, Column range: {0, 2}
+	PASSED Cell is same cell at (1, 0)
+	PASSED Cell is same cell at (1, 1)
+[Table cell at row: 1, column: 2] Row range: {1, 1}, Column range: {2, 1}
+	PASSED Cell is same cell at (1, 2)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/table-incorrect-colspan-cell.html (0 => 167558)


--- trunk/LayoutTests/accessibility/table-incorrect-colspan-cell.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/table-incorrect-colspan-cell.html	2014-04-20 01:25:28 UTC (rev 167558)
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<table id="table" border="1" cellspacing="1">
+<tbody><tr><td><table border="1" width="100%"><tbody>
+<tr><td>Home</td>
+<td>Help</td>
+<td>Login</td></tr></tbody></table>
+</td></tr><tr><td colspan="4">
+<input type="text"></td>
+<td colspan="2" id="tablecell">Tip us on news</td>
+</tr></tbody></table>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests the rowRange and columnRange attributes of table cells in a table with colspans that are invalid.");
+
+    function parseRangeString(string) {
+       string = string.replace(/({|})/, "");
+       var nums = string.split(",");
+       return new Array(parseInt(nums[0]), parseInt(nums[1]));
+    }
+
+    if (window.accessibilityController) {
+        var table = accessibilityController.accessibleElementById("table");
+        var rowCount = table.rowCount;
+        var columnCount = table.columnCount;
+        debug("Table: Rows: " + rowCount + ", Columns: " + columnCount);
+        for (var row = 0; row < rowCount; row++) {
+            for (var col = 0; col < columnCount; col++) {
+                var tableCell = table.cellForColumnAndRow(col, row);
+                if (!tableCell || !tableCell.isValid)
+                    continue;
+
+                var rowIndexRange = tableCell.rowIndexRange();
+                var colIndexRange = tableCell.columnIndexRange();
+                debug("[Table cell at row: " + row + ", column: " + col + "] Row range: " + rowIndexRange + ", Column range: " + colIndexRange);
+                var rowInfo = parseRangeString(rowIndexRange);
+                var colInfo = parseRangeString(colIndexRange);
+                for (var subrow = rowInfo[0]; subrow < rowInfo[0] + rowInfo[1]; subrow++) {
+                    for (var subcol = colInfo[0]; subcol < colInfo[0] + colInfo[1]; subcol++) {
+                        var testTableCell = table.cellForColumnAndRow(subcol, subrow);
+                        if (!testTableCell || !testTableCell.isValid)
+                            continue;
+
+                        var same = tableCell.isEqual(testTableCell);
+                        var passed = same ? "PASSED" : "FAILED";
+                        debug("\t" + passed + " Cell is same cell at (" + subrow + ", " + subcol + ")");
+                    }
+                }
+            }
+        }
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (167557 => 167558)


--- trunk/Source/WebCore/ChangeLog	2014-04-20 01:22:06 UTC (rev 167557)
+++ trunk/Source/WebCore/ChangeLog	2014-04-20 01:25:28 UTC (rev 167558)
@@ -1,3 +1,17 @@
+2014-04-19  Chris Fleizach  <[email protected]>
+
+        AX: Malformed tables exposing incorrect col and colSpans
+        https://bugs.webkit.org/show_bug.cgi?id=131796
+
+        Reviewed by Darin Adler.
+
+        Test: accessibility/table-incorrect-colspan-cell.html
+
+        When a developer has specified malformed colspans, accessibility is reporting those values instead of the effective column information.
+
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::columnIndexRange):
+
 2014-04-19  Benjamin Poulain  <[email protected]>
 
         Make the CSS JIT compile for ARM64

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (167557 => 167558)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2014-04-20 01:22:06 UTC (rev 167557)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2014-04-20 01:25:28 UTC (rev 167558)
@@ -248,9 +248,9 @@
     if (!m_renderer || !m_renderer->isTableCell())
         return;
     
-    RenderTableCell* renderCell = toRenderTableCell(m_renderer);
-    columnRange.first = renderCell->col();
-    columnRange.second = renderCell->colSpan();    
+    const RenderTableCell& cell = *toRenderTableCell(m_renderer);
+    columnRange.first = cell.table()->colToEffCol(cell.col());
+    columnRange.second = cell.table()->colToEffCol(cell.col() + cell.colSpan()) - columnRange.first;
 }
     
 AccessibilityObject* AccessibilityTableCell::titleUIElement() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to