Bug 1480358 - Have the second OptionallyBreak actually make sense. r=jfkthame
authorXidorn Quan <me@upsuper.org>
Fri, 03 Aug 2018 07:21:35 +0000
changeset 826510 3ffc14b88b8ed2019210e9540bbcab44bc9fa0e0
parent 826509 9243cab399140667f6dc8e31ead3f09db1df8b31
child 826511 fe0afb18004246b75c6b5586816dfa9390010379
push id118355
push userwisniewskit@gmail.com
push dateSat, 04 Aug 2018 00:24:59 +0000
reviewersjfkthame
bugs1480358
milestone63.0a1
Bug 1480358 - Have the second OptionallyBreak actually make sense. r=jfkthame Differential Revision: https://phabricator.services.mozilla.com/D2696
layout/generic/nsTextFrame.cpp
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html
testing/web-platform/tests/css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -8553,16 +8553,17 @@ nsTextFrame::AddInlineMinISizeForFlow(gf
   }
 
   // If overflow-wrap is break-word, we can wrap everywhere.
   if (textStyle->WordCanWrap(this)) {
     aData->OptionallyBreak();
     aData->mCurrentLine +=
       textRun->GetMinAdvanceWidth(Range(start, flowEndInTextRun));
     aData->mTrailingWhitespace = 0;
+    aData->mAtStartOfLine = false;
     aData->OptionallyBreak();
     return;
   }
 
   AutoTArray<gfxTextRun::HyphenType, BIG_TEXT_NODE_SIZE> hyphBuffer;
   if (hyphenating) {
     if (hyphBuffer.AppendElements(flowEndInTextRun - start, fallible)) {
       provider.GetHyphenationBreaks(Range(start, flowEndInTextRun),
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -135404,16 +135404,28 @@
       [
        "/css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html",
        "=="
       ]
      ],
      {}
     ]
    ],
+   "css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html": [
+    [
+     "/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html",
+     [
+      [
+       "/css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html",
+       "=="
+      ]
+     ],
+     {}
+    ]
+   ],
    "css/css-text/overflow-wrap/word-wrap-001.html": [
     [
      "/css/css-text/overflow-wrap/word-wrap-001.html",
      [
       [
        "/css/css-text/overflow-wrap/overflow-wrap-001-ref.html",
        "=="
       ]
@@ -258249,16 +258261,21 @@
      {}
     ]
    ],
    "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html": [
     [
      {}
     ]
    ],
+   "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html": [
+    [
+     {}
+    ]
+   ],
    "css/css-text/support/1x1-green.png": [
     [
      {}
     ]
    ],
    "css/css-text/support/1x1-lime.png": [
     [
      {}
@@ -543061,16 +543078,20 @@
   "css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html": [
    "e4a7ef4a3852d328e8410b81ef20c4d3de0d771e",
    "reftest"
   ],
   "css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html": [
    "5b3b1f19d7ae6374224da75567b3ba5279d16127",
    "reftest"
   ],
+  "css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html": [
+   "d1af28ffad4161c1dba7567cacb3b06098b155fa",
+   "reftest"
+  ],
   "css/css-text/overflow-wrap/reference/overflow-wrap-break-word-001-ref.html": [
    "0e0300a72dc920a5ffb54cda6fbe84a2f517d010",
    "support"
   ],
   "css/css-text/overflow-wrap/reference/overflow-wrap-break-word-002-ref.html": [
    "5dca68381729c017bac1724d8a195b33af847eaf",
    "support"
   ],
@@ -543085,16 +543106,20 @@
   "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-001-ref.html": [
    "99d964777c663fb8ca37be00c162ddfbb82951c9",
    "support"
   ],
   "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html": [
    "055ffbf3ca1377aaa502ffa02c52c8e49604a286",
    "support"
   ],
+  "css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html": [
+   "a71b3a34d6920a5404cf7c954fa1c8ab66b788b4",
+   "support"
+  ],
   "css/css-text/overflow-wrap/word-wrap-001.html": [
    "dd5f0f2bf132de85c7a1045e88aa3ad2b72616c1",
    "reftest"
   ],
   "css/css-text/overflow-wrap/word-wrap-002.html": [
    "380fb8ec4fde4decb82e52961ce5ef71a0a6c965",
    "reftest"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: break-word and intrinsic sizing</title>
+<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org/">
+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/overflow-wrap-min-content-size-003-ref.html">
+<meta name="assert" content="overflow-wrap:break-word breaks at edge of inline elements.">
+<style>
+#wrapper {
+  width: 0px;
+  font: 16px / 1 Ahem;
+  overflow-wrap: break-word;
+  color: green;
+}
+#test {
+  float: left;
+}
+#reference {
+  position: absolute;
+  width: 16px;
+  height: 128px;
+  background: red;
+  z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a vertical green bar below.
+<div id="wrapper">
+  <div id="reference"></div>
+  <div id="test"><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span></div>
+</div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test reference</title>
+<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org/">
+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+<meta name="flags" content="ahem">
+<style>
+#wrapper {
+  width: 0px;
+  font: 16px / 1 Ahem;
+  color: green;
+}
+#test {
+  float: left;
+}
+#reference {
+  position: absolute;
+  width: 16px;
+  height: 128px;
+  background: red;
+  z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a vertical green bar below.
+<div id="wrapper">
+  <div id="reference"></div>
+  <div id="test">X<br>X<br>X<br>X<br>X<br>X<br>X<br>X</div>
+</div>