diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-23 10:36:09 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-24 10:39:16 +0000 |
commit | 24657db6290c7bbd3829cc38ff3321a725218dc1 (patch) | |
tree | 9438ce729adbd08e09a2879b2ccef5ce8a50fef4 /layout/tables/nsTableFrame.cpp | |
parent | 4939447eb7b3c426e2ca8a018e1a23bbda78f4bb (diff) | |
download | UXP-24657db6290c7bbd3829cc38ff3321a725218dc1.tar UXP-24657db6290c7bbd3829cc38ff3321a725218dc1.tar.gz UXP-24657db6290c7bbd3829cc38ff3321a725218dc1.tar.lz UXP-24657db6290c7bbd3829cc38ff3321a725218dc1.tar.xz UXP-24657db6290c7bbd3829cc38ff3321a725218dc1.zip |
[layout] Avoid negative availSize.BSizes in paginated table reflow.
Diffstat (limited to 'layout/tables/nsTableFrame.cpp')
-rw-r--r-- | layout/tables/nsTableFrame.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 59a6d0f1a..6d3527307 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 @@ -3004,9 +3010,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; @@ -3171,9 +3175,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)); } } |