<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279171] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279171">279171</a></dd>
<dt>Author</dt> <dd>andresg_22@apple.com</dd>
<dt>Date</dt> <dd>2021-06-23 09:59:34 -0700 (Wed, 23 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Accessibility support for image text recognition.
https://bugs.webkit.org/show_bug.cgi?id=224280
rdar://76348740

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/ios-simulator/image-overlay-elements.html

Exposes to accessibility clients the elements created by
WebPage::requestTextRecognition for static images. This allows clients
to present the recognized text in images to assistive technology users.
- Added a new AXObject subclass, AXImage, to encapsulate this functionality.
This class can be expanded to offload some of the image specific code
contained in AccessibilityRenderObject, AccessibilityNodeObject,
AccessibilityObject and others.
- Since requestTextRecognition is an async call, added an AXNotification
to notify clients when the image overlay elements are available for
consumption.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXImage.cpp: Added.
(WebCore::AXImage::AXImage):
(WebCore::AXImage::create):
(WebCore::AXImage::roleValue const):
(WebCore::AXImage::imageOverlayElements):
* accessibility/AXImage.h: Added.
* accessibility/AXLogger.cpp:
(WebCore::operator<<):
* accessibility/AXObjectCache.cpp:
(WebCore::isSimpleImage): Determines whether a given element is a static
image.
(WebCore::createFromRenderer): Instantiate an AXImage object when
appropriate.
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const): Images can
have children.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::notificationPlatformName):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityElements]):
(-[WebAccessibilityObjectWrapper accessibilityImageOverlayElements]):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::isAXImageInstance const):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::children const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::children const):
(WTR::AccessibilityUIElement::imageOverlayElements const):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::children const):
(WTR::AccessibilityUIElement::imageOverlayElements const):

LayoutTests:

