Bug 1602855 [wpt PR 20708] - [LayoutNG] Fix hyphens when rewinding occurs, a=testonly
authorKoji Ishii <kojii@chromium.org>
Thu, 12 Dec 2019 10:16:01 +0000
changeset 507196 8804236fbe7a95333c4c9fde8ee5b5b4a9b4e127
parent 507195 4f50ccdf7d5b833374158ebe6ac52639e7ac46e7
child 507197 1c2cfcf57d414c54ba267b51e822525a81815388
push id36923
push userccoroiu@mozilla.com
push dateMon, 16 Dec 2019 21:47:33 +0000
treeherdermozilla-central@c238b47d7d57 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1602855, 20708, 1868534, 1028817, 1941451, 1015297, 1943784, 723458
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
--- a/testing/web-platform/tests/css/css-text/hyphens/hyphens-overflow-001.html
+++ b/testing/web-platform/tests/css/css-text/hyphens/hyphens-overflow-001.html
@@ -4,18 +4,22 @@
 <link rel="help" href="https://drafts.csswg.org/css-text-3/#hyphens-property">
 <link rel="author" href="mailto:kojii@chromium.org">
 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
 <style>
 div {
   font-size: 10px;
   font-family: Ahem;
   width: 5.1ch;
+  border: 1px solid blue;
 }
 </style>
 <body>
   <div>12 4&shy;xx</div>
   <div>12 45&shy;xx</div>
   <div>12 456&shy;xx</div>
   <div>1234&shy;xx</div>
   <div>12345&shy;xx</div>
   <div>123456&shy;xx</div>
+
+  <div style="width: 10ch"><span>ren&shy;for&shy;cer</span>99999</div>
+  <div><span>00&shy;1</span>222</div>
 </body>
--- a/testing/web-platform/tests/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html
+++ b/testing/web-platform/tests/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html
@@ -1,16 +1,21 @@
 <!DOCTYPE html>
 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
 <style>
 div {
   font-size: 10px;
   font-family: Ahem;
+  width: 5.1ch;
+  border: 1px solid blue;
 }
 </style>
 <body>
   <div>12 4-<br>xx</div>
   <div>12<br>45xx</div>
   <div>12<br>456xx</div>
   <div>1234-<br>xx</div>
   <div>12345-<br>xx</div>
   <div>123456-<br>xx</div>
+
+  <div style="width: 10ch">renfor-<br>cer99999</div>
+  <div>00-<br>1222</div>
 </body>