Diff
Modified: trunk/LayoutTests/ChangeLog (274531 => 274532)
--- trunk/LayoutTests/ChangeLog 2021-03-16 23:05:00 UTC (rev 274531)
+++ trunk/LayoutTests/ChangeLog 2021-03-16 23:39:32 UTC (rev 274532)
@@ -1,3 +1,18 @@
+2021-03-15 Ebrahim Byagowi <ebra...@gnu.org> and Myles C. Maxfield <mmaxfi...@apple.com>
+
+ <img> isn't able to render RTL text correctly in ALT text
+ https://bugs.webkit.org/show_bug.cgi?id=221833
+ <rdar://problem/74530491>
+
+ Reviewed by Zalan Bujtas.
+
+ * platform/ios/TestExpectations:
+ * platform/mac/TestExpectations:
+ * fast/text/image-alt-text-bidi-2-expected.html: Added.
+ * fast/text/image-alt-text-bidi-2.html: Added.
+ * fast/text/image-alt-text-bidi-expected.html: Added.
+ * fast/text/image-alt-text-bidi.html: Added.
+
2021-03-16 Alexey Shvayka <shvaikal...@gmail.com>
Cache cross-origin methods / accessors of Window and Location per lexical global object
Added: trunk/LayoutTests/fast/text/image-alt-text-bidi-2-expected.html (0 => 274532)
--- trunk/LayoutTests/fast/text/image-alt-text-bidi-2-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/image-alt-text-bidi-2-expected.html 2021-03-16 23:39:32 UTC (rev 274532)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that RTL text is shaped correctly in image alt text. The test passes if you see this text below:
+<div style="position: relative;"><div style="position: absolute; left: 2px; top: 2px; width: 196px; height: 80px; overflow: hidden;"><div style="display: inline-block; width: 200px; height: 200px; position: absolute; left: -0.5px; top: -1.5px;">یاexampleیا</div></div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/image-alt-text-bidi-2.html (0 => 274532)
--- trunk/LayoutTests/fast/text/image-alt-text-bidi-2.html (rev 0)
+++ trunk/LayoutTests/fast/text/image-alt-text-bidi-2.html 2021-03-16 23:39:32 UTC (rev 274532)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that RTL text is shaped correctly in image alt text. The test passes if you see this text below:
+<div style="position: relative;"><div style="position: absolute; left: 2px; top: 2px; width: 196px; height: 80px; overflow: hidden;"><img alt="یاexampleیا" src="" width="200" height="200" style="position: absolute; left: -2px; top: -2px;"></div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/image-alt-text-bidi-expected.html (0 => 274532)
--- trunk/LayoutTests/fast/text/image-alt-text-bidi-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/image-alt-text-bidi-expected.html 2021-03-16 23:39:32 UTC (rev 274532)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that RTL text is shaped correctly in image alt text. The test passes if you see this text below:
+<div style="position: relative;"><div style="position: absolute; left: 2px; top: 2px; width: 196px; height: 80px; overflow: hidden;"><div style="display: inline-block; width: 200px; height: 200px; position: absolute; left: -1px; top: -2px;">یاexampleیا</div></div></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/image-alt-text-bidi.html (0 => 274532)
--- trunk/LayoutTests/fast/text/image-alt-text-bidi.html (rev 0)
+++ trunk/LayoutTests/fast/text/image-alt-text-bidi.html 2021-03-16 23:39:32 UTC (rev 274532)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that RTL text is shaped correctly in image alt text. The test passes if you see this text below:
+<div style="position: relative;"><div style="position: absolute; left: 2px; top: 2px; width: 196px; height: 80px; overflow: hidden;"><img alt="یاexampleیا" src="" width="200" height="200" style="position: absolute; left: -2px; top: -2px;"></div></div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (274531 => 274532)
--- trunk/LayoutTests/platform/ios/TestExpectations 2021-03-16 23:05:00 UTC (rev 274531)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2021-03-16 23:39:32 UTC (rev 274532)
@@ -3506,3 +3506,5 @@
# Not all OSes support the same set of emoji.
fast/text/mending-heart.html [ Failure ]
+
+webkit.org/b/221833 fast/text/image-alt-text-bidi.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (274531 => 274532)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-03-16 23:05:00 UTC (rev 274531)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-03-16 23:39:32 UTC (rev 274532)
@@ -2321,3 +2321,5 @@
webkit.org/b/223271 [ BigSur Debug ] imported/w3c/web-platform-tests/xhr/event-upload-progress.any.worker.html [ Pass Failure ]
webkit.org/b/223144 [ Debug arm64 ] fast/multicol/crash-when-spanner-candidate-is-out-of-flow.html [ Crash ]
+
+webkit.org/b/221833 fast/text/image-alt-text-bidi-2.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (274531 => 274532)
--- trunk/Source/WebCore/ChangeLog 2021-03-16 23:05:00 UTC (rev 274531)
+++ trunk/Source/WebCore/ChangeLog 2021-03-16 23:39:32 UTC (rev 274532)
@@ -1,3 +1,18 @@
+2021-03-15 Ebrahim Byagowi <ebra...@gnu.org> and Myles C. Maxfield <mmaxfi...@apple.com>
+
+ <img> isn't able to render RTL text correctly in ALT text
+ https://bugs.webkit.org/show_bug.cgi?id=221833
+ <rdar://problem/74530491>
+
+ Reviewed by Zalan Bujtas.
+
+ Simply use the text drawing routine that handles bidi.
+
+ Test: fast/text/image-alt-text-bidi.html
+
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintReplaced):
+
2021-03-15 Myles C. Maxfield <mmaxfi...@apple.com>
Be more restrictive about when canvas2d is allowed to update style
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (274531 => 274532)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2021-03-16 23:05:00 UTC (rev 274531)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2021-03-16 23:39:32 UTC (rev 274532)
@@ -4,7 +4,7 @@
* (C) 2000 Dirk Mueller (muel...@kde.org)
* (C) 2006 Allan Sandfeld Jensen (k...@carewolf.com)
* (C) 2006 Samuel Weinig (sam.wei...@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2021 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
* Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
*
@@ -537,9 +537,9 @@
LayoutUnit textWidth { font.width(textRun) };
if (errorPictureDrawn) {
if (usableSize.width() >= textWidth && fontMetrics.height() <= imageOffset.height())
- context.drawText(font, textRun, altTextOffset);
+ context.drawBidiText(font, textRun, altTextOffset);
} else if (usableSize.width() >= textWidth && usableSize.height() >= fontMetrics.height())
- context.drawText(font, textRun, altTextOffset);
+ context.drawBidiText(font, textRun, altTextOffset);
}
}
return;