* accessibility/image-link-expected.txt:
* accessibility/ios-simulator/image-overlay-elements-expected.txt: Added.
* accessibility/ios-simulator/image-overlay-elements.html: Added.
* accessibility/resources/green-400x400.png: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityimagelinkexpectedtxt">trunk/LayoutTests/accessibility/image-link-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiosTestExpectations">trunk/LayoutTests/platform/ios/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXLoggercpp">trunk/Source/WebCore/accessibility/AXLogger.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCacheh">trunk/Source/WebCore/accessibility/AXObjectCache.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectInterfaceh">trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityiosAXObjectCacheIOSmm">trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityiosWebAccessibilityObjectWrapperIOSmm">trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityisolatedtreeAXIsolatedObjectcpp">trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityisolatedtreeAXIsolatedObjecth">trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm">trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm">trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilityiossimulatorimageoverlayelementsexpectedtxt">trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityiossimulatorimageoverlayelementshtml">trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilityresourcesgreen400x400png">trunk/LayoutTests/accessibility/resources/green-400x400.png</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXImagecpp">trunk/Source/WebCore/accessibility/AXImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXImageh">trunk/Source/WebCore/accessibility/AXImage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/LayoutTests/ChangeLog 2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2021-06-23  Andres Gonzalez  <andresg_22@apple.com>
+
+        Accessibility support for image text recognition.
+        https://bugs.webkit.org/show_bug.cgi?id=224280
+        rdar://76348740
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/image-link-expected.txt:
+        * accessibility/ios-simulator/image-overlay-elements-expected.txt: Added.
+        * accessibility/ios-simulator/image-overlay-elements.html: Added.
+        * accessibility/resources/green-400x400.png: Added.
+
</ins><span class="cx"> 2021-06-18  Mark Lam  <mark.lam@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add missing exception checks in ScriptModuleLoader and JSDOMPromiseDeferred.
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityimagelinkexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/image-link-expected.txt (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/image-link-expected.txt  2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/LayoutTests/accessibility/image-link-expected.txt     2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> AXFocusableAncestor: <AXImage>
</span><span class="cx"> AXEditableAncestor: (null)
</span><span class="cx"> AXHighestEditableAncestor: (null)
</span><ins>+AXImageOverlayElements: (null)
</ins><span class="cx"> AXEmbeddedImageDescription:
</span><span class="cx"> AXURL: LayoutTests/accessibility/resources/cake.png
</span><span class="cx"> AXElementBusy: 0
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityiossimulatorimageoverlayelementsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements-expected.txt (0 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements-expected.txt   2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+PASS axImageOverlayElements.length is 2
+hello
+world
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityiossimulatorimageoverlayelementshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements.html (0 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/image-overlay-elements.html   2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<script src="../../resources/accessibility-helper.js"></script>
+<style>
+img {
+    position: absolute;
+    top: 0;
+    left: 0;
+}
+</style>
+</head>
+<body>
+
+<img id="image1" src="../resources/green-400x400.png"></img>
+
+<script>
+    window.jsTestIsAsync = true;
+
+    addEventListener("load", () => {
+        image = document.querySelector("img");
+        internals.installImageOverlay(image, [
+            {
+                topLeft : new DOMPointReadOnly(0, 0),
+                topRight : new DOMPointReadOnly(1, 0),
+                bottomRight : new DOMPointReadOnly(1, 0.5),
+                bottomLeft : new DOMPointReadOnly(0, 0.5),
+                children: [
+                    {
+                        text : "hello",
+                        topLeft : new DOMPointReadOnly(0, 0),
+                        topRight : new DOMPointReadOnly(1, 0),
+                        bottomRight : new DOMPointReadOnly(1, 0.5),
+                        bottomLeft : new DOMPointReadOnly(0, 0.5),
+                    }
+                ],
+            },
+            {
+                topLeft : new DOMPointReadOnly(0, 0.5),
+                topRight : new DOMPointReadOnly(1, 0.5),
+                bottomRight : new DOMPointReadOnly(1, 1),
+                bottomLeft : new DOMPointReadOnly(0, 1),
+                children: [
+                    {
+                        text : "world",
+                        topLeft : new DOMPointReadOnly(0, 0.5),
+                        topRight : new DOMPointReadOnly(1, 0.5),
+                        bottomRight : new DOMPointReadOnly(1, 1),
+                        bottomLeft : new DOMPointReadOnly(0, 1),
+                    }
+                ],
+            }
+        ]);
+
+        runTest();
+    });
+
+    function runTest() {
+        if (window.accessibilityController) {
+            setTimeout(async () => {
+                var axImage = accessibilityController.accessibleElementById("image1");
+                await waitFor(() => {
+                    axImageOverlayElements = axImage.imageOverlayElements;
+                    return axImageOverlayElements.length == 2;
+                });
+                shouldBe("axImageOverlayElements.length", "2");
+
+                for (let axElement of axImageOverlayElements) {
+                    let textMarkerRange = axElement.textMarkerRangeForElement(axElement);
+                    debug(axElement.stringForTextMarkerRange(textMarkerRange));
+                }
+
+                finishJSTest();
+            }, 0);
+        }
+    }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityresourcesgreen400x400png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/accessibility/resources/green-400x400.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: trunk/LayoutTests/accessibility/resources/green-400x400.png
</span><span class="cx">===================================================================
</span><del>--- trunk/LayoutTests/accessibility/resources/green-400x400.png 2021-06-23 16:25:52 UTC (rev 279170)
</del><ins>+++ trunk/LayoutTests/accessibility/resources/green-400x400.png  2021-06-23 16:59:34 UTC (rev 279171)
</ins><span class="cx">Property changes on: trunk/LayoutTests/accessibility/resources/green-400x400.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+image/png
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformiosTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios/TestExpectations (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios/TestExpectations  2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/LayoutTests/platform/ios/TestExpectations     2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -2120,6 +2120,9 @@
</span><span class="cx"> # Enable Text marker tests for iOS
</span><span class="cx"> webkit.org/b/153292 accessibility/text-marker [ Pass ]
</span><span class="cx"> 
</span><ins>+# Skip accessibility text recognition tests on iOS 14 and earlier.
+accessibility/ios-simulator/image-overlay-elements.html
+
</ins><span class="cx"> # More flaky tests (Sept 18, 2015)
</span><span class="cx"> 
</span><span class="cx"> fast/forms/select-element-focus-ring.html [ Failure Pass ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/ChangeLog      2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2021-06-23  Andres Gonzalez  <andresg_22@apple.com>
+
+        Accessibility support for image text recognition.
+        https://bugs.webkit.org/show_bug.cgi?id=224280
+        rdar://76348740
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/ios-simulator/image-overlay-elements.html
+
+        Exposes to accessibility clients the elements created by
+        WebPage::requestTextRecognition for static images. This allows clients
+        to present the recognized text in images to assistive technology users.
+        - Added a new AXObject subclass, AXImage, to encapsulate this functionality.
+        This class can be expanded to offload some of the image specific code
+        contained in AccessibilityRenderObject, AccessibilityNodeObject,
+        AccessibilityObject and others.
+        - Since requestTextRecognition is an async call, added an AXNotification
+        to notify clients when the image overlay elements are available for
+        consumption.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AXImage.cpp: Added.
+        (WebCore::AXImage::AXImage):
+        (WebCore::AXImage::create):
+        (WebCore::AXImage::roleValue const):
+        (WebCore::AXImage::imageOverlayElements):
+        * accessibility/AXImage.h: Added.
+        * accessibility/AXLogger.cpp:
+        (WebCore::operator<<):
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::isSimpleImage): Determines whether a given element is a static
+        image.
+        (WebCore::createFromRenderer): Instantiate an AXImage object when
+        appropriate.
+        * accessibility/AXObjectCache.h:
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::canHaveChildren const): Images can
+        have children.
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityObjectInterface.h:
+        * accessibility/ios/AXObjectCacheIOS.mm:
+        (WebCore::AXObjectCache::notificationPlatformName):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityElements]):
+        (-[WebAccessibilityObjectWrapper accessibilityImageOverlayElements]):
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::isAXImageInstance const):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
</ins><span class="cx"> 2021-06-18  Mark Lam  <mark.lam@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add missing exception checks in ScriptModuleLoader and JSDOMPromiseDeferred.
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/Sources.txt    2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -442,6 +442,7 @@
</span><span class="cx"> Modules/webxr/XRInputSourcesChangeEvent.cpp @no-unify
</span><span class="cx"> Modules/webxr/XRReferenceSpaceEvent.cpp @no-unify
</span><span class="cx"> Modules/webxr/XRSessionEvent.cpp @no-unify
</span><ins>+accessibility/AXImage.cpp
</ins><span class="cx"> accessibility/AXLogger.cpp
</span><span class="cx"> accessibility/AXObjectCache.cpp
</span><span class="cx"> accessibility/AccessibilityARIAGrid.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -14659,6 +14659,8 @@
</span><span class="cx">          BEA807C70F714A0300524199 /* SelectionGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionGeometry.h; sourceTree = "<group>"; };
</span><span class="cx">          BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioTrackPrivate.h; sourceTree = "<group>"; };
</span><span class="cx">          BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackPrivate.h; sourceTree = "<group>"; };
</span><ins>+               C0400C7C261CB3DB00AF44FA /* AXImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AXImage.h; sourceTree = "<group>"; };
+               C0400C7E261CB3DB00AF44FA /* AXImage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AXImage.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           C046E1AB1208A9FE00BA2CF7 /* LocalizedStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalizedStrings.cpp; sourceTree = "<group>"; };
</span><span class="cx">          C0493EB7244699E4009AAC80 /* AXLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AXLogger.h; sourceTree = "<group>"; };
</span><span class="cx">          C078376023DF253E00C9C5C8 /* AXIsolatedObjectMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = AXIsolatedObjectMac.mm; path = mac/AXIsolatedObjectMac.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -19456,6 +19458,8 @@
</span><span class="cx">                          A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */,
</span><span class="cx">                          A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */,
</span><span class="cx">                          A9EE448C210FC9AD00B6EAE6 /* AriaAttributes.idl */,
</span><ins>+                               C0400C7E261CB3DB00AF44FA /* AXImage.cpp */,
+                               C0400C7C261CB3DB00AF44FA /* AXImage.h */,
</ins><span class="cx">                           C08F13A1244766DC00AB989F /* AXLogger.cpp */,
</span><span class="cx">                          C0493EB7244699E4009AAC80 /* AXLogger.h */,
</span><span class="cx">                          2981CAAF131822EC00D12F2A /* AXObjectCache.cpp */,
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXImagecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/accessibility/AXImage.cpp (0 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXImage.cpp                           (rev 0)
+++ trunk/Source/WebCore/accessibility/AXImage.cpp      2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AXImage.h"
+
+#include "AXLogger.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
+
+namespace WebCore {
+
+AXImage::AXImage(RenderImage* renderer)
+    : AccessibilityRenderObject(renderer)
+{
+}
+
+Ref<AXImage> AXImage::create(RenderImage* renderer)
+{
+    return adoptRef(*new AXImage(renderer));
+}
+
+AccessibilityRole AXImage::roleValue() const
+{
+    auto ariaRole = ariaRoleAttribute();
+    if (ariaRole != AccessibilityRole::Unknown)
+        return ariaRole;
+
+    return AccessibilityRole::Image;
+}
+
+std::optional<AXCoreObject::AccessibilityChildrenVector> AXImage::imageOverlayElements()
+{
+    AXTRACE("AXImage::imageOverlayElements");
+
+    auto& children = this->children();
+    if (children.size())
+        return children;
+
+#if ENABLE(IMAGE_ANALYSIS)
+    auto* page = this->page();
+    if (!page)
+        return std::nullopt;
+
+    page->chrome().client().requestTextRecognition(*element(), [] (RefPtr<Element>&& imageOverlayHost) {
+        if (!imageOverlayHost)
+            return;
+
+        if (auto* axObjectCache = imageOverlayHost->document().existingAXObjectCache())
+            axObjectCache->postNotification(imageOverlayHost.get(), AXObjectCache::AXImageOverlayChanged);
+    });
+#endif
+
+    return std::nullopt;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXImageh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/accessibility/AXImage.h (0 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXImage.h                             (rev 0)
+++ trunk/Source/WebCore/accessibility/AXImage.h        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "AccessibilityRenderObject.h"
+#include "RenderImage.h"
+
+namespace WebCore {
+
+class AXImage : public AccessibilityRenderObject {
+public:
+    static Ref<AXImage> create(RenderImage*);
+    virtual ~AXImage() = default;
+
+private:
+    explicit AXImage(RenderImage*);
+    bool isAXImageInstance() const override { return true; }
+
+    AccessibilityRole roleValue() const override;
+    std::optional<AccessibilityChildrenVector> imageOverlayElements() override;
+};
+
+} // namespace WebCore 
+
+SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AXImage, isAXImageInstance())
</ins></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXLoggercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXLogger.cpp  2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp     2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -372,6 +372,9 @@
</span><span class="cx">     case AXObjectCache::AXNotification::AXIdAttributeChanged:
</span><span class="cx">         stream << "AXIdAttributeChanged";
</span><span class="cx">         break;
</span><ins>+    case AXObjectCache::AXNotification::AXImageOverlayChanged:
+        stream << "AXImageOverlayChanged";
+        break;
</ins><span class="cx">     case AXObjectCache::AXNotification::AXLanguageChanged:
</span><span class="cx">         stream << "AXLanguageChanged";
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp     2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -511,6 +511,28 @@
</span><span class="cx">     return SpaceSplitString(roleValue, true).contains(role);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool isSimpleImage(const RenderObject& renderer)
+{
+    if (!is<RenderImage>(renderer))
+        return false;
+
+    // Exclude ImageButtons because they are treated as buttons, not as images.
+    auto* node = renderer.node();
+    if (is<HTMLInputElement>(node))
+        return false;
+
+    // ImageMaps are not simple images.
+    if (downcast<RenderImage>(renderer).imageMap()
+        || (is<HTMLImageElement>(node) && downcast<HTMLImageElement>(node)->hasAttributeWithoutSynchronization(usemapAttr)))
+        return false;
+
+    // Exclude video and audio elements.
+    if (is<HTMLMediaElement>(node))
+        return false;
+
+    return true;
+}
+
</ins><span class="cx"> static Ref<AccessibilityObject> createFromRenderer(RenderObject* renderer)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: How could renderer->node() ever not be an Element?
</span><span class="lines">@@ -550,6 +572,9 @@
</span><span class="cx">     if (is<SVGElement>(node))
</span><span class="cx">         return AccessibilitySVGElement::create(renderer);
</span><span class="cx"> 
</span><ins>+    if (isSimpleImage(*renderer))
+        return AXImage::create(downcast<RenderImage>(renderer));
+
</ins><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx">     // The mfenced element creates anonymous RenderMathMLOperators which should be treated
</span><span class="cx">     // as MathML elements and assigned the MathElementRole so that platform logic regarding
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.h       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -284,6 +284,7 @@
</span><span class="cx">         AXFocusedUIElementChanged,
</span><span class="cx">         AXFrameLoadComplete,
</span><span class="cx">         AXIdAttributeChanged,
</span><ins>+        AXImageOverlayChanged,
</ins><span class="cx">         AXLanguageChanged,
</span><span class="cx">         AXLayoutComplete,
</span><span class="cx">         AXLoadComplete,
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp   2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp      2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -378,7 +378,6 @@
</span><span class="cx">     
</span><span class="cx">     // Elements that should not have children
</span><span class="cx">     switch (roleValue()) {
</span><del>-    case AccessibilityRole::Image:
</del><span class="cx">     case AccessibilityRole::Button:
</span><span class="cx">     case AccessibilityRole::PopUpButton:
</span><span class="cx">     case AccessibilityRole::CheckBox:
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h    2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx">     bool isAccessibilityRenderObject() const override { return false; }
</span><span class="cx">     bool isAccessibilityScrollbar() const override { return false; }
</span><span class="cx">     bool isAccessibilityScrollViewInstance() const override { return false; }
</span><ins>+    bool isAXImageInstance() const override { return false; }
</ins><span class="cx">     bool isAccessibilitySVGRoot() const override { return false; }
</span><span class="cx">     bool isAccessibilitySVGElement() const override { return false; }
</span><span class="cx">     bool isAccessibilityTableInstance() const override { return false; }
</span><span class="lines">@@ -399,6 +400,7 @@
</span><span class="cx">     String brailleLabel() const override { return getAttribute(HTMLNames::aria_braillelabelAttr); }
</span><span class="cx">     String brailleRoleDescription() const override { return getAttribute(HTMLNames::aria_brailleroledescriptionAttr); }
</span><span class="cx">     String embeddedImageDescription() const override;
</span><ins>+    std::optional<AccessibilityChildrenVector> imageOverlayElements() override { return std::nullopt; }
</ins><span class="cx"> 
</span><span class="cx">     // Abbreviations
</span><span class="cx">     String expandedTextValue() const override { return String(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h        2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h   2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -791,6 +791,7 @@
</span><span class="cx">     virtual bool isAccessibilityRenderObject() const = 0;
</span><span class="cx">     virtual bool isAccessibilityScrollbar() const = 0;
</span><span class="cx">     virtual bool isAccessibilityScrollViewInstance() const = 0;
</span><ins>+    virtual bool isAXImageInstance() const = 0;
</ins><span class="cx">     virtual bool isAccessibilitySVGRoot() const = 0;
</span><span class="cx">     virtual bool isAccessibilitySVGElement() const = 0;
</span><span class="cx">     virtual bool isAccessibilityTableInstance() const = 0;
</span><span class="lines">@@ -1014,6 +1015,7 @@
</span><span class="cx">     virtual String brailleLabel() const = 0;
</span><span class="cx">     virtual String brailleRoleDescription() const = 0;
</span><span class="cx">     virtual String embeddedImageDescription() const = 0;
</span><ins>+    virtual std::optional<AccessibilityChildrenVector> imageOverlayElements() = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool supportsARIAOwns() const = 0;
</span><span class="cx">     virtual bool isActiveDescendantOfFocusedContainer() const = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityiosAXObjectCacheIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -51,6 +51,9 @@
</span><span class="cx">     case AXFocusedUIElementChanged:
</span><span class="cx">         name = "AXFocusChanged";
</span><span class="cx">         break;
</span><ins>+    case AXImageOverlayChanged:
+        name = "AXImageOverlayChanged";
+        break;
</ins><span class="cx">     case AXPageScrolled:
</span><span class="cx">         name = "AXPageScrolled";
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityiosWebAccessibilityObjectWrapperIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx"> - (NSInteger)accessibilityElementCount;
</span><span class="cx"> - (id)accessibilityElementAtIndex:(NSInteger)index;
</span><span class="cx"> - (NSInteger)indexOfAccessibilityElement:(id)element;
</span><ins>+- (NSArray *)accessibilityElements;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface WebAccessibilityObjectWrapper (AccessibilityPrivate)
</span><span class="lines">@@ -429,6 +430,29 @@
</span><span class="cx">         cache->stopCachingComputedObjectAttributes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSArray *)accessibilityElements
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    if ([self isAttachment]) {
+        if (id attachmentView = [self attachmentView])
+            return [attachmentView accessibilityElements];
+    }
+
+    auto array = adoptNS([[NSMutableArray alloc] init]);
+    for (const auto& child : self.axBackingObject->children()) {
+        auto* wrapper = child->wrapper();
+        if (child->isAttachment()) {
+            if (id attachmentView = [wrapper attachmentView])
+                [array addObject:attachmentView];
+        } else
+            [array addObject:wrapper];
+    }
+
+    return array.autorelease();
+}
+
</ins><span class="cx"> - (NSInteger)accessibilityElementCount
</span><span class="cx"> {
</span><span class="cx">     if (![self _prepareAccessibilityCall])
</span><span class="lines">@@ -1854,6 +1878,15 @@
</span><span class="cx">     return self.axBackingObject->embeddedImageDescription();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSArray *)accessibilityImageOverlayElements
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    auto imageOverlayElements = self.axBackingObject->imageOverlayElements();
+    return imageOverlayElements ? accessibleElementsForObjects(*imageOverlayElements) : nil;
+}
+
</ins><span class="cx"> - (NSString *)accessibilityLinkRelationshipType
</span><span class="cx"> {
</span><span class="cx">     if (![self _prepareAccessibilityCall])
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityisolatedtreeAXIsolatedObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp     2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -1258,6 +1258,12 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool AXIsolatedObject::isAXImageInstance() const
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
</ins><span class="cx"> bool AXIsolatedObject::isAccessibilitySVGRoot() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityisolatedtreeAXIsolatedObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -272,6 +272,7 @@
</span><span class="cx">     String brailleLabel() const override { return stringAttributeValue(AXPropertyName::BrailleLabel); }
</span><span class="cx">     String brailleRoleDescription() const override { return stringAttributeValue(AXPropertyName::BrailleRoleDescription); }
</span><span class="cx">     String embeddedImageDescription() const override { return stringAttributeValue(AXPropertyName::EmbeddedImageDescription); }
</span><ins>+    std::optional<AccessibilityChildrenVector> imageOverlayElements() override { return std::nullopt; }
</ins><span class="cx"> 
</span><span class="cx">     String computedRoleString() const override { return stringAttributeValue(AXPropertyName::ComputedRoleString); }
</span><span class="cx">     bool isValueAutofilled() const override { return boolAttributeValue(AXPropertyName::IsValueAutofilled); }
</span><span class="lines">@@ -465,6 +466,7 @@
</span><span class="cx">     bool isAccessibilityRenderObject() const override;
</span><span class="cx">     bool isAccessibilityScrollbar() const override;
</span><span class="cx">     bool isAccessibilityScrollViewInstance() const override;
</span><ins>+    bool isAXImageInstance() const override;
</ins><span class="cx">     bool isAccessibilitySVGRoot() const override;
</span><span class="cx">     bool isAccessibilitySVGElement() const override;
</span><span class="cx">     bool isAccessibilityTableInstance() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -319,6 +319,9 @@
</span><span class="cx">     case AXFocusedUIElementChanged:
</span><span class="cx">         macNotification = NSAccessibilityFocusedUIElementChangedNotification;
</span><span class="cx">         break;
</span><ins>+    case AXImageOverlayChanged:
+        macNotification = @"AXImageOverlayChanged";
+        break;
</ins><span class="cx">     case AXLayoutComplete:
</span><span class="cx">         macNotification = @"AXLayoutComplete";
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm       2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm  2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -543,6 +543,10 @@
</span><span class="cx"> #define NSAccessibilityEmbeddedImageDescriptionAttribute @"AXEmbeddedImageDescription"
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilityImageOverlayElementsAttribute
+#define NSAccessibilityImageOverlayElementsAttribute @"AXImageOverlayElements"
+#endif
+
</ins><span class="cx"> extern "C" AXUIElementRef NSAccessibilityCreateAXUIElementRef(id element);
</span><span class="cx"> 
</span><span class="cx"> @implementation WebAccessibilityObjectWrapper
</span><span class="lines">@@ -1560,8 +1564,9 @@
</span><span class="cx">         [tempArray addObject:NSAccessibilityVerticalScrollBarAttribute];
</span><span class="cx">         return tempArray;
</span><span class="cx">     }());
</span><del>-    static auto imageAttrs =  makeNeverDestroyed([] {
</del><ins>+    static auto imageAttrs = makeNeverDestroyed([] {
</ins><span class="cx">         auto tempArray = adoptNS([[NSMutableArray alloc] initWithArray:attributes.get().get()]);
</span><ins>+        [tempArray addObject:NSAccessibilityImageOverlayElementsAttribute];
</ins><span class="cx">         [tempArray addObject:NSAccessibilityEmbeddedImageDescriptionAttribute];
</span><span class="cx">         [tempArray addObject:NSAccessibilityURLAttribute];
</span><span class="cx">         return tempArray;
</span><span class="lines">@@ -2366,6 +2371,12 @@
</span><span class="cx">         return [self position];
</span><span class="cx">     if ([attributeName isEqualToString:NSAccessibilityPathAttribute])
</span><span class="cx">         return [self path];
</span><ins>+
+    if ([attributeName isEqualToString:NSAccessibilityImageOverlayElementsAttribute]) {
+        auto imageOverlayElements = backingObject->imageOverlayElements();
+        return imageOverlayElements ? convertToNSArray(*imageOverlayElements) : nil;
+    }
+
</ins><span class="cx">     if ([attributeName isEqualToString:NSAccessibilityEmbeddedImageDescriptionAttribute])
</span><span class="cx">         return backingObject->embeddedImageDescription();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/ChangeLog       2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2021-06-23  Andres Gonzalez  <andresg_22@apple.com>
+
+        Accessibility support for image text recognition.
+        https://bugs.webkit.org/show_bug.cgi?id=224280
+        rdar://76348740
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::children const):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::children const):
+        (WTR::AccessibilityUIElement::imageOverlayElements const):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::children const):
+        (WTR::AccessibilityUIElement::imageOverlayElements const):
+
</ins><span class="cx"> 2021-06-23  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update WPT tools from upstream
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp   2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp      2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -127,8 +127,10 @@
</span><span class="cx"> RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
</span><span class="cx"> RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::misspellingTextMarkerRange(AccessibilityTextMarkerRange*, bool) { return nullptr; }
</span><span class="cx"> void AccessibilityUIElement::dismiss() { }
</span><ins>+JSValueRef AccessibilityUIElement::children() const { return { }; }
</ins><span class="cx"> JSValueRef AccessibilityUIElement::detailsElements() const { return { }; }
</span><span class="cx"> JSValueRef AccessibilityUIElement::errorMessageElements() const { return { }; }
</span><ins>+JSValueRef AccessibilityUIElement::imageOverlayElements() const { return { }; }
</ins><span class="cx"> JSRetainPtr<JSStringRef> AccessibilityUIElement::embeddedImageDescription() const { return nullptr; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h     2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx">     JSRetainPtr<JSStringRef> domIdentifier() const;
</span><span class="cx"> 
</span><span class="cx">     RefPtr<AccessibilityUIElement> elementAtPoint(int x, int y);
</span><ins>+    JSValueRef children() const;
</ins><span class="cx">     RefPtr<AccessibilityUIElement> childAtIndex(unsigned);
</span><span class="cx">     unsigned indexOfChild(AccessibilityUIElement*);
</span><span class="cx">     int childrenCount();
</span><span class="lines">@@ -196,7 +197,8 @@
</span><span class="cx">     JSRetainPtr<JSStringRef> url();
</span><span class="cx">     JSRetainPtr<JSStringRef> classList() const;
</span><span class="cx">     JSRetainPtr<JSStringRef> embeddedImageDescription() const;
</span><del>-    
</del><ins>+    JSValueRef imageOverlayElements() const;
+
</ins><span class="cx">     // CSS3-speech properties.
</span><span class="cx">     JSRetainPtr<JSStringRef> speakAs();
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl  2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl     2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -110,6 +110,7 @@
</span><span class="cx">     readonly attribute DOMString ariaDropEffects;
</span><span class="cx">     readonly attribute DOMString classList;
</span><span class="cx">     readonly attribute DOMString embeddedImageDescription;
</span><ins>+    readonly attribute object imageOverlayElements;
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute long x;
</span><span class="cx">     readonly attribute long y;
</span><span class="lines">@@ -118,6 +119,7 @@
</span><span class="cx">     readonly attribute long clickPointX;
</span><span class="cx">     readonly attribute long clickPointY;
</span><span class="cx"> 
</span><ins>+    readonly attribute object children;
</ins><span class="cx">     readonly attribute long childrenCount;
</span><span class="cx">     readonly attribute long selectedChildrenCount;
</span><span class="cx">     readonly attribute long rowCount;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm     2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx"> - (id)_accessibilityLandmarkAncestor;
</span><span class="cx"> - (id)_accessibilityListAncestor;
</span><span class="cx"> - (id)_accessibilityPhotoDescription;
</span><ins>+- (NSArray *)accessibilityImageOverlayElements;
</ins><span class="cx"> 
</span><span class="cx"> // TextMarker related
</span><span class="cx"> - (NSArray *)textMarkerRange;
</span><span class="lines">@@ -215,6 +216,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValueRef AccessibilityUIElement::children() const
+{
+    return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>([m_element accessibilityElements]));
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getChildren(Vector<RefPtr<AccessibilityUIElement> >& elementVector)
</span><span class="cx"> {
</span><span class="cx">     NSInteger childCount = [m_element accessibilityElementCount];
</span><span class="lines">@@ -1101,6 +1107,11 @@
</span><span class="cx">     return concatenateAttributeAndValue(@"AXEmbeddedImageDescription", [m_element _accessibilityPhotoDescription]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValueRef AccessibilityUIElement::imageOverlayElements() const
+{
+    return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>([m_element accessibilityImageOverlayElements]));
+}
+
</ins><span class="cx"> bool AccessibilityUIElement::isCollapsed() const
</span><span class="cx"> {
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (279170 => 279171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm     2021-06-23 16:25:52 UTC (rev 279170)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2021-06-23 16:59:34 UTC (rev 279171)
</span><span class="lines">@@ -349,6 +349,15 @@
</span><span class="cx">         elements = makeVector<RefPtr<AccessibilityUIElement>>(value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValueRef AccessibilityUIElement::children() const
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>(attributeValue(m_element.get(), NSAccessibilityChildrenAttribute)));
+    END_AX_OBJC_EXCEPTIONS
+
+    return nullptr;
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getChildren(Vector<RefPtr<AccessibilityUIElement> >& elementVector)
</span><span class="cx"> {
</span><span class="cx">     elementVector = makeVector<RefPtr<AccessibilityUIElement>>(attributeValue(m_element.get(), NSAccessibilityChildrenAttribute));
</span><span class="lines">@@ -1674,6 +1683,15 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValueRef AccessibilityUIElement::imageOverlayElements() const
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>(attributeValue(m_element.get(), @"AXImageOverlayElements")));
+    END_AX_OBJC_EXCEPTIONS
+
+    return nullptr;
+}
+
</ins><span class="cx"> bool AccessibilityUIElement::isIgnored() const
</span><span class="cx"> {
</span><span class="cx">     BOOL result = NO;
</span></span></pre>
</div>
</div>

</body>
</html>