Bug 416742 - Regression: multiple rowgroups interfere with getColumnAtIndex(), r=bernd, sr=roc, a=beltzner
authorsurkov.alexander@gmail.com
Fri, 07 Mar 2008 02:14:35 -0800
changeset 12717 78604f9ecabf9f6f38b0046441ef25b887addf89
parent 12716 934d4870e22784b4a629ec5ab7cfabdec68e1f44
child 12718 60a060e7cb43fd6769712797b9264de09d2c3877
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbernd, roc, beltzner
bugs416742
milestone1.9b5pre
Bug 416742 - Regression: multiple rowgroups interfere with getColumnAtIndex(), r=bernd, sr=roc, a=beltzner
accessible/tests/mochitest/Makefile.in
layout/tables/nsCellMap.cpp
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -43,16 +43,17 @@ VPATH		= @srcdir@
 relativesrcdir  = accessible
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =\
 		test_bug368835.xul \
 		test_groupattrs.xul \
+		test_table_indexes.html \
 		test_nsIAccessibleTable_1.html \
 		test_nsIAccessibleTable_2.html \
 		test_nsIAccessibleTable_3.html \
 		test_nsIAccessibleTable_listboxes.xul \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -898,25 +898,25 @@ nsTableCellMap::GetIndexByRowAndColumn(P
   PRInt32 index = 0;
 
   PRInt32 colCount = mCols.Count();
   PRInt32 rowIndex = aRow;
 
   nsCellMap* cellMap = mFirstMap;
   while (cellMap) {
     PRInt32 rowCount = cellMap->GetRowCount();
-    if (rowCount < rowIndex) {
+    if (rowIndex >= rowCount) {
       // If the rowCount is less than the rowIndex, this means that the index is
       // not within the current map. If so, get the index of the last cell in
       // the last row.
       PRInt32 cellMapIdx = cellMap->GetIndexByRowAndColumn(colCount,
                                                            rowCount - 1,
                                                            colCount - 1);
       if (cellMapIdx != -1) {
-        index += cellMapIdx;
+        index += cellMapIdx  + 1;
         rowIndex -= rowCount;
       }
     } else {
       // Index is in valid range for this cellmap, so get the index of rowIndex
       // and aColumn.
       PRInt32 cellMapIdx = cellMap->GetIndexByRowAndColumn(colCount, rowIndex,
                                                            aColumn);
       if (cellMapIdx != -1) {
@@ -950,17 +950,17 @@ nsTableCellMap::GetRowAndColumnByIndex(P
     // if wanted index is in here.
     PRInt32 cellMapIdx = cellMap->GetIndexByRowAndColumn(colCount,
                                                          rowCount - 1,
                                                          colCount - 1);
     if (cellMapIdx != -1) {
       if (index > cellMapIdx) {
         // The index is not within this map, so decrease it by the cellMapIdx
         // determined index and increase the total row index accordingly.
-        index -= cellMapIdx;
+        index -= cellMapIdx + 1;
         previousRows += rowCount;
       } else {
         cellMap->GetRowAndColumnByIndex(colCount, index, aRow, aColumn);
         // If there were previous indexes, take them into account.
         *aRow += previousRows;
         return; // no need to look any further.
       }
     }