<!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>[278907] trunk/Source/WebCore</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/278907">278907</a></dd>
<dt>Author</dt> <dd>andresg_22@apple.com</dd>
<dt>Date</dt> <dd>2021-06-15 15:06:17 -0700 (Tue, 15 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>iOS - VoiceOver reads incorrectly in content editable element if role="document".
https://bugs.webkit.org/show_bug.cgi?id=227035
rdar://78776169

Reviewed by Chris Fleizach.

On iOS, VoiceOver was announcing <div contenteditable="true" role="document">
as a landmark and not as editable text. Furthermore, VoiceOver wasn't
echoing keyboard input once the element became interactive.
The solution is to return AccessibilityRole::TextArea for an element
with these attributes instead of Document.
Used shouldIgnoreRoleAttribute to special case this scenario.

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::shouldIgnoreAttributeRole const):
* accessibility/AccessibilityObjectInterface.h:
Removed shouldIgnoreRoleAttribute from the AXObject interface since it
doesn't need to be exposed outside the AXObject class hierarchy.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::shouldIgnoreAttributeRole const):
* accessibility/AccessibilityRenderObject.h:
* accessibility/AccessibilityTreeItem.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]): Code cleanup.
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::shouldIgnoreAttributeRole const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjecth">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityTreeItemh">trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/ChangeLog      2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2021-06-15  Andres Gonzalez  <andresg_22@apple.com>
+
+        iOS - VoiceOver reads incorrectly in content editable element if role="document".
+        https://bugs.webkit.org/show_bug.cgi?id=227035
+        rdar://78776169
+
+        Reviewed by Chris Fleizach.
+
+        On iOS, VoiceOver was announcing <div contenteditable="true" role="document">
+        as a landmark and not as editable text. Furthermore, VoiceOver wasn't
+        echoing keyboard input once the element became interactive.
+        The solution is to return AccessibilityRole::TextArea for an element
+        with these attributes instead of Document.
+        Used shouldIgnoreRoleAttribute to special case this scenario.
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::shouldIgnoreAttributeRole const):
+        * accessibility/AccessibilityObjectInterface.h:
+        Removed shouldIgnoreRoleAttribute from the AXObject interface since it
+        doesn't need to be exposed outside the AXObject class hierarchy.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::shouldIgnoreAttributeRole const):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/AccessibilityTreeItem.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]): Code cleanup.
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::shouldIgnoreAttributeRole const): Deleted.
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+
</ins><span class="cx"> 2021-06-15  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Allow legacy SecurityOrigin behavior for x-apple-ql-id2 scheme
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h    2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -487,8 +487,6 @@
</span><span class="cx">     void addChild(AXCoreObject*) override;
</span><span class="cx">     void insertChild(AXCoreObject*, unsigned) override;
</span><span class="cx"> 
</span><del>-    bool shouldIgnoreAttributeRole() const override { return false; }
-
</del><span class="cx">     bool canHaveChildren() const override { return true; }
</span><span class="cx">     bool hasChildren() const override { return m_haveChildren; }
</span><span class="cx">     void updateChildrenIfNecessary() override;
</span><span class="lines">@@ -777,6 +775,7 @@
</span><span class="cx">     ScrollableArea* scrollableAreaAncestor() const;
</span><span class="cx">     void scrollAreaAndAncestor(std::pair<ScrollableArea*, AccessibilityObject*>&) const;
</span><span class="cx"> 
</span><ins>+    virtual bool shouldIgnoreAttributeRole() const { return false; }
</ins><span class="cx">     virtual AccessibilityRole buttonRoleType() const;
</span><span class="cx">     String rolePlatformDescription() const;
</span><span class="cx">     bool isOnScreen() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h        2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h   2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -1229,8 +1229,6 @@
</span><span class="cx">     virtual void insertChild(AXCoreObject*, unsigned) = 0;
</span><span class="cx">     Vector<AXID> childrenIDs();
</span><span class="cx"> 
</span><del>-    virtual bool shouldIgnoreAttributeRole() const = 0;
-
</del><span class="cx">     virtual bool canHaveChildren() const = 0;
</span><span class="cx">     virtual bool hasChildren() const = 0;
</span><span class="cx">     virtual void updateChildrenIfNecessary() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp    2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -2791,6 +2791,14 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool AccessibilityRenderObject::shouldIgnoreAttributeRole() const
+{
+    if (m_ariaRole == AccessibilityRole::Document
+        && hasContentEditableAttributeSet())
+        return true;
+    return false;
+}
+
</ins><span class="cx"> AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
</span><span class="cx"> {
</span><span class="cx">     AXTRACE("AccessibilityRenderObject::determineAccessibilityRole");
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h   2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h      2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -206,6 +206,7 @@
</span><span class="cx">     
</span><span class="cx">     bool isDetached() const override { return !m_renderer; }
</span><span class="cx"> 
</span><ins>+    bool shouldIgnoreAttributeRole() const override;
</ins><span class="cx">     AccessibilityRole determineAccessibilityRole() override;
</span><span class="cx">     bool computeAccessibilityIsIgnored() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityTreeItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h       2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h  2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -37,11 +37,11 @@
</span><span class="cx">     static Ref<AccessibilityTreeItem> create(RenderObject*);
</span><span class="cx">     virtual ~AccessibilityTreeItem();
</span><span class="cx"> 
</span><del>-    bool shouldIgnoreAttributeRole() const override { return !m_isTreeItemValid; }
</del><span class="cx">     bool supportsCheckedState() const override;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit AccessibilityTreeItem(RenderObject*);
</span><ins>+    bool shouldIgnoreAttributeRole() const final { return !m_isTreeItemValid; }
</ins><span class="cx">     AccessibilityRole determineAccessibilityRole() override;
</span><span class="cx">     bool m_isTreeItemValid;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityiosWebAccessibilityObjectWrapperIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm       2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm  2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -760,14 +760,24 @@
</span><span class="cx"> - (uint64_t)_accessibilityTextEntryTraits
</span><span class="cx"> {
</span><span class="cx">     uint64_t traits = [self _axTextEntryTrait];
</span><del>-    if (self.axBackingObject->isFocused())
</del><ins>+
+    auto* backingObject = self.axBackingObject;
+    if (backingObject->isFocused())
</ins><span class="cx">         traits |= ([self _axHasTextCursorTrait] | [self _axTextOperationsAvailableTrait]);
</span><del>-    if (self.axBackingObject->isPasswordField())
</del><ins>+    if (backingObject->isPasswordField())
</ins><span class="cx">         traits |= [self _axSecureTextFieldTrait];
</span><del>-    if (self.axBackingObject->roleValue() == AccessibilityRole::SearchField)
</del><ins>+
+    switch (backingObject->roleValue()) {
+    case AccessibilityRole::SearchField:
</ins><span class="cx">         traits |= [self _axSearchFieldTrait];
</span><del>-    if (self.axBackingObject->roleValue() == AccessibilityRole::TextArea)
</del><ins>+        break;
+    case AccessibilityRole::TextArea:
</ins><span class="cx">         traits |= [self _axTextAreaTrait];
</span><ins>+        break;
+    default:
+        break;
+    }
+
</ins><span class="cx">     return traits;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityisolatedtreeAXIsolatedObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp     2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp        2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -2136,12 +2136,6 @@
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AXIsolatedObject::shouldIgnoreAttributeRole() const
-{
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
</del><span class="cx"> bool AXIsolatedObject::canHaveChildren() 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 (278906 => 278907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h       2021-06-15 22:00:45 UTC (rev 278906)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h  2021-06-15 22:06:17 UTC (rev 278907)
</span><span class="lines">@@ -590,7 +590,6 @@
</span><span class="cx">     void addChildren() override;
</span><span class="cx">     void addChild(AXCoreObject*) override;
</span><span class="cx">     void insertChild(AXCoreObject*, unsigned) override;
</span><del>-    bool shouldIgnoreAttributeRole() const override;
</del><span class="cx">     bool canHaveChildren() const override;
</span><span class="cx">     bool hasChildren() const override { return boolAttributeValue(AXPropertyName::HasChildren); }
</span><span class="cx">     void setNeedsToUpdateChildren() override;
</span></span></pre>
</div>
</div>

</body>
</html>