WebKit Bugzilla
Attachment 371481 Details for
Bug 197970
: [css-text] break-spaces hangs a sequence of white spaces if it completely overflows the line length
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197970-20190606111824.patch (text/plain), 8.49 KB, created by
Javier Fernandez
on 2019-06-06 02:18:25 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Javier Fernandez
Created:
2019-06-06 02:18:25 PDT
Size:
8.49 KB
patch
obsolete
>Subversion Revision: 246104 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9e7d226de2ddffe2b80e5067f84fbf780fb64f65..b2bbf4c15b2a16df5bb6acf97296cd41a87ea950 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-06-05 Javier Fernandez <jfernandez@igalia.com> >+ >+ [css-text] break-spaces hangs a sequence of white spaces if it completely overflows the line length >+ https://bugs.webkit.org/show_bug.cgi?id=197970 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If the break-spaces value is used and it's not allowed to break a whitespace sequence before the first >+ char, we may have to assume a signle space to hang, wrapping the rest of the sequence to the next line. >+ >+ No new tests, this change is covered by current Web Platform Tests, which now pass. >+ >+ * rendering/SimpleLineLayout.cpp: >+ (WebCore::SimpleLineLayout::splitFragmentToFitLine): Added a new bool argument (default to false) to consider a single char to hang. >+ (WebCore::SimpleLineLayout::createLineRuns): Tell the splitting function that a single space must hang if we can't break before the first char of the whitespace sequence. >+ > 2019-06-01 Antoine Quint <graouts@apple.com> > > [Pointer Events] Add support for chorded button interactions >diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp >index 8c766e6de2c74ad037973331fc7f5a4749015b8e..d8c592fb207a723d17ab51208f7e3ad963ef6d2a 100644 >--- a/Source/WebCore/rendering/SimpleLineLayout.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayout.cpp >@@ -679,15 +679,17 @@ static SplitFragmentData split(const TextFragmentIterator::TextFragment& fragmen > } > > static TextFragmentIterator::TextFragment splitFragmentToFitLine(TextFragmentIterator::TextFragment& fragmentToSplit, >- const LineState& line, const TextFragmentIterator& textFragmentIterator) >+ const LineState& line, const TextFragmentIterator& textFragmentIterator, bool singleSpaceMayHang = false) > { >+ ASSERT(!singleSpaceMayHang || fragmentToSplit.type() == TextFragmentIterator::TextFragment::Whitespace); > auto availableWidth = line.availableWidth() - line.width(); > auto splitFragmentData = split(fragmentToSplit, availableWidth, textFragmentIterator); > Optional<unsigned> hyphenPosition = WTF::nullopt; > // Does first character fit this line? > if (splitFragmentData.position == fragmentToSplit.start()) { > // Keep at least one character on empty lines. >- if (line.isEmpty()) >+ // If a whitespace sequence doesn't fit, we may have to assume a single space to hang. >+ if (line.isEmpty() || singleSpaceMayHang) > splitFragmentData.width = textFragmentIterator.textWidth(fragmentToSplit.start(), ++splitFragmentData.position, 0); > } else { > hyphenPosition = hyphenPositionForFragment(splitFragmentData, fragmentToSplit, line, textFragmentIterator, availableWidth); >@@ -821,13 +823,18 @@ static bool createLineRuns(LineState& line, const LineState& previousLine, Layou > line.setOverflowedFragment(fragment); > break; > } >- if (style.breakSpaces && line.hasWhitespaceFragments() && fragment.length() == 1) { >+ bool singleSpaceMayHang = false; >+ if (style.breakSpaces) { > // 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; >+ if (line.hasWhitespaceFragments() && fragment.length() == 1) { >+ textFragmentIterator.revertToEndOfFragment(line.revertToLastCompleteFragment(runs)); >+ break; >+ } >+ // We may have to assume a single space hanging if we can't break before the first space of the whitespace sequence. >+ singleSpaceMayHang = !style.breakWordOnOverflow; > } > // Split the whitespace; left part stays on this line, right is pushed to next line. >- line.setOverflowedFragment(splitFragmentToFitLine(fragment, line, textFragmentIterator)); >+ line.setOverflowedFragment(splitFragmentToFitLine(fragment, line, textFragmentIterator, singleSpaceMayHang)); > line.appendFragmentAndCreateRunIfNeeded(fragment, runs); > break; > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index beb191bba577ffa033860ca321aec437ec5b204f..f6645601f37d7e98528bf07b66abf5e8f4bc2834 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-05 Javier Fernandez <jfernandez@igalia.com> >+ >+ [css-text] break-spaces hangs a sequence of white spaces if it completely overflows the line length >+ https://bugs.webkit.org/show_bug.cgi?id=197970 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Removed some Failure expectations, solved by this change. >+ >+ * platform/ios/TestExpectations: >+ * platform/mac/TestExpectations: >+ - break-spaces-010.html test pass now with this change. >+ > 2019-06-05 Javier Fernandez <jfernandez@igalia.com> > > Update the CSS Text WPT test suite >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 9b6f2fba15f43df119149fb39f684c3c74766aa7..951c7b01e5a2f6f1c78494e0e620758dfef73a86 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,14 @@ >+2019-06-05 Javier Fernandez <jfernandez@igalia.com> >+ >+ [css-text] break-spaces hangs a sequence of white spaces if it completely overflows the line length >+ https://bugs.webkit.org/show_bug.cgi?id=197970 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixed incorrect height for the green box used as reference. >+ >+ * web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html: >+ > 2019-06-05 Javier Fernandez <jfernandez@igalia.com> > > Update the CSS Text WPT test suite >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html >index 576ebc864c3d9a603b07c36fa274449810122f1a..f9a3c8a52aa6435cd4b862f4a5229d8ceb89b34e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html >@@ -16,7 +16,7 @@ > background: green; > font-family: monospace; > width: 1ch; >- height: 20em; >+ height: 19em; > } > #test { > width: 1ch; >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 25d58bceda6824a95656ae424d37179b8221487c..b1892d37a3f7f286565b33194bfc3dd1033e5bdc 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -3076,7 +3076,6 @@ webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word > webkit.org/b/196169 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html [ ImageOnlyFailure ] > > imported/w3c/web-platform-tests/css/css-text/white-space/textarea-break-spaces-001.html [ ImageOnlyFailure ] >-webkit.org/b/197970 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-010.html [ ImageOnlyFailure ] > webkit.org/b/198543 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html [ ImageOnlyFailure ] > > # unsupported >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index afd983655cb68c8850b0bd8d0cc13327b312615c..67a560cea79715172ee624ff1f609970833bde3c 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1692,7 +1692,6 @@ webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/i18n/css3-text- > webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-006.html [ ImageOnlyFailure ] > webkit.org/b/196169 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html [ ImageOnlyFailure ] > >-webkit.org/b/197970 imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-010.html [ ImageOnlyFailure ] > webkit.org/b/198543 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html [ ImageOnlyFailure ] > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197970
:
370085
|
370086
|
370087
|
371403
|
371480
|
371481
|
371484