Bug 1405929 - Part 2 : fix the wrong row index. r?dbaron draft
authorYa-Chieh Wu <ywu@mozilla.com>
Fri, 24 Nov 2017 15:07:33 +0800
changeset 703033 ce4c0730e27ad0d0646464a92643b071a6dc758c
parent 703032 3a4e1da7fd3656c4f78ca0738d7254b2b38107e0
child 703034 0c60222935a5fdfbe8b80650660ebf1a46223aca
push id90675
push userbmo:ywu@mozilla.com
push dateFri, 24 Nov 2017 07:55:18 +0000
reviewersdbaron
bugs1405929
milestone59.0a1
Bug 1405929 - Part 2 : fix the wrong row index. r?dbaron MozReview-Commit-ID: 2jKNvw4kwpZ
layout/tables/nsCellMap.cpp
layout/tables/nsCellMap.h
layout/tables/nsTableFrame.cpp
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -896,24 +896,26 @@ bool nsTableCellMap::RowHasSpanningCells
     cellMap = cellMap->GetNextSibling();
   }
   return false;
 }
 
 void
 nsTableCellMap::ResetBStartStart(LogicalSide aSide,
                                  nsCellMap&  aCellMap,
+                                 uint32_t    aRowGroupStart,
                                  uint32_t    aRowIndex,
                                  uint32_t    aColIndex,
                                  bool        aIsBEndIEnd)
 {
   if (!mBCInfo || aIsBEndIEnd) ABORT0();
 
   BCCellData* cellData;
   BCData* bcData = nullptr;
+  aRowIndex = aRowIndex - aRowGroupStart;
 
   switch(aSide) {
   case eLogicalSideBEnd:
     aRowIndex++;
     MOZ_FALLTHROUGH;
   case eLogicalSideBStart:
     cellData = (BCCellData*)aCellMap.GetDataAt(aRowIndex, aColIndex);
     if (cellData) {
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -186,16 +186,17 @@ protected:
                               int32_t                     aStartRowIndex,
                               nsTArray<nsTableRowFrame*>* aRowsToInsert,
                               int32_t                     aNumRowsToRemove,
                               TableArea&                  aDamageArea);
 
 public:
   void ResetBStartStart(mozilla::LogicalSide aSide,
                         nsCellMap& aCellMap,
+                        uint32_t   aRowGroupStart,
                         uint32_t   aYPos,
                         uint32_t   aXPos,
                         bool       aIsBEndIEnd = false);
 
   void SetBCBorderEdge(mozilla::LogicalSide aEdge,
                        nsCellMap&    aCellMap,
                        uint32_t      aCellMapStart,
                        uint32_t      aYPos,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -6467,16 +6467,17 @@ nsTableFrame::CalcBCBorders()
         BCCellBorder& nextBorder = lastBEndBorders[info.mColIndex + 1];
         if ((thisBorder.color == nextBorder.color) &&
             (thisBorder.width == nextBorder.width) &&
             (thisBorder.style == nextBorder.style)) {
           // set the flag on the next border indicating it is not the start of a
           // new segment
           if (iter.mCellMap) {
             tableCellMap->ResetBStartStart(eLogicalSideBEnd, *iter.mCellMap,
+                                           iter.mRowGroupStart,
                                            info.GetCellEndRowIndex(),
                                            info.GetCellEndColIndex() + 1);
           }
         }
       }
     }
   } // for (iter.First(info); info.mCell; iter.Next(info)) {
   // reset the bc flag and damage area