Bug 1464761 Part 2 - Remove IsTruncated() in nsTableRowFrame::ReflowCellFrame(). r=dholbert

We call NS_FRAME_SET_TRUNCATION (via nsReflowStatus::UpdateTruncated) in the end
of every frame's Reflow() to update nsReflowStatus::mTruncated bit. In the
following patches, I'm going to rewrite all the callers of IsTruncated(), and
ultimately remove the mTruncated bit.

In this patch, I rewrite the callsite in ReflowCellFrame() by moving
nsReflowStatus::UpdateTruncated logic [1] into it. Note that we use an assertion
in ReflowCellFrame to make sure nsTableRowFrame and nsTableCellFrame have the
same writing-mode.

The only test covering the code path is `layout/reftests/bugs/409084-1a.html`.

[1] https://searchfox.org/mozilla-central/rev/2946e9b450cb35afaf8dad927a8d187975dcd74d/layout/generic/nsIFrame.cpp#256-258

Differential Revision: https://phabricator.services.mozilla.com/D151459
This commit is contained in:
Ting-Yu Lin 2022-07-27 21:55:17 +00:00
Родитель 31f785b94b
Коммит 50b0c4bcfd
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -1073,6 +1073,8 @@ nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
nsTableCellFrame* aCellFrame,
nscoord aAvailableBSize,
nsReflowStatus& aStatus) {
MOZ_ASSERT(aAvailableBSize != NS_UNCONSTRAINEDSIZE,
"Why split cell frame if available bsize is unconstrained?");
WritingMode wm = aReflowInput.GetWritingMode();
// Reflow the cell frame with the specified height. Use the existing width
@ -1096,8 +1098,11 @@ nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowInput, 0, 0,
ReflowChildFlags::NoMoveFrame, aStatus);
bool fullyComplete = aStatus.IsComplete() && !aStatus.IsTruncated();
if (fullyComplete) {
const bool isTruncated =
aAvailableBSize < desiredSize.BSize(wm) &&
!aIsTopOfPage; // XXX Is !aIsTopOfPage check really necessary?
const bool isCompleteAndNotTruncated = aStatus.IsComplete() && !isTruncated;
if (isCompleteAndNotTruncated) {
desiredSize.BSize(wm) = aAvailableBSize;
}
aCellFrame->SetSize(
@ -1106,7 +1111,7 @@ nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
// Note: BlockDirAlignChild can affect the overflow rect.
// XXX What happens if this cell has 'vertical-align: baseline' ?
// XXX Why is it assumed that the cell's ascent hasn't changed ?
if (fullyComplete) {
if (isCompleteAndNotTruncated) {
aCellFrame->BlockDirAlignChild(wm, mMaxCellAscent);
}