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 { ...@@ -110,6 +110,14 @@ struct TableReflowInput {
availSize.BSize(wm) = std::max(0, availSize.BSize(wm)); 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 } // namespace mozilla
...@@ -2689,9 +2697,7 @@ void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput, ...@@ -2689,9 +2697,7 @@ void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
aReflowInput.bCoord += aKidDesiredSize.BSize(wm); aReflowInput.bCoord += aKidDesiredSize.BSize(wm);
// If our bsize is constrained, then update the available bsize // If our bsize is constrained, then update the available bsize
if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) { aReflowInput.ReduceAvailableBSizeBy(wm, aKidDesiredSize.BSize(wm));
aReflowInput.availSize.BSize(wm) -= aKidDesiredSize.BSize(wm);
}
} }
void nsTableFrame::OrderRowGroups(RowGroupArray& aChildren, void nsTableFrame::OrderRowGroups(RowGroupArray& aChildren,
...@@ -2956,9 +2962,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, ...@@ -2956,9 +2962,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
kidReflowInput.mFlags.mIsTopOfPage = false; kidReflowInput.mFlags.mIsTopOfPage = false;
} }
aReflowInput.bCoord += cellSpacingB; aReflowInput.bCoord += cellSpacingB;
if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) { aReflowInput.ReduceAvailableBSizeBy(wm, cellSpacingB);
aReflowInput.availSize.BSize(wm) -= cellSpacingB;
}
// record the presence of a next in flow, it might get destroyed so we // record the presence of a next in flow, it might get destroyed so we
// need to reorder the row group array // need to reorder the row group array
bool reorder = false; bool reorder = false;
...@@ -3116,10 +3120,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, ...@@ -3116,10 +3120,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
} }
aReflowInput.bCoord += kidRect.BSize(wm); aReflowInput.bCoord += kidRect.BSize(wm);
// If our bsize is constrained then update the available bsize. aReflowInput.ReduceAvailableBSizeBy(wm, cellSpacingB + kidRect.BSize(wm));
if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) {
aReflowInput.availSize.BSize(wm) -= cellSpacingB + kidRect.BSize(wm);
}
} }
} }
......
Supports Markdown
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