Bug 1602855 [wpt PR 20708] - [LayoutNG] Fix hyphens when rewinding occurs, a=testonly
commit68844e4d39835e5382fbb6db67eef107421fedc0
authorKoji Ishii <kojii@chromium.org>
Thu, 12 Dec 2019 10:16:01 +0000 (12 10:16 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Mon, 16 Dec 2019 17:41:22 +0000 (16 17:41 +0000)
tree0957ccd98bae78299b9929a0132815c423d1318b
parent0b38b8cdb0663fedac6f8fc4ea6b49d0f8786a74
Bug 1602855 [wpt PR 20708] - [LayoutNG] Fix hyphens when rewinding occurs, a=testonly

Automatic update from web-platform-tests
[LayoutNG] Fix hyphens when rewinding occurs

This is a re-land of:
https://chromium-review.googlesource.com/c/chromium/src/+/1868534

The original patch caused a regression and was reverted for
crbug.com/1028817. A test was added for the case at:
https://chromium-review.googlesource.com/c/chromium/src/+/1941451

The problem happened when |HandleOverflow| tried to break a
text item but it didn't fit. |NGLineBreaker| looks for
previous opportunities and rewind, but items it tried to
break were modified, which confused |NGLineBreaker|.

The old patch stopped rewinding there. The new approach is to
restore the original item when it failed to break so that it
can always see the original items.

:: The original description follows ::

This patch removes |NGLineInfo::LineEndFragment|, which was
introduced to support hyphens and ellipsis with the single
code. However, ellipsis was changed to use different code,
and |LineEndFragment| ended up with non-optimal way to handle
hyphens.

Although hyphens appear at most once in a line, storing this
to |NGLineInfo| makes harder to keep it in sync with the
hyphenated item. This patch changes it to a field in
|NGInlineItemResult|.

Bug: 1015297
Change-Id: I1dab0dacd8445ed563527bdc90d58b18470725f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943784
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723458}

--

wpt-commits: 5297717c66073692f003d0cbb780594c07df6190
wpt-pr: 20708
testing/web-platform/tests/css/css-text/hyphens/hyphens-overflow-001.html
testing/web-platform/tests/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html