Title: [244748] trunk
Revision
244748
Author
[email protected]
Date
2019-04-29 12:56:56 -0700 (Mon, 29 Apr 2019)

Log Message

line should not be broken before the first space after a word
https://bugs.webkit.org/show_bug.cgi?id=197278

Reviewed by Myles C. Maxfield.

LayoutTests/imported/w3c:

Added new Web Platform Tests to cover the cases discussed [1] with the CSS WG.

[1] https://github.com/w3c/csswg-drafts/issues/3701

* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html: Added.

Source/WebCore:

The 'white-space: break-spaces' only adds breaking opportunities after
a white space character. However, it's possible to break before the
first space after a word when the feature is used in combination with
other properties, like overflow-wrap.

However, breaking before the first space should not be allowed if
there are previous opportunities. We wrongly assumed that we had to
consider these previous breaking opportunities if the proper combination
of line breaking properties is being used, so that breaking before the
first space after a word is allowed.

This wrong assumption caused several issues, like the one described in
the bug, that lead to incorrectly break before the first space even
though there are previous opportunities, either white spaces or between
letters.

Theses issues have been analyzed [1] by the CSS WG and finally agreed on a
expected behavior, represented in the Web Platform tests added in this
patch.

For the later case, of considering previous opportunities between
letters, we have a seperated issue #952254, so the tests covering such
cases will be added to the TestExpecations as Failure entries.

[1] https://github.com/w3c/csswg-drafts/issues/3701

Tests: imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::trailingSpacesHang):

LayoutTests:

Added a few Skip (due to unimplemented features) and Failure (break-all related
issues) entries for some of the tests added by this patch.

* TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244747 => 244748)


--- trunk/LayoutTests/ChangeLog	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/LayoutTests/ChangeLog	2019-04-29 19:56:56 UTC (rev 244748)
@@ -1,3 +1,15 @@
+2019-04-29  Javier Fernandez  <[email protected]>
+
+        line should not be broken before the first space after a word
+        https://bugs.webkit.org/show_bug.cgi?id=197278
+
+        Reviewed by Myles C. Maxfield.
+
+        Added a few Skip (due to unimplemented features) and Failure (break-all related
+        issues) entries for some of the tests added by this patch.
+
+        * TestExpectations:
+
 2019-04-29  Youenn Fablet  <[email protected]>
 
         RTCTrackEvent should be delayed until the whole remote description is set

Modified: trunk/LayoutTests/TestExpectations (244747 => 244748)


