summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-10-23 10:36:09 +0000
committerMoonchild <moonchild@palemoon.org>2020-10-23 10:36:09 +0000
commit2cd89d58452f18eeffdbe0bfb86b2116297e041d (patch)
treee7a0958be2097df5c6dcee0c984ef4d408aebf92
parentd5e5bef3caef9c5aaf8d918f08b8d8a28185c5c4 (diff)
downloaduxp-2cd89d58452f18eeffdbe0bfb86b2116297e041d.tar.gz
[layout] Avoid negative availSize.BSizes in paginated table reflow.
-rw-r--r--layout/tables/nsTableFrame.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 1d47da5849..3e7607e4fe 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -103,6 +103,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
@@ -2681,9 +2689,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
@@ -3003,9 +3009,7 @@ 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;
@@ -3170,9 +3174,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));
}
}