RESOLVED FIXED 220885
WebKit doesn't automatically right-align Adlam
https://bugs.webkit.org/show_bug.cgi?id=220885
Summary WebKit doesn't automatically right-align Adlam
Fuqiao Xue
Reported 2021-01-22 19:22:09 PST
Adlam text displayed in a block element with 'dir' set to 'auto' should be automatically right-aligned, unless the base direction is set to LTR. See https://github.com/w3c/afrlreq/issues/13 for more info.
Attachments
WebKit doesn't automatically right-align Adlam (2.35 KB, text/html)
2021-01-28 19:09 PST, Fuqiao Xue
no flags
Patch (3.65 KB, patch)
2021-01-29 15:48 PST, Myles C. Maxfield
no flags
Smoley
Comment 1 2021-01-27 17:47:48 PST
Can you please attach a test html file as well? Thanks
Radar WebKit Bug Importer
Comment 2 2021-01-27 17:47:57 PST
Smoley
Comment 3 2021-01-27 17:51:34 PST
Actually it looks like this page may work: http://adlamtesting.appspot.com
Smoley
Comment 4 2021-01-27 17:54:09 PST
On second thought that page is showing it in a <textarea> but at least it provides some test text.
Fuqiao Xue
Comment 5 2021-01-28 19:09:25 PST
Created attachment 418695 [details] WebKit doesn't automatically right-align Adlam Here's a test HTML file.
Myles C. Maxfield
Comment 6 2021-01-29 15:20:36 PST
The content has dir="auto"
Myles C. Maxfield
Comment 7 2021-01-29 15:22:14 PST
If the text is moved out from the intermediate <p> element, it becomes right aligned. Somehow the <p> element is causing the problem.
Myles C. Maxfield
Comment 8 2021-01-29 15:23:32 PST
(In reply to Myles C. Maxfield from comment #7) > If the text is moved out from the intermediate <p> element, it becomes right > aligned. Somehow the <p> element is causing the problem. Whoops, this is only true if you insert some RTL text like Arabic at the beginning of the string.
Myles C. Maxfield
Comment 9 2021-01-29 15:25:24 PST
(In reply to Myles C. Maxfield from comment #8) > (In reply to Myles C. Maxfield from comment #7) > > If the text is moved out from the intermediate <p> element, it becomes right > > aligned. Somehow the <p> element is causing the problem. > > Whoops, this is only true if you insert some RTL text like Arabic at the > beginning of the string. Yeah, ignore what I said about the <p> element. The <p> element has nothing to do with this.
Myles C. Maxfield
Comment 10 2021-01-29 15:32:10 PST
The first place to check would be StringImpl::defaultWritingDirection()
Myles C. Maxfield
Comment 11 2021-01-29 15:33:48 PST
oh hahahaha we're terrible auto charDirection = u_charDirection(is8Bit() ? m_data8[i] : m_data16[i]); super broken
Myles C. Maxfield
Comment 12 2021-01-29 15:48:48 PST
EWS
Comment 13 2021-01-29 16:18:32 PST
Committed r272084: <https://trac.webkit.org/changeset/272084> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418778 [details].
Darin Adler
Comment 14 2021-01-29 17:04:30 PST
Comment on attachment 418778 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418778&action=review > Source/WTF/wtf/text/StringImpl.cpp:1672 > UCharDirection StringImpl::defaultWritingDirection(bool* hasStrongDirectionality) Some day to clean up: Feels to me like we should move this function to StringView or make it a non-member function that takes a StringView, in some place where we have code about writing direction and bidirectional algorithms. And give it a better interface with return values instead of an out argument. And add a fast path so we aren’t calling u_charDirection in common cases.
Darin Adler
Comment 15 2021-01-29 17:04:30 PST
Comment on attachment 418778 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418778&action=review > Source/WTF/wtf/text/StringImpl.cpp:1672 > UCharDirection StringImpl::defaultWritingDirection(bool* hasStrongDirectionality) Some day to clean up: Feels to me like we should move this function to StringView or make it a non-member function that takes a StringView, in some place where we have code about writing direction and bidirectional algorithms. And give it a better interface with return values instead of an out argument. And add a fast path so we aren’t calling u_charDirection in common cases.
Myles C. Maxfield
Comment 16 2021-01-29 17:50:00 PST
(In reply to Darin Adler from comment #15) > Comment on attachment 418778 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418778&action=review > > > Source/WTF/wtf/text/StringImpl.cpp:1672 > > UCharDirection StringImpl::defaultWritingDirection(bool* hasStrongDirectionality) > > Some day to clean up: Feels to me like we should move this function to > StringView or make it a non-member function that takes a StringView, in some > place where we have code about writing direction and bidirectional > algorithms. And give it a better interface with return values instead of an > out argument. And add a fast path so we aren’t calling u_charDirection in > common cases. Yeah, Alex and I had a conversation about the direction to move this class. Sounds like we all agree :)
r12a
Comment 17 2022-02-03 04:28:28 PST
Thanks for fixing this.
Note You need to log in before you can comment on or make changes to this bug.