Bug 1283222 - Do not record soft break opportunities for out-of-flow frames. r=emilio

We do want to record soft break opportunity after a frame whose content can't
be part of the existing in-flow text run, since this normally should be a text run
boundary. However, though an out-of-flow frame can't be part of the existing
in-flow text run, it also doesn't break it either. In fact, the texts after the
out-of-flow frames are able to continue the existing in-flow text run. So,
introducing a line-break-after opportunity in this case may cause an unexpected
line break for every out-of-flow frame.

In this patch, we add a condition to prevent us from recording soft break
opportunities for out-of-flow frames.

Differential Revision: https://phabricator.services.mozilla.com/D28625

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeremy Chen 2019-04-24 14:04:23 +00:00
Родитель 6fc44b7b90
Коммит e67424a97d
3 изменённых файлов: 4 добавлений и 10 удалений

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

@ -890,7 +890,6 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
// See if the frame is a placeholderFrame and if it is process
// the float. At the same time, check if the frame has any non-collapsed-away
// content.
bool placedFloat = false;
bool isEmpty;
if (frameType == LayoutFrameType::None) {
isEmpty = pfd->mFrame->IsEmpty();
@ -918,7 +917,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
// We'll do this at the next break opportunity.
RecordNoWrapFloat(outOfFlowFrame);
} else {
placedFloat = TryToPlaceFloat(outOfFlowFrame);
TryToPlaceFloat(outOfFlowFrame);
}
}
} else if (isText) {
@ -1064,11 +1063,12 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
}
if (!continuingTextRun && !psd->mNoWrap) {
if (!LineIsEmpty() || placedFloat) {
if (!LineIsEmpty()) {
// record soft break opportunity after this content that can't be
// part of a text run. This is not a text frame so we know
// that offset INT32_MAX means "after the content".
if (NotifyOptionalBreakPosition(aFrame, INT32_MAX,
if (!aFrame->IsPlaceholderFrame() &&
NotifyOptionalBreakPosition(aFrame, INT32_MAX,
optionalBreakAfterFits,
gfxBreakPriority::eNormalBreak)) {
// If this returns true then we are being told to actually break

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

@ -1,3 +0,0 @@
[line-breaking-016.html]
expected:
FAIL

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

@ -1,3 +0,0 @@
[line-breaking-017.html]
expected:
FAIL