Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-text] Clarification about hanging spaces and max-content size #4359

Closed
javifernandez opened this issue Sep 20, 2019 · 4 comments
Closed
Assignees
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-text-3 Current Work Tested Memory aid - issue has WPT tests

Comments

@javifernandez
Copy link
Contributor

The CSS WG resolved recently (issue #3440) that preserved spaces by pre-wrap, if not followed by a forced break, must hang:

https://drafts.csswg.org/css-text-3/#white-space-phase-2

If white-space is set to pre-wrap, the UA must (unconditionally) hang this sequence, unless the sequence is followed by a forced line break, in which case it must conditionally hang the sequence is instead.

The above mentioned resolution included a clarification of the concept of hung vs conditionally hung glyph, which regarding this issue implies the following:

https://drafts.csswg.org/css-text-3/#hang

The hanging glyph is also not taken into account when computing intrinsic sizes (min-content size and max-content size), and any sizes derived thereof.

So, I wonder whether the following case is covered by the statements described before:

<div style="font: 20px/1 Ahem; color: green; background: red; width: max-content; white-space: pre-wrap">XX&#x0020;</div>

I'm not sure if the concept if "hanging glyph" implies that such glyph would otherwise overflow; at least I don't find that in the definition if hung descried in the link above. This is perhaps the first clarification I'd ask (if that's the case maybe we can add something in the spec about it)

Following what the White Space Processing Phase II states, the trailing space sequence must hang, hence it should not account for the box's max-content size. So, I'd expect no red color will be shown when rendering the example. However, both Firefox and Chrome renders the mentioned example as follows:

hang-and-maxContent

@javifernandez javifernandez added the css-text-3 Current Work label Sep 20, 2019
@javifernandez javifernandez changed the title [css-text] Clarification about hunging spaces and max-content size [css-text] Clarification about hanging spaces and max-content size Sep 20, 2019
@frivoal
Copy link
Collaborator

frivoal commented Sep 24, 2019

In this case, the &#x20; is at the end of the div, so it is before a forced like break (https://drafts.csswg.org/css-text-3/#forced-line-break). In that case, as you quoted, “it must conditionally hang the sequence is instead”.

Conditionally hanging is at https://drafts.csswg.org/css-text-3/#conditionally-hang, two paragraphs after https://drafts.csswg.org/css-text-3/#hang (which is the one you quoted). It says:

Glyphs that conditionally hang are not taken into account when computing min-content sizes and any sizes derived thereof, but they are taken into account for max-content sizes and any sizes derived thereof.

So, in this case, the space is taken into account for max-content, the size of the div is 3 characters, and you see red.

@frivoal frivoal added Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. Commenter Response Pending Needs Testcase (WPT) labels Sep 24, 2019
@frivoal
Copy link
Collaborator

frivoal commented Sep 24, 2019

btw, this is a nice test case, thanks.

I still need to update the tests in wpt to match the resolution of #3440

@javifernandez
Copy link
Contributor Author

In this case, the is at the end of the div, so it is before a forced like break

Wow, I didn't realize about the end line being a forced break. With that in mind, seeing red makes sense and it's correctly defined in the spec.

Give me some time to think on other possible cases before closing the issue, but so far, everything looks sensible.

frivoal added a commit to web-platform-tests/wpt that referenced this issue Sep 25, 2019
@frivoal frivoal added Tested Memory aid - issue has WPT tests and removed Needs Testcase (WPT) labels Sep 25, 2019
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 30, 2019
Automatic update from web-platform-tests
[css-text] Fix tests to match w3c/csswg-drafts#3440

--
[css-text] Add test based on w3c/csswg-drafts#4359

--
[css-text] Add tests based on spec examples

--

wpt-commits: 65da2c8a6c6c4f93cae73034a2cbca9bde7413e0, 63d4c5cecaa8a5ae1f5b206e009f1c8e63c06eca, a6d00e0865b86f9440f0e079a7324a8eefa752ad
wpt-pr: 19286
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Sep 30, 2019
Automatic update from web-platform-tests
[css-text] Fix tests to match w3c/csswg-drafts#3440

--
[css-text] Add test based on w3c/csswg-drafts#4359

--
[css-text] Add tests based on spec examples

--

wpt-commits: 65da2c8a6c6c4f93cae73034a2cbca9bde7413e0, 63d4c5cecaa8a5ae1f5b206e009f1c8e63c06eca, a6d00e0865b86f9440f0e079a7324a8eefa752ad
wpt-pr: 19286
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
Automatic update from web-platform-tests
[css-text] Fix tests to match w3c/csswg-drafts#3440

--
[css-text] Add test based on w3c/csswg-drafts#4359

--
[css-text] Add tests based on spec examples

--

wpt-commits: 65da2c8a6c6c4f93cae73034a2cbca9bde7413e0, 63d4c5cecaa8a5ae1f5b206e009f1c8e63c06eca, a6d00e0865b86f9440f0e079a7324a8eefa752ad
wpt-pr: 19286

UltraBlame original commit: 847735988761b61a9301709d6588fbfab52f2358
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
Automatic update from web-platform-tests
[css-text] Fix tests to match w3c/csswg-drafts#3440

--
[css-text] Add test based on w3c/csswg-drafts#4359

--
[css-text] Add tests based on spec examples

--

wpt-commits: 65da2c8a6c6c4f93cae73034a2cbca9bde7413e0, 63d4c5cecaa8a5ae1f5b206e009f1c8e63c06eca, a6d00e0865b86f9440f0e079a7324a8eefa752ad
wpt-pr: 19286

UltraBlame original commit: 847735988761b61a9301709d6588fbfab52f2358
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 5, 2019
Automatic update from web-platform-tests
[css-text] Fix tests to match w3c/csswg-drafts#3440

--
[css-text] Add test based on w3c/csswg-drafts#4359

--
[css-text] Add tests based on spec examples

--

wpt-commits: 65da2c8a6c6c4f93cae73034a2cbca9bde7413e0, 63d4c5cecaa8a5ae1f5b206e009f1c8e63c06eca, a6d00e0865b86f9440f0e079a7324a8eefa752ad
wpt-pr: 19286

UltraBlame original commit: 847735988761b61a9301709d6588fbfab52f2358
@javifernandez
Copy link
Contributor Author

Ok, everything is clear on my side. Thanks for the feedback.

@javifernandez javifernandez added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-text-3 Current Work Tested Memory aid - issue has WPT tests
Projects
None yet
Development

No branches or pull requests

2 participants