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 703036 eb439e0fb5e95f2289194bd05ec9b12b879b96b2
parent 703035 3dd8f6620dd0a68729458c448059a4b8b51532d5
child 703037 2170e94162e04e00eeb530eeefc7eb802071509b
push id90676
push userbmo:ywu@mozilla.com
push dateFri, 24 Nov 2017 08:03:00 +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