Modified: trunk/LayoutTests/ChangeLog (286281 => 286282)
--- trunk/LayoutTests/ChangeLog 2021-11-30 03:25:00 UTC (rev 286281)
+++ trunk/LayoutTests/ChangeLog 2021-11-30 04:23:14 UTC (rev 286282)
@@ -1,3 +1,16 @@
+2021-11-29 Wenson Hsieh <[email protected]>
+
+ [Webpage translation] Avoid translating text inside image overlays
+ https://bugs.webkit.org/show_bug.cgi?id=233225
+ rdar://85713734
+
+ Reviewed by Aditya Keerthi.
+
+ Add a test to verify that `translate` is `false` on the image overlay root container element.
+
+ * fast/images/text-recognition/image-overlay-do-not-translate-expected.txt: Added.
+ * fast/images/text-recognition/image-overlay-do-not-translate.html: Added.
+
2021-11-29 Lauro Moura <[email protected]>
[GLIB] Gardening SVG filter failures after r286203
Added: trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate-expected.txt (0 => 286282)
--- trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate-expected.txt 2021-11-30 04:23:14 UTC (rev 286282)
@@ -0,0 +1,6 @@
+PASS imageOverlayContainer(image1).translate is false
+PASS imageOverlayContainer(image2).translate is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate.html (0 => 286282)
--- trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate.html (rev 0)
+++ trunk/LayoutTests/fast/images/text-recognition/image-overlay-do-not-translate.html 2021-11-30 04:23:14 UTC (rev 286282)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+body, html {
+ margin: 0;
+}
+</style>
+</head>
+<body>
+<img id="img1" src=""
+<img id="img2" src=""
+<script>
+function imageOverlayContainer(image) {
+ return internals.shadowRoot(image1).getElementById("image-overlay");
+}
+
+addEventListener("load", () => {
+ image1 = document.getElementById("img1");
+ image2 = document.getElementById("img2");
+ internals.installImageOverlay(image1, [], [
+ {
+ topLeft : new DOMPointReadOnly(0.1, 0.1),
+ topRight : new DOMPointReadOnly(0.4, 0.1),
+ bottomRight : new DOMPointReadOnly(0.4, 0.4),
+ bottomLeft : new DOMPointReadOnly(0.1, 0.4),
+ text : "Hello",
+ }
+ ]);
+ internals.installImageOverlay(image2, [
+ {
+ topLeft : new DOMPointReadOnly(0.5, 0.5),
+ topRight : new DOMPointReadOnly(1, 0.5),
+ bottomRight : new DOMPointReadOnly(1, 1),
+ bottomLeft : new DOMPointReadOnly(0.5, 1),
+ children: [{
+ text : "World",
+ topLeft : new DOMPointReadOnly(0.5, 0.5),
+ topRight : new DOMPointReadOnly(1, 0.5),
+ bottomRight : new DOMPointReadOnly(1, 1),
+ bottomLeft : new DOMPointReadOnly(0.5, 1),
+ }],
+ }
+ ]);
+ shouldBe("imageOverlayContainer(image1).translate", "false");
+ shouldBe("imageOverlayContainer(image2).translate", "false");
+});
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (286281 => 286282)
--- trunk/Source/WebCore/ChangeLog 2021-11-30 03:25:00 UTC (rev 286281)
+++ trunk/Source/WebCore/ChangeLog 2021-11-30 04:23:14 UTC (rev 286282)
@@ -1,3 +1,19 @@
+2021-11-29 Wenson Hsieh <[email protected]>
+
+ [Webpage translation] Avoid translating text inside image overlays
+ https://bugs.webkit.org/show_bug.cgi?id=233225
+ rdar://85713734
+
+ Reviewed by Aditya Keerthi.
+
+ Add `translate="no"` to image overlay content; text in image overlays is meant to visually match recognized text
+ in the image, and should never be modified as a part of webpage translation.
+
+ Test: fast/images/text-recognition/image-overlay-do-not-translate.html
+
+ * dom/ImageOverlay.cpp:
+ (WebCore::ImageOverlay::updateSubtree):
+
2021-11-29 Simon Fraser <[email protected]>
Run keyboard-animated scrolls on the scrolling thread
Modified: trunk/Source/WebCore/dom/ImageOverlay.cpp (286281 => 286282)
--- trunk/Source/WebCore/dom/ImageOverlay.cpp 2021-11-30 03:25:00 UTC (rev 286281)
+++ trunk/Source/WebCore/dom/ImageOverlay.cpp 2021-11-30 04:23:14 UTC (rev 286282)
@@ -303,6 +303,7 @@
if (!elements.root) {
auto rootContainer = HTMLDivElement::create(document.get());
rootContainer->setIdAttribute(imageOverlayElementIdentifier());
+ rootContainer->setTranslate(false);
if (document->isImageDocument())
rootContainer->setInlineStyleProperty(CSSPropertyWebkitUserSelect, CSSValueText);