web-platform-tests / interop

web-platform-tests Interop project
https://wpt.fyi/interop
280 stars 28 forks source link

text-wrap: pretty #562

Closed foolip closed 7 months ago

foolip commented 11 months ago

Description

text-wrap: pretty biases for better layout over speed, and is expected to consider multiple lines, when making break decisions. Otherwise equivalent to text-wrap:auto.

Specification

https://drafts.csswg.org/css-text-4/#valdef-text-wrap-style-pretty

Open Issues

https://github.com/w3c/csswg-drafts/issues?q=is%3Aissue+is%3Aopen+text-wrap+pretty

Tests

https://wpt.fyi/results/css/css-text/parsing/text-wrap-valid.html?label=master&label=experimental&aligned

Note that these are parsing tests only, there are no reftests for the line breaking effects of text-wrap: pretty.

Current Implementations

Standards Positions

None found when searching the repos.

Browser bug reports

https://bugzilla.mozilla.org/show_bug.cgi?id=630181

Safari Technology Preview has a disabled-by-default feature flag for "CSS text-wrap: balance stable pretty" but I couldn't find a WebKit bug for text-wrap: pretty. It might be implemented behind that flag, I don't know.

Developer discussions

No response

Polls & Surveys

No response

Existing Usage

https://chromestatus.com/metrics/feature/timeline/popularity/4594

Workarounds

https://github.com/robertknight/tex-linebreak is a JS implementation of the Knuth-Plass algorithm (119 stars)

Accessibility Impact

No response

Privacy Impact

No response

Other

Blink's Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/rwBWqqOB_ag/m/ea9dZXvaDQAJ

emilio commented 10 months ago

How testable is this?

kojiishi commented 10 months ago

@emilio Good question. I think this is testable (or not testable) as much as hyphens: auto or word-break: auto-phrase. For hyphens, we adjusted wpt tests when we found Gecko uses en-us dictionary for en-uk for a good reason. For auto-phrase, we agreed to update tests if WebKit's implementation resulted differently but still looks reasonable.

For pretty, when this is implemented in other browsers, we can find common behaviors and adjust tests to cover them. Until then, tests should be parser tests, and what existing implementations think it's reasonable (but as above, the set may be adjusted as more implementations come.)

Does this work?

fantasai commented 10 months ago

Speaking as the editor, I don't think it makes sense to include text-wrap: pretty in Interop. Aside from the parsing tests, there's very little that you can check conformance for. hyphens: auto and word-break: auto-phrase have canonical examples that you can test. E.g. for hyphens: auto you can force breaking in a narrow paragraph, and see if various words from various languages break in the correct places (there are definite correct places to check for). And for word-break: auto-phrase you can do something similar as well.

But text-wrap: pretty has basically no specific behavioral conformance requirements. And this is intentional in the spec, as it's meant to give the UA leeway to balance as many different concerns as it wants to and to allow differences in implementations. It's possible that at some point down the line we'll be able to put some more guidance in the spec as to what's expected, and get UAs to align on some basic and extremely exaggerated testcases, but... I don't think we're there yet.

I just don't think it's a good focus area for Interop in general, and definitely not for 2024.

nairnandu commented 7 months ago

Thank you for proposing text-wrap: pretty for inclusion in Interop 2024.

We wanted to let you know that this proposal was not selected to be part of Interop 2024. This is because we got many more proposals than we could include in this year's project. Note that individual vendors may nevertheless choose to advance work in this area during the forthcoming year. We would welcome this proposal being resubmitted again next year, if necessary.

For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2024!

Posted on behalf of the Interop team.