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 703039 10d8fa03a4318b37bb5612d555444500920e5dd8
parent 703038 3fe309da7f7ffabc06f8363c57c2a8a26a43fc50
child 703040 68fbf7b1e5dbfcbaf600185561caa068a5d41581
push id90678
push userbmo:ywu@mozilla.com
push dateFri, 24 Nov 2017 08:11:39 +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
@@ -6468,16 +6468,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