Title: [272084] trunk
Revision
272084
Author
mmaxfi...@apple.com
Date
2021-01-29 16:18:26 -0800 (Fri, 29 Jan 2021)

Log Message

WebKit doesn't automatically right-align Adlam
https://bugs.webkit.org/show_bug.cgi?id=220885

Reviewed by Alex Christensen.

Source/WTF:

If we want to iterate across code points, we have to actually
iterate across code points instead of iterating across code units.

Test: fast/text/adlam-dir-auto.html

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::defaultWritingDirection):

LayoutTests:

* fast/text/adlam-dir-auto-expected.html: Added.
* fast/text/adlam-dir-auto.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272083 => 272084)


--- trunk/LayoutTests/ChangeLog	2021-01-29 23:32:50 UTC (rev 272083)
+++ trunk/LayoutTests/ChangeLog	2021-01-30 00:18:26 UTC (rev 272084)
@@ -1,5 +1,15 @@
 2021-01-29  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        WebKit doesn't automatically right-align Adlam
+        https://bugs.webkit.org/show_bug.cgi?id=220885
+
+        Reviewed by Alex Christensen.
+
+        * fast/text/adlam-dir-auto-expected.html: Added.
+        * fast/text/adlam-dir-auto.html: Added.
+
+2021-01-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         font-stretch is not applied to system-ui
         https://bugs.webkit.org/show_bug.cgi?id=221103
         <rdar://problem/73719139>

Added: trunk/LayoutTests/fast/text/adlam-dir-auto-expected.html (0 => 272084)


--- trunk/LayoutTests/fast/text/adlam-dir-auto-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/adlam-dir-auto-expected.html	2021-01-30 00:18:26 UTC (rev 272084)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that Adlam text is right-aligned when dir=auto. The test passes if the Adlam text is on the right side of the page.
+<div dir="rtl" style="font-size: 48px;">&#x1E935;</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/adlam-dir-auto.html (0 => 272084)


--- trunk/LayoutTests/fast/text/adlam-dir-auto.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/adlam-dir-auto.html	2021-01-30 00:18:26 UTC (rev 272084)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that Adlam text is right-aligned when dir=auto. The test passes if the Adlam text is on the right side of the page.
+<div dir="auto" style="font-size: 48px;">&#x1E935;</div>
+</body>
+</html>

Modified: trunk/Source/WTF/ChangeLog (272083 => 272084)


--- trunk/Source/WTF/ChangeLog	2021-01-29 23:32:50 UTC (rev 272083)
+++ trunk/Source/WTF/ChangeLog	2021-01-30 00:18:26 UTC (rev 272084)
@@ -1,5 +1,20 @@
 2021-01-29  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        WebKit doesn't automatically right-align Adlam
+        https://bugs.webkit.org/show_bug.cgi?id=220885
+
+        Reviewed by Alex Christensen.
+
+        If we want to iterate across code points, we have to actually
+        iterate across code points instead of iterating across code units.
+
+        Test: fast/text/adlam-dir-auto.html
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::defaultWritingDirection):
+
+2021-01-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         font-stretch is not applied to system-ui
         https://bugs.webkit.org/show_bug.cgi?id=221103
         <rdar://problem/73719139>

Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (272083 => 272084)


--- trunk/Source/WTF/wtf/text/StringImpl.cpp	2021-01-29 23:32:50 UTC (rev 272083)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp	2021-01-30 00:18:26 UTC (rev 272084)
@@ -1671,8 +1671,8 @@
 
 UCharDirection StringImpl::defaultWritingDirection(bool* hasStrongDirectionality)
 {
-    for (unsigned i = 0; i < m_length; ++i) {
-        auto charDirection = u_charDirection(is8Bit() ? m_data8[i] : m_data16[i]);
+    for (auto codePoint : StringView(this).codePoints()) {
+        auto charDirection = u_charDirection(codePoint);
         if (charDirection == U_LEFT_TO_RIGHT) {
             if (hasStrongDirectionality)
                 *hasStrongDirectionality = true;
@@ -1684,6 +1684,7 @@
             return U_RIGHT_TO_LEFT;
         }
     }
+
     if (hasStrongDirectionality)
         *hasStrongDirectionality = false;
     return U_LEFT_TO_RIGHT;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to