line should not be broken before the first space after a word
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 19:56:56 +0000 (19:56 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 19:56:56 +0000 (19:56 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244748 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/line/BreakingContext.h

index ec96697..ef824a1 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-29  Javier Fernandez  <jfernandez@igalia.com>
+
+        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  <youenn@apple.com>
 
         RTCTrackEvent should be delayed until the whole remote description is set
index d4ce8c4..430bfcd 100644 (file)
@@ -1801,8 +1801,6 @@ http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-i
 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/
 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,13 +1945,21 @@ webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/word-break/word
 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 ]
 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,9 +1974,13 @@ webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/o
 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
index c03dff3..3f52a49 100644 (file)
@@ -1,5 +1,43 @@
 2019-04-29  Javier Fernandez  <jfernandez@igalia.com>
 
+        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  <jfernandez@igalia.com>
+
         Update the CSS Text WPT test suite
         https://bugs.webkit.org/show_bug.cgi?id=197326
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-001.html
new file mode 100644 (file)
index 0000000..e5221e1
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-002.html
new file mode 100644 (file)
index 0000000..c7c3688
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-003.html
new file mode 100644 (file)
index 0000000..5848f4e
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-004.html
new file mode 100644 (file)
index 0000000..c14f5c1
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-005.html
new file mode 100644 (file)
index 0000000..2759c93
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-006.html
new file mode 100644 (file)
index 0000000..aabc3ba
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-007.html
new file mode 100644 (file)
index 0000000..0336fd4
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-008.html
new file mode 100644 (file)
index 0000000..d93a56f
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-009.html
new file mode 100644 (file)
index 0000000..11b623e
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-010.html
new file mode 100644 (file)
index 0000000..5012e98
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-011.html
new file mode 100644 (file)
index 0000000..3134b03
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-012.html
new file mode 100644 (file)
index 0000000..e811053
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013-expected.html
new file mode 100644 (file)
index 0000000..dece5f7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<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>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-before-first-char-013.html
new file mode 100644 (file)
index 0000000..0d6e398
--- /dev/null
@@ -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="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<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>
index a59844e..d3cb7c5 100644 (file)
@@ -3486,8 +3486,11 @@ webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word
 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 ]
index c6dbd89..a4ea66d 100644 (file)
@@ -1516,6 +1516,10 @@ webkit.org/b/193629 fast/css3-text/css3-text-decoration/text-underline-style.htm
 
 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 ]
index dcb5cf3..e54825c 100644 (file)
@@ -1,3 +1,54 @@
+2019-04-29  Javier Fernandez  <jfernandez@igalia.com>
+
+        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  <cdumez@apple.com>
 
         User-facing strings should use curly quotes instead of straight
index 8d244ec..8c766e6 100644 (file)
@@ -821,7 +821,7 @@ static bool createLineRuns(LineState& line, const LineState& previousLine, Layou
                     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;
index f355a2b..24010f6 100644 (file)
@@ -755,7 +755,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
         // 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 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
                 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 @@ inline void BreakingContext::trailingSpacesHang(InlineIterator& lineBreak, Rende
     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());