Bug 1797009 - Extract common operation when reporting line-break-before status, and use PushTruncatedLine() more. r=emilio
This patch doesn't change behavior. Differential Revision: https://phabricator.services.mozilla.com/D160012
This commit is contained in:
@@ -3907,13 +3907,10 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||||||
// *it* to be pushed in its entirety.)
|
// *it* to be pushed in its entirety.)
|
||||||
aState.mBCoord = startingBCoord;
|
aState.mBCoord = startingBCoord;
|
||||||
aState.mPrevBEndMargin = incomingMargin;
|
aState.mPrevBEndMargin = incomingMargin;
|
||||||
*aKeepReflowGoing = false;
|
|
||||||
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
||||||
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
SetBreakBeforeStatusBeforeLine(aState, aLine, aKeepReflowGoing);
|
||||||
aLine->MarkDirty();
|
|
||||||
} else {
|
} else {
|
||||||
PushLines(aState, aLine.prev());
|
PushTruncatedLine(aState, aLine, aKeepReflowGoing);
|
||||||
aState.mReflowStatus.SetIncomplete();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4155,13 +4152,10 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||||||
|
|
||||||
if (frameReflowStatus.IsInlineBreakBefore()) {
|
if (frameReflowStatus.IsInlineBreakBefore()) {
|
||||||
// None of the child block fits.
|
// None of the child block fits.
|
||||||
*aKeepReflowGoing = false;
|
|
||||||
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
||||||
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
SetBreakBeforeStatusBeforeLine(aState, aLine, aKeepReflowGoing);
|
||||||
aLine->MarkDirty();
|
|
||||||
} else {
|
} else {
|
||||||
PushLines(aState, aLine.prev());
|
PushTruncatedLine(aState, aLine, aKeepReflowGoing);
|
||||||
aState.mReflowStatus.SetIncomplete();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Note: line-break-after a block is a nop
|
// Note: line-break-after a block is a nop
|
||||||
@@ -4235,8 +4229,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||||||
mLines.after_insert(aLine, line);
|
mLines.after_insert(aLine, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
PushLines(aState, aLine);
|
PushTruncatedLine(aState, aLine.next(), aKeepReflowGoing);
|
||||||
aState.mReflowStatus.SetIncomplete();
|
|
||||||
|
|
||||||
// If we need to reflow the continuation of the block child,
|
// If we need to reflow the continuation of the block child,
|
||||||
// then we'd better reflow our continuation
|
// then we'd better reflow our continuation
|
||||||
@@ -4262,7 +4255,6 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*aKeepReflowGoing = false;
|
|
||||||
|
|
||||||
// The block-end margin for a block is only applied on the last
|
// The block-end margin for a block is only applied on the last
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
@@ -4331,15 +4323,11 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||||||
// If it's our very first line *or* we're not at the top of the page
|
// If it's our very first line *or* we're not at the top of the page
|
||||||
// and we have page-break-inside:avoid, then we need to be pushed to
|
// and we have page-break-inside:avoid, then we need to be pushed to
|
||||||
// our parent's next-in-flow.
|
// our parent's next-in-flow.
|
||||||
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
SetBreakBeforeStatusBeforeLine(aState, aLine, aKeepReflowGoing);
|
||||||
// When we reflow in the new position, we need to reflow this
|
|
||||||
// line again.
|
|
||||||
aLine->MarkDirty();
|
|
||||||
} else {
|
} else {
|
||||||
// Push the line that didn't fit and any lines that follow it
|
// Push the line that didn't fit and any lines that follow it
|
||||||
// to our next-in-flow.
|
// to our next-in-flow.
|
||||||
PushLines(aState, aLine.prev());
|
PushTruncatedLine(aState, aLine, aKeepReflowGoing);
|
||||||
aState.mReflowStatus.SetIncomplete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4433,6 +4421,15 @@ void nsBlockFrame::ReflowInlineFrames(BlockReflowState& aState,
|
|||||||
} while (LineReflowStatus::RedoNextBand == lineReflowStatus);
|
} while (LineReflowStatus::RedoNextBand == lineReflowStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsBlockFrame::SetBreakBeforeStatusBeforeLine(BlockReflowState& aState,
|
||||||
|
LineIterator aLine,
|
||||||
|
bool* aKeepReflowGoing) {
|
||||||
|
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
||||||
|
// Reflow the line again when we reflow at our new position.
|
||||||
|
aLine->MarkDirty();
|
||||||
|
*aKeepReflowGoing = false;
|
||||||
|
}
|
||||||
|
|
||||||
void nsBlockFrame::PushTruncatedLine(BlockReflowState& aState,
|
void nsBlockFrame::PushTruncatedLine(BlockReflowState& aState,
|
||||||
LineIterator aLine,
|
LineIterator aLine,
|
||||||
bool* aKeepReflowGoing) {
|
bool* aKeepReflowGoing) {
|
||||||
@@ -5184,10 +5181,7 @@ bool nsBlockFrame::PlaceLine(BlockReflowState& aState,
|
|||||||
if (!aState.mReflowStatus.IsFullyComplete() &&
|
if (!aState.mReflowStatus.IsFullyComplete() &&
|
||||||
ShouldAvoidBreakInside(aState.mReflowInput)) {
|
ShouldAvoidBreakInside(aState.mReflowInput)) {
|
||||||
aLine->AppendFloats(std::move(aState.mCurrentLineFloats));
|
aLine->AppendFloats(std::move(aState.mCurrentLineFloats));
|
||||||
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
SetBreakBeforeStatusBeforeLine(aState, aLine, aKeepReflowGoing);
|
||||||
// Reflow the line again when we reflow at our new position.
|
|
||||||
aLine->MarkDirty();
|
|
||||||
*aKeepReflowGoing = false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5198,8 +5192,7 @@ bool nsBlockFrame::PlaceLine(BlockReflowState& aState,
|
|||||||
NS_ASSERTION(aState.mCurrentLine == aLine, "oops");
|
NS_ASSERTION(aState.mCurrentLine == aLine, "oops");
|
||||||
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
|
||||||
// All our content doesn't fit, start on the next page.
|
// All our content doesn't fit, start on the next page.
|
||||||
aState.mReflowStatus.SetInlineLineBreakBeforeAndReset();
|
SetBreakBeforeStatusBeforeLine(aState, aLine, aKeepReflowGoing);
|
||||||
*aKeepReflowGoing = false;
|
|
||||||
} else {
|
} else {
|
||||||
// Push aLine and all of its children and anything else that
|
// Push aLine and all of its children and anything else that
|
||||||
// follows to our next-in-flow.
|
// follows to our next-in-flow.
|
||||||
|
|||||||
@@ -779,6 +779,15 @@ class nsBlockFrame : public nsContainerFrame {
|
|||||||
bool CreateContinuationFor(BlockReflowState& aState, nsLineBox* aLine,
|
bool CreateContinuationFor(BlockReflowState& aState, nsLineBox* aLine,
|
||||||
nsIFrame* aFrame);
|
nsIFrame* aFrame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set line-break-before status in aState.mReflowStatus because aLine cannot
|
||||||
|
* be placed on this page/column and we don't want to break within ourselves.
|
||||||
|
* Also, mark the aLine dirty, and set aKeepReflowGoing to false;
|
||||||
|
*/
|
||||||
|
void SetBreakBeforeStatusBeforeLine(BlockReflowState& aState,
|
||||||
|
LineIterator aLine,
|
||||||
|
bool* aKeepReflowGoing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push aLine (and any after it), since it cannot be placed on this
|
* Push aLine (and any after it), since it cannot be placed on this
|
||||||
* page/column. Set aKeepReflowGoing to false and set
|
* page/column. Set aKeepReflowGoing to false and set
|
||||||
|
|||||||
Reference in New Issue
Block a user