Commit 3c9ddfeb authored by Javier Fernandez's avatar Javier Fernandez Committed by Commit Bot

[css-text] Skip trailing spaces for pre-wrap even if word can be broken

According to the specs, preserved white-spaces should hang, or visually
collapse, when white-space is set to pre-wrap; even if word-break allows
breaing the word at any point.

https://www.w3.org/TR/css-text-3/#line-break-details

Bug: 768363
Change-Id: I7ab356ed6f789ecef087ff469ad97c50e7af49be
Reviewed-on: https://chromium-review.googlesource.com/c/1318694Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#607550}
parent bab19ca5
...@@ -2074,8 +2074,6 @@ crbug.com/626703 [ Win ] external/wpt/css/css-text/word-break/word-break-normal- ...@@ -2074,8 +2074,6 @@ crbug.com/626703 [ Win ] external/wpt/css/css-text/word-break/word-break-normal-
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-normal-my-000.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/word-break/word-break-normal-my-000.html [ Failure ]
crbug.com/626703 [ Linux Win ] external/wpt/css/css-text/word-break/word-break-normal-lo-000.html [ Failure ] crbug.com/626703 [ Linux Win ] external/wpt/css/css-text/word-break/word-break-normal-lo-000.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-normal-tdd-000.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/word-break/word-break-normal-tdd-000.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-002.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/white-space/textarea-pre-wrap-002.html [ Failure ]
crbug.com/40634 external/wpt/css/css-text/white-space/trailing-space-before-br-001.html [ Failure ] crbug.com/40634 external/wpt/css/css-text/white-space/trailing-space-before-br-001.html [ Failure ]
crbug.com/666657 external/wpt/css/css-text-decor/text-emphasis-color-001.xht [ Failure ] crbug.com/666657 external/wpt/css/css-text-decor/text-emphasis-color-001.xht [ Failure ]
......
...@@ -20,7 +20,7 @@ selection_test( ...@@ -20,7 +20,7 @@ selection_test(
'<table contenteditable="false">', '<table contenteditable="false">',
'<tbody><tr>', '<tbody><tr>',
'<td>foo</td>', '<td>foo</td>',
'<td contenteditable>bar\xA0|</td>', '<td contenteditable>bar |</td>',
'<td>qux</td>', '<td>qux</td>',
'</tr></tbody>', '</tr></tbody>',
'</table>', '</table>',
......
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on word-break:break-all</title> <title>CSS Text level 3 Test: preserved white space at the end of the line and white-space:pre-wrap does not change based on word-break:break-all</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> <link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="match" href="reference/pre-wrap-001-ref.html"> <link rel="match" href="reference/pre-wrap-001-ref.html">
......
...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600 ...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600
LayoutTableSection {TBODY} at (0,0) size 30x50 LayoutTableSection {TBODY} at (0,0) size 30x50
LayoutTableRow {TR} at (0,2) size 30x22 LayoutTableRow {TR} at (0,2) size 30x22
LayoutTableCell {TD} at (2,2) size 26x22 [r=0 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,2) size 26x22 [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (1,1) size 24x19 LayoutText {#text} at (1,1) size 25x19
text run at (1,1) width 24: "foo" text run at (1,1) width 24: "foo"
text run at (25,1) width 1: " "
LayoutTableRow {TR} at (0,26) size 30x22 LayoutTableRow {TR} at (0,26) size 30x22
LayoutTableCell {TD} at (2,26) size 26x22 [r=1 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,26) size 26x22 [r=1 c=0 rs=1 cs=1]
LayoutText {#text} at (1,1) size 24x19 LayoutText {#text} at (1,1) size 25x19
text run at (1,1) width 24: "bar" text run at (1,1) width 24: "bar"
text run at (24,1) width 2: " "
selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body
selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body
...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600 ...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600
LayoutTableSection {TBODY} at (0,0) size 29x50 LayoutTableSection {TBODY} at (0,0) size 29x50
LayoutTableRow {TR} at (0,2) size 29x22 LayoutTableRow {TR} at (0,2) size 29x22
LayoutTableCell {TD} at (2,2) size 25x22 [r=0 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,2) size 25x22 [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (1,1) size 23x20 LayoutText {#text} at (1,1) size 24x20
text run at (1,1) width 23: "foo" text run at (1,1) width 23: "foo"
text run at (23,1) width 2: " "
LayoutTableRow {TR} at (0,26) size 29x22 LayoutTableRow {TR} at (0,26) size 29x22
LayoutTableCell {TD} at (2,26) size 25x22 [r=1 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,26) size 25x22 [r=1 c=0 rs=1 cs=1]
LayoutText {#text} at (1,1) size 23x20 LayoutText {#text} at (1,1) size 24x20
text run at (1,1) width 23: "bar" text run at (1,1) width 23: "bar"
text run at (23,1) width 2: " "
selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body
selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body
...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600 ...@@ -16,11 +16,13 @@ layer at (0,0) size 800x600
LayoutTableSection {TBODY} at (0,0) size 30x50 LayoutTableSection {TBODY} at (0,0) size 30x50
LayoutTableRow {TR} at (0,2) size 30x22 LayoutTableRow {TR} at (0,2) size 30x22
LayoutTableCell {TD} at (2,2) size 26x22 [r=0 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,2) size 26x22 [r=0 c=0 rs=1 cs=1]
LayoutText {#text} at (1,1) size 24x19 LayoutText {#text} at (1,1) size 25x19
text run at (1,1) width 24: "foo" text run at (1,1) width 24: "foo"
text run at (25,1) width 1: " "
LayoutTableRow {TR} at (0,26) size 30x22 LayoutTableRow {TR} at (0,26) size 30x22
LayoutTableCell {TD} at (2,26) size 26x22 [r=1 c=0 rs=1 cs=1] LayoutTableCell {TD} at (2,26) size 26x22 [r=1 c=0 rs=1 cs=1]
LayoutText {#text} at (2,1) size 22x19 LayoutText {#text} at (2,1) size 24x19
text run at (2,1) width 22: "bar" text run at (2,1) width 22: "bar"
text run at (23,1) width 3: " "
selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body selection start: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of body
selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of body
...@@ -1431,7 +1431,7 @@ inline bool BreakingContext::TrailingSpaceExceedsAvailableWidth( ...@@ -1431,7 +1431,7 @@ inline bool BreakingContext::TrailingSpaceExceedsAvailableWidth(
// If we break only after white-space, consider the current character // If we break only after white-space, consider the current character
// as candidate width for this line. // as candidate width for this line.
if (width_.FitsOnLine() && current_character_is_space_ && if (width_.FitsOnLine() && current_character_is_space_ &&
current_style_->BreakOnlyAfterWhiteSpace() && !can_break_mid_word) { current_style_->BreakOnlyAfterWhiteSpace()) {
float char_width = TextWidth(layout_text, current_.Offset(), 1, font, float char_width = TextWidth(layout_text, current_.Offset(), 1, font,
width_.CurrentWidth(), collapse_white_space_, width_.CurrentWidth(), collapse_white_space_,
&word_measurement.fallback_fonts, &word_measurement.fallback_fonts,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment