Bug 24474: AX: in multi-body tables, asking for a cell at a specific coordinate can...
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Mar 2009 22:20:51 +0000 (22:20 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Mar 2009 22:20:51 +0000 (22:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=24474

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41687 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/AccessibilityTable.cpp

index 822f9f9a24d837e1a3ac6516f4f829e73d2d0465..152f327796cd4652ffcf43edd8447d614611044b 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-13  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        Bug 24474: AX: in multi-body tables, asking for a cell at a specific coordinate can return nil
+        https://bugs.webkit.org/show_bug.cgi?id=24474
+
+        * platform/mac-snowleopard/accessibility/table-multi-bodies-expected.txt: Added.
+        * platform/mac-snowleopard/accessibility/table-multi-bodies.html: Added.
+
 2009-03-13  Adele Peterson  <adele@apple.com>
 
         Reviewed by Justin Garcia.
diff --git a/LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies-expected.txt b/LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies-expected.txt
new file mode 100644 (file)
index 0000000..8f5fa69
--- /dev/null
@@ -0,0 +1,9 @@
+      Forum   Last Post       Threads Posts
+English Forums
+      Main Discussion
+        Want to communicate with other local fans? Do it here, too!     Today 03:52pm  381     23,437
+
+
+
+------------------------
+Pass
diff --git a/LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies.html b/LayoutTests/platform/mac-snowleopard/accessibility/table-multi-bodies.html
new file mode 100644 (file)
index 0000000..95cdced
--- /dev/null
@@ -0,0 +1,73 @@
+<html>
+    
+    <head>
+        <script>
+            if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+            </script>
+    </head>
+    
+    <body id="body">
+        
+        <table class="tborder" cellpadding="6" cellspacing="1" border="1" width="100%" align="center">
+            <thead>
+                <tr align="center">
+                    <td class="thead">&nbsp;</td>
+                    <td class="thead" width="100%" align="left">Forum</td>
+                    <td class="thead">Last Post</td>
+                    <td class="thead">Threads</td>
+                    <td class="thead">Posts</td>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td class="tcat" colspan="5"><a style="float:right" href="#top" ><img id="collapseimg_forumbit_71" alt="" border="0" /></a>
+                        <a href="forumdisplay.php?f=71">English Forums</a>
+                    </td>
+                </tr>
+            </tbody>
+            <tbody id="collapseobj_forumbit_71" style="">
+                <tr>
+                    <td class="tcat"><span class="smallfont">&nbsp;</span></td>
+                    <td class="tcat" colspan="4">
+                        <a href="forumdisplay.php?f=30">Main Discussion</a>
+                    </td>
+                </tr>
+                <tr align="center">
+                    <td class="alt2"><img  alt="" border="0" id="forum_statusicon_23" /></td>
+                    <td class="alt1Active" align="left" id="f23">
+                        Want to communicate with other local fans? Do it here, too!
+                    </td>
+                    <td class="alt2" nowrap="nowrap">
+                        Today <span class="time">03:52pm</span>
+                    </td>
+                    <td class="alt1">381</td>
+<td class="alt2">23,437</td>
+</tr>
+</table>
+<BR><BR><BR>
+<div id="result">
+</div>
+
+<script>
+        if (window.accessibilityController) {
+
+            var body = document.getElementById("body");
+            body.focus();
+            var table = accessibilityController.focusedElement.childAtIndex(0);
+            
+            result.innerText += "------------------------\n";
+            var axCellKey = "AXCell";
+         
+            var tableCell1 = table.cellForColumnAndRow(2,0);
+            if (tableCell1.allAttributes().indexOf(axCellKey) != -1) {
+                result.innerText += "Pass";
+            } 
+            else {
+                result.innerText += "Fail";
+            }
+        }
+</script>
+
+</body>
+</html>
index c2bfdd2094c2092c42283f401207c23c641c90d4..0ad7e3de5146146342aa6d12180a784c0cb51cf9 100644 (file)
@@ -1,3 +1,15 @@
+2009-03-13  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        Bug 24474: AX: in multi-body tables, asking for a cell at a specific coordinate can return nil
+        https://bugs.webkit.org/show_bug.cgi?id=24474
+
+        Test: platform/mac-snowleopard/accessibility/table-multi-bodies.html
+
+        * page/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::cellForColumnAndRow):
+
 2009-03-13  Jian Li  <jianli@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 7cfc8f62e6e18709b2c15e27d71d7131edf21e9c..2b60d43c36046c562a67b801f03887d94bc315bb 100644 (file)
@@ -386,11 +386,13 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
     unsigned rowOffset = 0;
     while (tableSection) {
         
-        rowCount += tableSection->numRows();
+        unsigned numRows = tableSection->numRows();
         unsigned numCols = tableSection->numColumns();
         
-        if (row < rowCount && column < numCols) {
-            int sectionSpecificRow = row - rowOffset;
+        rowCount += numRows;
+        
+        unsigned sectionSpecificRow = row - rowOffset;            
+        if (row < rowCount && column < numCols && sectionSpecificRow < numRows) {
             cell = tableSection->cellAt(sectionSpecificRow, column).cell;
             
             // we didn't find the cell, which means there's spanning happening
@@ -422,9 +424,9 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
         if (cell)
             break;
         
-        rowOffset += rowCount;
+        rowOffset += numRows;
         // we didn't find anything between the rows we should have
-        if (row < rowOffset)
+        if (row < rowCount)
             break;
         tableSection = table->sectionBelow(tableSection, true);        
     }