-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trailing spaces that hang don't contribute to intrinsic size
During the min-content contribution we should use the non-hangable run end, unless the white-space property is set to 'break-spaces'. Additionally, we should ensure that hanging trailing spaces doesn't account for the NGItemResult's inline size. Bug: 972992, 1071928 Change-Id: Ife1b3212164b1494e822fa141cd44896e6359ef9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418678 Reviewed-by: Koji Ishii <[email protected]> Commit-Queue: Javier Fernandez <[email protected]> Cr-Commit-Position: refs/heads/master@{#879781}
- Loading branch information
1 parent
bee9f7d
commit a03d7c3
Showing
14 changed files
with
148 additions
and
9 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
css/css-text/overflow-wrap/overflow-wrap-min-content-size-009.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title> | ||
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]"> | ||
<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/#overflow-wrap-property"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap"> | ||
<link rel="match" href="reference/overflow-wrap-min-content-size-009-ref.html"> | ||
<meta name="assert" content="Using 'overflow-wrap:anywhere' doesn't prevent the tabs sequence to hang (inconditionally) , honoring 'white-space: pre-wrap' hence glyphs **are not** considered when calculating min-content intrinsic sizes."> | ||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | ||
<style> | ||
div { | ||
font: 20px/1 Ahem; | ||
} | ||
.test { | ||
color: green; | ||
background: red; | ||
z-index: -1; | ||
|
||
width: min-content; | ||
white-space: pre-wrap; | ||
overflow-wrap: anywhere | ||
} | ||
.ref { | ||
position: absolute; | ||
background: green; | ||
color: transparent; | ||
} | ||
</style> | ||
|
||
<p>Test passes if there is a green box below and no red. | ||
<div class="ref"><br><br>X</div> | ||
<div class="test">		<span>XX</span></div> |
16 changes: 16 additions & 0 deletions
16
css/css-text/overflow-wrap/reference/overflow-wrap-min-content-size-009-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test reference</title> | ||
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]"> | ||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | ||
<style> | ||
div { | ||
font: 20px/1 Ahem; | ||
position: absolute; | ||
background: green; | ||
color: transparent; | ||
} | ||
</style> | ||
|
||
<p>Test passes if there is a green box below and no red. | ||
<div>X<br>X<br>X</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
css/css-text/white-space/white-space-intrinsic-size-005.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title> | ||
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> | ||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html"> | ||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html"> | ||
<meta name="assert" content="Preserved spaces at the end of the line unconditioanlly hang, hence they do not affect the intrinsic min-content size."> | ||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | ||
<style> | ||
div { | ||
font: 25px/1 Ahem; | ||
color: green; | ||
background: red; | ||
|
||
width: min-content; | ||
white-space: pre-wrap; | ||
} | ||
span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/ | ||
</style> | ||
|
||
<p>This test passes if there is a green square and no red. | ||
|
||
<div>XX<span> </span>XX</div> |
23 changes: 23 additions & 0 deletions
23
css/css-text/white-space/white-space-intrinsic-size-006.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title> | ||
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> | ||
<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html"> | ||
<meta name="assert" content="Preserved spaces unconditionally hang if they might overflow otherwise, hence they do not affect the intrinsic min-content size."> | ||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | ||
<style> | ||
div { | ||
font: 25px/1 Ahem; | ||
color: green; | ||
background: red; | ||
|
||
width: min-content; | ||
white-space: pre-wrap; | ||
} | ||
</style> | ||
|
||
<p>This test passes if there is a green square and no red. | ||
|
||
<div>XX XX</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title> | ||
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]"> | ||
<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/#word-break-property"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space"> | ||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap"> | ||
<link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-009-ref.html"> | ||
<meta name="assert" content="word-break: break-word should behave as overflow-wrap: anywhere, so breaking opportunities **are not** considered when calculating min-content intrinsic sizes."> | ||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | ||
<style> | ||
div { | ||
font: 20px/1 Ahem; | ||
} | ||
.test { | ||
color: green; | ||
background: red; | ||
z-index: -1; | ||
|
||
width: min-content; | ||
white-space: pre-wrap; | ||
word-break: break-word; | ||
} | ||
.ref { | ||
position: absolute; | ||
background: green; | ||
color: transparent; | ||
} | ||
</style> | ||
|
||
<p>Test passes if there is a green box below and no red. | ||
<div class="ref"><br><br>X</div> | ||
<div class="test">		<span>XX</span></div> |