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)
commit6132a48e900a1b0d6052906a5c432c6323b9df9d
treea3a0aaf8f7e64831edf860b0bfddc9134b3885c4
parente0602dc8df96ef8d8ab94994a905d74fc1ef88a4
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:

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