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

Bidi whitespace collapse was preventing reftest match #21663

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

faceless2
Copy link
Contributor

The whitespace in bidi-003 and bidi-004 were out by a single whitespace character due to collapsing. No browsers were rendering these correctly - it's possible the tests are right and everything else was wrong, but I think in this case the tests were the ones that were wrong.

@frivoal
Copy link
Contributor

frivoal commented Feb 10, 2020

I ran into that a little while back as well, and after checking, bidi-003 is actually right, and browsers are wrong. This was already discussed in #5460 and reconfirmed by the WG not too long ago in w3c/csswg-drafts#2233. TL;DR: per 4.1.1, space collapsing is supposed to ignore bidi formatting characters.

For bidi-004, as far as I remember, it's the first time I look at it, so I'm a little less confident. But here's my logic:

I think line 1 was actually correct:

  • for the same reasons as bidi-003, a sequence of spaces with bidi control chars in the middle still collapses, so there isn't an extra space to move to the end of line 1, and the layout should be the same as if laying out ` pppp pppX ppXp ‮ppXp XXpp
  • even if there was a space to move to the end of the line, that space should not remain: the white space property is normal, so the space is collapsible, and per 4.1.2 bullet 3, it should be removed

For line 3, I don't think your fix is right, but I think a different one might be needed:

  • for the same reasons as bidi-003, a sequence of spaces with bidi control chars in the middle still collapses, so there isn't an extra space to move to the beginning of line 3, and the layout should be the same as if laying out ppXX XXpX pXpX ‬XXpX XXXp
  • However, This means that:
    • The space immediately after pXpX gets bidi reordered to the beginning of the line, where it gets removed due to 4.1.2 bullet 1. If we want to be extra clear, we might want to clarify the spec and add the equivalent of the second paragraph of bullet 3 to bullet 1.
    • The space immediately before XXpX was collapsed (due to 4.1.1) with the one after pXpX (the one we just discussed), so it too is gone
    • The space before ppXX should already have been handled as part of line 2, so it isn't on line 3 and doesn't get a chance to be reordered to the middle of the line
    • Therefore, the manually computed reference rending of line 3 should not have any space at the boundary between the RTL and LTR parts, nor at the beginning of the line, and should look like this: XpXp XpXX XXppXXpX XXXp

That said, all this is pretty intricate, so I wouldn't mind a second (or third) opinion… @fantasai @jfkthame @kojiishi

@svgeesus
Copy link
Contributor

svgeesus commented Apr 5, 2022

Removing myself as reviewer. It seems @frivoal is asking for changes.

@svgeesus svgeesus removed their request for review April 5, 2022 13:06
@faceless2
Copy link
Contributor Author

Forgot about this one sorry. On holiday will revisit when I'm back in a few weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants