[LayoutNG] Fix when adding a hyphen causes the line to overflow

When adding a hyphen causes the line to overflow, this patch
retries another break opportunity with the reeuced available
width instead of the line to overflow.

Bug: 982729
Change-Id: I8e7e56fe68cdfb101ebfedd3a43c062c97a56e81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1699942
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677216}
diff --git a/css/css-text/hyphens/hyphens-overflow-001.html b/css/css-text/hyphens/hyphens-overflow-001.html
new file mode 100644
index 0000000..cddaa6b
--- /dev/null
+++ b/css/css-text/hyphens/hyphens-overflow-001.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<title>CSS Text Test: Test when soft-hyphen overflows</title>
+<link rel="match" href="reference/hyphens-overflow-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#hyphens-property">
+<link rel="author" href="mailto:kojii@chromium.org">
+<style>
+div {
+  font-size: 10px;
+  font-family: Ahem;
+  width: 5.1ch;
+}
+</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>
+</body>
diff --git a/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html b/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html
new file mode 100644
index 0000000..3bbd5fe
--- /dev/null
+++ b/css/css-text/hyphens/reference/hyphens-overflow-001-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+div {
+  font-size: 10px;
+  font-family: Ahem;
+}
+</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>
+</body>