Merge 3904: [LayoutNG] Fix may_break_inside in NGLineBreaker

This patch fixes |may_break_inside| in |NGLineBreaker|.

Issue 1002442 revealed an error case in |ShapingLineBreaker|.
In that case, it returns a result whose size is larger than
the available space.

Before this patch, |NGLineBreaker| assumes that the line
overflows if the result size is larger than the available
size, and sets |may_break_inside| to |false|, which
prevents breaking in |HandleOverflow()|. This can cause
rather a large layout error. tried to fix the error in
|ShapingLineBreaker|, but it looks like some tests is relying
on the behavior and it was reverted.

This patch instead makes |NGLineBreaker| more robust, by
using the actual overflow state from |ShapingLineBreaker| to
compute |may_break_inside|. The error in |ShapingLineBreaker|
is not fixed yet, but with this fix, the worst result is to
not able to fit a word that can fit by less than 1px or so.

Further work for better correctness will be tracked in
issue 1003742.

(cherry picked from commit 6701e989520620abc12d4a429e8fa9beb09ed2fe)

Bug: 1002442, 1003742
Change-Id: I13a3172abc8a0d2f5f78b2dd0b57b85de593fdff
Reviewed-by: Emil A Eklund <>
Commit-Queue: Koji Ishii <>
Cr-Original-Commit-Position: refs/heads/master@{#696621}
Reviewed-by: Koji Ishii <>
Cr-Commit-Position: refs/branch-heads/3904@{#257}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
4 files changed