Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[Live Text] Image overlay text is misaligned on rfi.fr
https://bugs.webkit.org/show_bug.cgi?id=235118 Reviewed by Aditya Keerthi. Source/WebCore: Reset any `text-indent` to 0 when injecting Live Text into image elements, to ensure that any `text-indent` value set on the image doesn't propagate into UA shadow DOM content. Test: fast/images/text-recognition/image-overlay-with-text-indent.html * html/shadow/imageOverlay.css: (div.image-overlay-line, .image-overlay-text, div.image-overlay-block): LayoutTests: Add a new test case to exercise the bug. * fast/images/text-recognition/image-overlay-with-text-indent-expected.html: Added. * fast/images/text-recognition/image-overlay-with-text-indent.html: Added. Canonical link: https://commits.webkit.org/245972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
82 additions
and 0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<img src="../resources/green-400x400.png"></img> | ||
<script> | ||
addEventListener("load", () => { | ||
let image = document.querySelector("img"); | ||
internals.installImageOverlay(image, [ | ||
{ | ||
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 : "Hello", | ||
topLeft : new DOMPointReadOnly(0.5, 0.5), | ||
topRight : new DOMPointReadOnly(1, 0.5), | ||
bottomRight : new DOMPointReadOnly(1, 1), | ||
bottomLeft : new DOMPointReadOnly(0.5, 1), | ||
}], | ||
} | ||
]); | ||
internals.shadowRoot(image).getElementById("image-overlay").style.color = "black"; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<img src="../resources/green-400x400.png" style="text-indent: -9999px;"></img> | ||
<script> | ||
addEventListener("load", () => { | ||
let image = document.querySelector("img"); | ||
internals.installImageOverlay(image, [ | ||
{ | ||
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 : "Hello", | ||
topLeft : new DOMPointReadOnly(0.5, 0.5), | ||
topRight : new DOMPointReadOnly(1, 0.5), | ||
bottomRight : new DOMPointReadOnly(1, 1), | ||
bottomLeft : new DOMPointReadOnly(0.5, 1), | ||
}], | ||
} | ||
]); | ||
internals.shadowRoot(image).getElementById("image-overlay").style.color = "black"; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,7 @@ div#image-overlay { | ||
overflow: hidden; | ||
color: transparent; | ||
text-shadow: none; | ||
text-indent: 0; | ||
text-align: center; | ||
font-family: system-ui; | ||
} | ||