--- trunk/LayoutTests/TestExpectations	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/LayoutTests/TestExpectations	2019-04-29 19:56:56 UTC (rev 244748)
@@ -1801,8 +1801,6 @@
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/hanging-punctuation/hanging-punctuation-first-001.xht [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/hanging-punctuation/hanging-punctuation-force-end-001.xht [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/hanging-punctuation/hanging-punctuation-last-001.xht [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-002.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-strict-011.xht [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-strict-012.xht [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-002.html [ ImageOnlyFailure ]
@@ -1880,8 +1878,6 @@
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-upperlower-039.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-upperlower-103.html [ ImageOnlyFailure Pass ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-upperlower-104.html [ ImageOnlyFailure Pass ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-012.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-013.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-012.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/textarea-pre-wrap-013.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-004.html [ ImageOnlyFailure ]
@@ -1949,7 +1945,6 @@
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-segment-break-001.html [ ImageOnlyFailure ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-line-break-002.html [ ImageOnlyFailure ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-text-transform-001.html [ ImageOnlyFailure ]
-webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-line-break-001.html [ ImageOnlyFailure ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/hyphens/hyphens-auto-001.html [ ImageOnlyFailure ]
 
 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-008.html [ ImageOnlyFailure Pass ]
@@ -1956,6 +1951,15 @@
 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-009.html [ ImageOnlyFailure Pass ]
 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-010.html [ ImageOnlyFailure ]
 
+# The 'line-break: anywhere' feature is not implemented yet
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-002.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html [ Skip ]
+webkit.org/b/181169 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html [ Skip ]
+
 # overflow-wrap:anywhere feature is not implemented yet.
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html [ Skip ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html [ Skip ]
@@ -1970,10 +1974,14 @@
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html [ Skip ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-004.html [ Skip ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-word-overflow-wrap-interactions.html [ Skip ]
+webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html [ Skip ]
+webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html [ Skip ]
+webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html [ Skip ]
 
 webkit.org/b/197277 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-008.html [ ImageOnlyFailure ]
+webkit.org/b/197277 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html [ ImageOnlyFailure ]
+webkit.org/b/197277 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html [ ImageOnlyFailure ]
 
-
 ########################################
 ### START OF display: contents failures
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (244747 => 244748)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-29 19:56:56 UTC (rev 244748)
@@ -1,5 +1,43 @@
 2019-04-29  Javier Fernandez  <[email protected]>
 
+        line should not be broken before the first space after a word
+        https://bugs.webkit.org/show_bug.cgi?id=197278
+
+        Reviewed by Myles C. Maxfield.
+
+        Added new Web Platform Tests to cover the cases discussed [1] with the CSS WG.
+
+        [1] https://github.com/w3c/csswg-drafts/issues/3701
+
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html: Added.
+        * web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html: Added.
+
+2019-04-29  Javier Fernandez  <[email protected]>
+
         Update the CSS Text WPT test suite
         https://bugs.webkit.org/show_bug.cgi?id=197326
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: break-word;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  word-break: break-all;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: break-word;
+  word-break: break-all;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: anywhere;
+  word-break: break-all;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  line-break: anywhere;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  line-break: anywhere;
+  overflow-wrap: break-word;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  line-break: anywhere;
+  overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href=""
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  line-break: anywhere;
+  word-break: break-all;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href=""
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  line-break: anywhere;
+  word-break: break-all;
+  overflow-wrap: break-word;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">X XX X</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: break-word;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">XXXX XX</div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<body>
+    <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div></div>
+</body>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html (0 => 244748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html	2019-04-29 19:56:56 UTC (rev 244748)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href=""
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<style>
+div {
+  font: 25px/1 Ahem;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  width: 4ch;
+
+  white-space: break-spaces;
+  overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+  <div class="test">XXXX XX</div>
+</body>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (244747 => 244748)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2019-04-29 19:56:56 UTC (rev 244748)
@@ -3486,8 +3486,11 @@
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-007.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-bo-000.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-lo-000.html [ ImageOnlyFailure ]
+webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-012.html [ ImageOnlyFailure ]
+webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-013.html [ ImageOnlyFailure ]
 
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-014.html [ ImageOnlyFailure ]
+webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-line-break-001.html [ ImageOnlyFailure ]
 
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-004.html [ Timeout ImageOnlyFailure ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-005.html [ Timeout ImageOnlyFailure ]

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (244747 => 244748)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2019-04-29 19:56:56 UTC (rev 244748)
@@ -1516,7 +1516,11 @@
 
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-005.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-bo-000.html [ ImageOnlyFailure ]
+webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-012.html [ ImageOnlyFailure ]
+webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-013.html [ ImageOnlyFailure ]
 
+webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/writing-system/writing-system-line-break-001.html [ ImageOnlyFailure ]
+
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-006.html [ Timeout Pass ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-007.html [ Timeout Pass ]
 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-008.html [ Timeout Pass ]

Modified: trunk/Source/WebCore/ChangeLog (244747 => 244748)


--- trunk/Source/WebCore/ChangeLog	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/Source/WebCore/ChangeLog	2019-04-29 19:56:56 UTC (rev 244748)
@@ -1,3 +1,54 @@
+2019-04-29  Javier Fernandez  <[email protected]>
+
+        line should not be broken before the first space after a word
+        https://bugs.webkit.org/show_bug.cgi?id=197278
+
+        Reviewed by Myles C. Maxfield.
+
+        The 'white-space: break-spaces' only adds breaking opportunities after
+        a white space character. However, it's possible to break before the
+        first space after a word when the feature is used in combination with
+        other properties, like overflow-wrap.
+
+        However, breaking before the first space should not be allowed if
+        there are previous opportunities. We wrongly assumed that we had to
+        consider these previous breaking opportunities if the proper combination
+        of line breaking properties is being used, so that breaking before the
+        first space after a word is allowed.
+
+        This wrong assumption caused several issues, like the one described in
+        the bug, that lead to incorrectly break before the first space even
+        though there are previous opportunities, either white spaces or between
+        letters.
+
+        Theses issues have been analyzed [1] by the CSS WG and finally agreed on a
+        expected behavior, represented in the Web Platform tests added in this
+        patch.
+
+        For the later case, of considering previous opportunities between
+        letters, we have a seperated issue #952254, so the tests covering such
+        cases will be added to the TestExpecations as Failure entries.
+
+        [1] https://github.com/w3c/csswg-drafts/issues/3701
+
+        Tests: imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html
+               imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html
+
+        * rendering/line/BreakingContext.h:
+        (WebCore::BreakingContext::handleText):
+        (WebCore::BreakingContext::trailingSpacesHang):
+
 2019-04-29  Chris Dumez  <[email protected]>
 
         User-facing strings should use curly quotes instead of straight

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (244747 => 244748)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2019-04-29 19:56:56 UTC (rev 244748)
@@ -821,7 +821,7 @@
                     line.setOverflowedFragment(fragment);
                     break;
                 }
-                if (style.breakSpaces && style.breakWordOnOverflow && line.hasWhitespaceFragments() && fragment.length() == 1) {
+                if (style.breakSpaces && line.hasWhitespaceFragments() && fragment.length() == 1) {
                     // Breaking before the first space after a word is not allowed if there are previous breaking opportunities in the line.
                     textFragmentIterator.revertToEndOfFragment(line.revertToLastCompleteFragment(runs));
                     break;

Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (244747 => 244748)


--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2019-04-29 19:52:56 UTC (rev 244747)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2019-04-29 19:56:56 UTC (rev 244748)
@@ -755,7 +755,7 @@
         // A single preserved leading white-space doesn't fulfill the 'betweenWords' condition, however it's indeed a
         // soft-breaking opportunty so we may want to avoid breaking in the middle of the word.
         if (m_atStart && m_currentCharacterIsSpace && !previousCharacterIsSpace) {
-            m_hasFormerOpportunity = canBreakMidWord;
+            m_hasFormerOpportunity = true;
             breakWords = false;
             canBreakMidWord = breakAll;
         }
@@ -953,7 +953,7 @@
                 wrapW = wrapWidthOffset;
                 // Auto-wrapping text should not wrap in the middle of a word once it has had an
                 // opportunity to break after a word.
-                m_hasFormerOpportunity = canBreakMidWord;
+                m_hasFormerOpportunity = true;
                 breakWords = false;
                 canBreakMidWord = breakAll;
             }
@@ -1091,7 +1091,7 @@
     ASSERT(m_currWS == WhiteSpace::BreakSpaces);
     // Avoid breaking before the first white-space after a word if there is a
     // breaking opportunity before.
-    if (m_hasFormerOpportunity)
+    if (m_hasFormerOpportunity && !previousCharacterIsSpace)
         return;
 
     lineBreak.moveTo(renderObject, m_current.offset(), m_current.nextBreakablePosition());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to