-
Notifications
You must be signed in to change notification settings - Fork 6k
[Web][HTML] Add mirrored characters support for RTL languages #39162
[Web][HTML] Add mirrored characters support for RTL languages #39162
Conversation
692b82f
to
4dd299d
Compare
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good to me. Thanks for contributing this fix!
There are some golden triage issues (bug: https://bugs.chromium.org/p/skia/issues/detail?id=13907). Let's wait a bit to see what the Skia team says. I'll triage them later.
Great! I was trying to figure out if my PR broke those golden and noticed all golden add this message 'Computing closest positive and negative image. Check back later.'. It might be related to the Tree being currently broken and some golden are stuck? |
It's not related to tree status. This is a bug in the Gold system where some images lose their triage status after a while. |
LGTM |
…119859) * 510ecfa93 Don't rely on timings for dimension_provider unit test. (flutter/engine#39343) * b1ccae745 Roll Skia from 60242c4ea6a7 to c2d81db3ef41 (5 revisions) (flutter/engine#39344) * 616ecd8be [Web][HTML] Add mirrored characters support for RTL languages (flutter/engine#39162)
Description
Handling RTL text in the HTML renderer was introduced by #26811.
It seems that there is a missing piece related to mirrored characters (see https://www.w3.org/International/articles/inline-bidi-markup/uba-basics#mirroring).
This PR adds this feature by relying on the HTML “dir” attribute.
Before/after
Here is a simplified sample (compared to the one in flutter/flutter#108431) to illustrate the issue:
Code sample
After (using HTML Renderer):

Implementation choice
@mdebbar
I was not able to figure out if there is already some web_ui code to handle mirrored characters.
So the solution I choosed is to rely on the HTML dir attribute and apply it to “flt-span” which is created for each text fragment (adding it only when a text fragment direction is RTL).
Related Issue
Fixes: flutter/flutter#108431
Tests
Adds 1 test.