Title: [290734] trunk
Revision
290734
Author
[email protected]
Date
2022-03-02 09:09:34 -0800 (Wed, 02 Mar 2022)

Log Message

[RTL] Image alt text has incorrect bidi reordering
https://bugs.webkit.org/show_bug.cgi?id=237366
<rdar://problem/89687229>

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/images/alt-text-with-right-to-left-inline-direction-reordering.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced): Enable bidi reordering.

LayoutTests:

* fast/images/alt-text-with-right-to-left-inline-direction-reordering-expected-mismatch.html: Added.
* fast/images/alt-text-with-right-to-left-inline-direction-reordering.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290733 => 290734)


--- trunk/LayoutTests/ChangeLog	2022-03-02 17:07:39 UTC (rev 290733)
+++ trunk/LayoutTests/ChangeLog	2022-03-02 17:09:34 UTC (rev 290734)
@@ -1,3 +1,14 @@
+2022-03-02  Alan Bujtas  <[email protected]>
+
+        [RTL] Image alt text has incorrect bidi reordering
+        https://bugs.webkit.org/show_bug.cgi?id=237366
+        <rdar://problem/89687229>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/images/alt-text-with-right-to-left-inline-direction-reordering-expected-mismatch.html: Added.
+        * fast/images/alt-text-with-right-to-left-inline-direction-reordering.html: Added.
+
 2022-03-02  Oriol Brufau  <[email protected]>
 
         [css-cascade] Support 'revert-layer' in @keyframes

Added: trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering-expected-mismatch.html (0 => 290734)


--- trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering-expected-mismatch.html	2022-03-02 17:09:34 UTC (rev 290734)
@@ -0,0 +1,17 @@
+<meta charset="utf8">
+<style>
+div {
+  direction: rtl;
+  font-size: 10px;
+  font-family: Monospace;
+  color: green;
+}
+
+img {
+  color: blue;
+  height: 200px;
+  width: 400px;
+}
+</style>
+PASS if the blue text ordering matches the green one.
+<div>end כאשר העולם רוצה לדבר start<br><img alt="start כאשר העולם רוצה לדבר end"></div>

Added: trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering.html (0 => 290734)


--- trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/alt-text-with-right-to-left-inline-direction-reordering.html	2022-03-02 17:09:34 UTC (rev 290734)
@@ -0,0 +1,17 @@
+<meta charset="utf8">
+<style>
+div {
+  direction: rtl;
+  font-size: 10px;
+  font-family: Monospace;
+  color: green;
+}
+
+img {
+  color: blue;
+  height: 200px;
+  width: 400px;
+}
+</style>
+PASS if the blue text ordering matches the green one.
+<div>start כאשר העולם רוצה לדבר end<br><img alt="start כאשר העולם רוצה לדבר end"></div>

Modified: trunk/Source/WebCore/ChangeLog (290733 => 290734)


--- trunk/Source/WebCore/ChangeLog	2022-03-02 17:07:39 UTC (rev 290733)
+++ trunk/Source/WebCore/ChangeLog	2022-03-02 17:09:34 UTC (rev 290734)
@@ -1,3 +1,16 @@
+2022-03-02  Alan Bujtas  <[email protected]>
+
+        [RTL] Image alt text has incorrect bidi reordering
+        https://bugs.webkit.org/show_bug.cgi?id=237366
+        <rdar://problem/89687229>
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/images/alt-text-with-right-to-left-inline-direction-reordering.html
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintReplaced): Enable bidi reordering.
+
 2022-03-02  Youenn Fablet  <[email protected]>
 
         Rename MediaSampleAVFObjC::createImageSample to MediaSampleAVFObjC::createFromPixelBuffer

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (290733 => 290734)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2022-03-02 17:07:39 UTC (rev 290733)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2022-03-02 17:09:34 UTC (rev 290734)
@@ -531,7 +531,7 @@
             if (!m_altText.isEmpty()) {
                 auto& font = style().fontCascade();
                 auto& fontMetrics = font.metricsOfPrimaryFont();
-                auto textRun = RenderBlock::constructTextRun(document().displayStringModifiedByEncoding(m_altText), style());
+                auto textRun = RenderBlock::constructTextRun(document().displayStringModifiedByEncoding(m_altText), style(), DefaultExpansion, RespectDirection | RespectDirectionOverride);
                 auto textWidth = LayoutUnit { font.width(textRun) };
 
                 auto hasRoomForAltText = [&] {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to