Commit 58610cd0 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Ensure NGInlineLayoutAlgorithm consumes the last opportunity

This patch changes |NGInlineLayoutAlgorithm::Layout()| so
that it consumes the last opportunity even if it seems the
line does not fit to it.

This normally does not happen as the last opportunity is
designed to fit any lines, but arithmetic overflow can still
pretend the line does not fit to any opportunities.

This patch changes so that the last opportunity never fail.

Bug: 982126
Change-Id: If0c460f20d48b01b125e2f10bc50182fa5654eb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695304
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676129}
parent 425ce98c
......@@ -863,17 +863,19 @@ scoped_refptr<const NGLayoutResult> NGInlineLayoutAlgorithm::Layout() {
!opportunity.IsBlockDeltaBelowShapes(block_delta)) {
block_delta += LayoutUnit(1);
line_block_size = LayoutUnit();
} else {
// We've either don't have any shapes, or run out of block-delta space
// to test, proceed to the next layout opportunity.
continue;
}
// We've either don't have any shapes, or run out of block-delta space
// to test, proceed to the next layout opportunity.
if (opportunities_it + 1 != opportunities.end()) {
block_delta = LayoutUnit();
line_block_size = LayoutUnit();
++opportunities_it;
continue;
}
// There must be at least one more opportunity, or we fail to call
// |CreateLine()|.
DCHECK_NE(opportunities_it, opportunities.end());
continue;
// Normally the last opportunity should fit the line, but arithmetic
// overflow can lead to failures for all opportunities. Just let the line
// to overflow in that case.
}
PrepareBoxStates(line_info, break_token);
......
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