Skip to content

[css-text] Reconsider the resolution on #855 #5410

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

Closed
emilio opened this issue Aug 8, 2020 · 9 comments
Closed

[css-text] Reconsider the resolution on #855 #5410

emilio opened this issue Aug 8, 2020 · 9 comments
Assignees
Labels

Comments

@emilio
Copy link
Collaborator

emilio commented Aug 8, 2020

In #855 it was resolved that CR gets treated as any other control char, but looking at the history, we had to make it render invisible in https://bugzilla.mozilla.org/show_bug.cgi?id=941940 for compat reasons.

It seems Gecko and WebKit render it invisible, and Blink just treats lone CRs as an space. Probably both behaviors are acceptable compat-wise, but that doesn't match the spec.

cc @jfkthame @litherum @kojiishi

@emilio emilio added the css-text-3 Current Work label Aug 9, 2020
@kojiishi
Copy link
Contributor

kojiishi commented Aug 9, 2020

Blink just treats lone CRs as an space

Can you tell me how you tested this? I debugged:
https://github.com/web-platform-tests/wpt/blob/master/css/css-text/white-space/control-chars-00D.html
and we don't seem to render anything.

@emilio
Copy link
Collaborator Author

emilio commented Aug 9, 2020

@kojiishi this test-case:

<!doctype html>
<p>A&#013;B</p>

Renders a space between A and B in Blink, afaict, while WebKit and Gecko just render AB.

Edit: Link for reference, as that's not easy to turn to a data URI.

@fantasai
Copy link
Collaborator

I don't care what we decide here, but if we resolve on making it “invisible” please make sure it's defined exactly what that means.

@kojiishi
Copy link
Contributor

this test-case:

Thank you, confirmed that LayoutNG handles lone CR as a collapsible space, in this CL which refers to CSS Text but I can't find the definition any longer. CSS2 has it, so maybe it was removed after we implemented LayoutNG?

The control-chars-00D.html test doesn't reveal this because it's a collapsible space, and it is collapsed in the test.

I think we can try to change this. Can you and @litherum tell me how you handle it?

@frivoal
Copy link
Collaborator

frivoal commented Sep 3, 2020

Sounds that we have a few options:

  1. treat it as a control character and make it visible, as a hex box or something like this. (what the spec says)
  2. treat as a collapsible space
  3. treat as invisible, which can have variants
    a. treat it as if it was nothing there (no impact shaping, no wrapping opportunity)
    b. treat as if there was something left behind that breaks shaping and introduces a wrapping opportunity
    c. treat as if there was something left behind that preserves shaping but introduces a wrapping opportunity
        i. when the line is wrapped, shaping is preserved across the line break
        ii. when the line is wrapped, shaping is not preserved across the line break
    d. treat as if there was something left behind that breaks shaping but does not introduces a wrapping opportunity

As far as I can tell using https://lists.w3.org/Archives/Public/www-archive/2020Sep/att-0001/CR.html:

  • Firefox 80 and Safari 14 do 3.b.
  • Chrome 84 does 2. when white-space is normal, but 3.d. when white-space is pre-wrap
  • Edge 18 (non-chromium) does 3.c.ii.
  • Prince 13.4 does 3.d.
  • Vivliostyle 2.1.1 does 3.c.ii.

All in all, it's all over the place, but nobody does what the spec says. I don't think it's terribly important what behavior we pick, but it would be good to converge, and to spec what we do. Personally, I find Chrome's behavior weird, so wouldn't recommend that. Safari+Firefox's 3.b. seems decently sensible, and it is sufficiently web exposed that I don't think there's a big compat risk, so I'd suggest aligning with that.


