Commit 68f696ef authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1663439 - Avoid negative avail bsizes in paginated table reflow. r=TYLin, a=tjr

This causes an assertion when printing the test-case, though it turns
out not to be the cause of the bug in the end. Still seems worth fixing,
and will be tested by the test in the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D90145
parent fd391b26
......@@ -110,6 +110,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
......@@ -2689,9 +2697,7 @@ void 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 nsTableFrame::OrderRowGroups(RowGroupArray& aChildren,
......@@ -2956,9 +2962,7 @@ void 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;
......@@ -3116,10 +3120,7 @@ void 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));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment