diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-24 10:42:23 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-24 10:42:23 +0000 |
commit | e1db27e19989db11fef70f439cf95821316535b3 (patch) | |
tree | abac2c9f5115323a8816d3ef600d8cb2bca5a33e /layout/tables | |
parent | a98d06380fe706e3b1b602411c597b9882516b3e (diff) | |
parent | a5203631d8cded437c05243cde17cddeba13e3ec (diff) | |
download | UXP-RC_20201024.tar UXP-RC_20201024.tar.gz UXP-RC_20201024.tar.lz UXP-RC_20201024.tar.xz UXP-RC_20201024.zip |
Merge branch 'redwood' into releaseRELBASE_20201024RC_20201024
Diffstat (limited to 'layout/tables')
-rw-r--r-- | layout/tables/nsTableFrame.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 59a6d0f1a..eb8efb0ec 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -104,6 +104,14 @@ struct TableReflowInput { availSize.BSize(wm) = std::max(0, availSize.BSize(wm)); } } +
+ void ReduceAvailableBSizeBy(WritingMode aWM, nscoord aAmount) {
+ if (availSize.BSize(aWM) == NS_UNCONSTRAINEDSIZE) {
+ return;
+ }
+ availSize.BSize(aWM) -= aAmount;
+ availSize.BSize(aWM) = std::max(0, availSize.BSize(aWM));
+ } }; } // namespace mozilla @@ -2682,9 +2690,7 @@ nsTableFrame::PlaceChild(TableReflowInput& aReflowInput, aReflowInput.bCoord += aKidDesiredSize.BSize(wm); // If our bsize is constrained, then update the available bsize - if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) { - aReflowInput.availSize.BSize(wm) -= aKidDesiredSize.BSize(wm); - } + aReflowInput.ReduceAvailableBSizeBy(wm, aKidDesiredSize.BSize(wm)); } void @@ -2928,17 +2934,28 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, // using the footer's prev-in-flow's height instead of reflowing it again, // but there's no real need. if (isPaginated) { + bool reorder = false; if (thead && !GetPrevInFlow()) { + if (thead->GetNextInFlow()) { + reorder = true; + } nscoord desiredHeight; nsresult rv = SetupHeaderFooterChild(aReflowInput, thead, &desiredHeight); if (NS_FAILED(rv)) return; } if (tfoot) { + if (tfoot->GetNextInFlow()) { + reorder = true; + } nsresult rv = SetupHeaderFooterChild(aReflowInput, tfoot, &footerHeight); if (NS_FAILED(rv)) return; } + if (reorder) { + // Reorder row groups, because the reflow may have changed what's next-in-flow. + OrderRowGroups(rowGroups, &thead, &tfoot); + } } // if the child is a tbody in paginated mode reduce the height by a repeated footer bool allowRepeatedFooter = false; @@ -3004,14 +3021,13 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, kidReflowInput.mFlags.mIsTopOfPage = false; } aReflowInput.bCoord += cellSpacingB; - if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) { - aReflowInput.availSize.BSize(wm) -= cellSpacingB; - } + aReflowInput.ReduceAvailableBSizeBy(wm, cellSpacingB); // record the presence of a next in flow, it might get destroyed so we // need to reorder the row group array bool reorder = false; - if (kidFrame->GetNextInFlow()) + if (kidFrame->GetNextInFlow()) { reorder = true; + } LogicalPoint kidPosition(wm, aReflowInput.iCoord, aReflowInput.bCoord); ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput, @@ -3019,7 +3035,7 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize); if (reorder) { - // reorder row groups the reflow may have changed the nextinflows + // Reorder row groups, because the reflow may have changed what's next-in-flow. OrderRowGroups(rowGroups, &thead, &tfoot); childX = rowGroups.IndexOf(kidFrame); if (childX == RowGroupArray::NoIndex) { @@ -3171,9 +3187,7 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, aReflowInput.bCoord += kidRect.BSize(wm); // If our bsize is constrained then update the available bsize. - if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) { - aReflowInput.availSize.BSize(wm) -= cellSpacingB + kidRect.BSize(wm); - } + aReflowInput.ReduceAvailableBSizeBy(wm, cellSpacingB + kidRect.BSize(wm)); } } |