PS: As 3.b might look like the behavior you'd get by putting a zero width space there when using an arabic font that doesn't have zwsp (and therefore falls back to a different font for that glyph, and therefore breaks shaping even tough shaping is supposed to be preserved through zwsp, see #3861), I've checked for that specifically in Firefox and Safari. Even on Fonts where Safari would correctly do Shaping across a zwsp, it still breaks shaping accross the "invisible" CR. As far as I can tell, Firefox never shapes across a zwsp, even though that's not compliant with Unicode.

@frivoal
Copy link
Collaborator

frivoal commented Sep 3, 2020

cc @jfkthame @litherum @kojiishi @emilio @fantasai (see previous comment)

@frivoal frivoal self-assigned this Sep 3, 2020
@fantasai
Copy link
Collaborator

fantasai commented Sep 3, 2020

Personally, I suspect treating it as a visible space is easiest if we want to get interop. There are just way too many ways to make something 'invisible'.

@frivoal
Copy link
Collaborator

frivoal commented Sep 10, 2020

Agenda+ to propose resolving onto making lone CRs be treated as visible spaces, based on the results of #5410 (comment) and subsequent comments.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-text] Reconsider the resolution on #855, and agreed to the following:

  • RESOLVED: Treat CR as an ordinary space
The full IRC log of that discussion <dael> Topic: [css-text] Reconsider the resolution on #855
<oriol> emilio: Logical values computing as-is was resolved in https://github.com//issues/2821#issuecomment-415092595
<dael> github: https://github.com//issues/5410
<emilio> oriol: great, just wanted to make sure that there was a resolution on that, thanks!
<emilio> oriol: a bit odd that it behaves differently from logical props but maybe not too much :)
<fantasai> emilio, it would have been necessary for text-align to actually work as expected :)
<dael> florian: We resolved control characters are displayed visually. As part of that the CR character, carrage return, is supposed to be the same. Most of the time you can't notice b/c handled by HTML parser. But if you inject it you should see it. No one does it.
<emilio> fantasai: fair enough :)
<dael> florian: Mostly can't see, Chrome sometimes replaces with ordinary space. Did testing to see what kind of invisible people do. It's all over the place. Everyone does a weird varient
<dael> florian: Suggestion is treat as ordinary space. Depending on whitespace property it may be collapsable. Partially matches Chrome. When whitespace is normal Chrome does that. When whitespace is not normal Chrome does different things.
<dael> florian: Suggestion is from fantasai and I think it's good. This is kind of an error case
<dael> emilio: filed it b/c wikipedia was complaining. Not sure about nobody uses it
<dael> florian: Do they want it to do something?
<dael> emilio: No, Gecko was doing something more weird. I fixed that more weird but when I looked how to handle it was all over the place as you said.
<dael> florian: So I think you for the opportunity to write fun tests. Now that I've had my fun how about we change to a space and move on
<dael> s/think/thank
<dael> emilio: Okay with that but a change for all engines
<dael> florian: Yeah. In main case it's what Chrome does
<dael> chrishtr: #2 on yoru option list always?
<dael> florian: Yes. It behaves as any space on whitespace:pre
<dael> chrishtr: So Chrome just needs whitespace:pre to change?
<fantasai> proposed resolution is "treat as U+0020"
<dael> florian: Yeah, maybe other non-normal. I don't recall.
<dael> smfr: Makes me a little nervious b/c they're more common in mac.
<dael> florian: Yeah. Probably not shoing because actual carriage return is handled. It's an explicit escape
<dael> smfr: Worried files converted to user entities.
<dael> florian: Could. but what happens now is everybody is different
<dael> Rossen_: I see soft agreement by koji on issue. Sounds like emilio is fine for Gecko to try.
<dael> smfr: I won't object. I think we'd have to try it and see what happens
<dael> Rossen_: Let's try and resolve. If we see a lot more information saying this is causing crazy breaks we'll discuss again
<dael> florian: I think behavior in safari and FF isn't crazy but i could find so many ways to make something visual that this seemed a lot simpler
<dael> florian: Prop: Treat CR as an ordinary space
<dael> florian: I'll be more exact in spec
<dael> Rossen_: Objections?
<dael> RESOLVED: Treat CR as an ordinary space

frivoal added a commit to frivoal/wpt that referenced this issue Sep 29, 2020
frivoal added a commit to web-platform-tests/wpt that referenced this issue Sep 29, 2020
@frivoal frivoal added Tested Memory aid - issue has WPT tests and removed Needs Testcase (WPT) labels Sep 29, 2020
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 3, 2020
…, a=testonly

Automatic update from web-platform-tests
Test case for the css handling of U+000D (#25830)

Relates to w3c/csswg-drafts#5410
--

wpt-commits: 6730dabbcc826e8ccbd6a9ee43d67c65e8626f29
wpt-pr: 25830
ambroff pushed a commit to ambroff/gecko that referenced this issue Nov 4, 2020
…, a=testonly

Automatic update from web-platform-tests
Test case for the css handling of U+000D (#25830)

Relates to w3c/csswg-drafts#5410
--

wpt-commits: 6730dabbcc826e8ccbd6a9ee43d67c65e8626f29
wpt-pr: 25830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants