Bug 1405929 - Part 3 : refactor a bit to make them more readable. r?dbaron
MozReview-Commit-ID: 3CGw0aHzzws
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -6449,38 +6449,41 @@ nsTableFrame::CalcBCBorders()
//will know whether *this* row is at the bEnd
const nsIFrame* nextRowGroup =
ajaInfo.mRgAtStart ? ajaInfo.mRowGroup : nullptr;
info.SetInnerRowGroupBEndContBCBorder(nextRowGroup, ajaInfo.mStartRow);
gotRowBorder = true;
}
}
- // see if the cell to the iEnd side had a rowspan and its bEnd-iStart border
- // needs be joined with this one's bEnd
- // if there is a cell to the iEnd and the cell to iEnd side was a rowspan
- if ((info.mNumTableCols != info.GetCellEndColIndex() + 1) &&
- (lastBEndBorders[info.GetCellEndColIndex() + 1].rowSpan > 1) &&
- (lastBEndBorders[info.GetCellEndColIndex() + 1].rowIndex ==
- info.GetCellEndRowIndex() + 1)) {
- BCCornerInfo& corner = bEndCorners[info.GetCellEndColIndex() + 1];
- if (!IsBlock(LogicalSide(corner.ownerSide))) {
- // not a block-dir owner
- BCCellBorder& thisBorder = lastBEndBorder;
- 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);
+ // When the cell to the IEnd side has row span, the cell's BEnd border
+ // need to be checked if it can be joined to this cell's BEnd.
+ // We have to do this check here because the code above will only
+ // check the cell's IStart side's cell's BEnd. So in the case of a cell with
+ // row span, the cell's final BEnd's border's IEnd side border has not been
+ // updated yet. That's why we have to do this here.
+ if ((info.mNumTableCols != info.GetCellEndColIndex() + 1)) {
+ // We query |info.GetCellEndColIndex() + 1| which let us get the BEnd border
+ // from previous row's BEnd. And if we have a row span to the IEnd side, we
+ // can get the cell to the IEnd side's BEnd border.
+ BCCellBorder& previousBorder = lastBEndBorders[info.GetCellEndColIndex() + 1];
+ // add 1 to the info.GetCellEndRowIndex()
+ if (previousBorder.rowSpan > 1 &&
+ previousBorder.rowIndex == info.GetCellEndRowIndex() + 1) {
+ BCCornerInfo& corner = bEndCorners[info.GetCellEndColIndex() + 1];
+ if (!IsBlock(LogicalSide(corner.ownerSide))) {
+ if ((lastBEndBorder.color == previousBorder.color) &&
+ (lastBEndBorder.width == previousBorder.width) &&
+ (lastBEndBorder.style == previousBorder.style)) {
+ 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
SetNeedToCalcBCBorders(false);
propData->mDamageArea = TableArea(0, 0, 0, 0);