Title: [257903] trunk/Source/WebCore
- Revision
- 257903
- Author
- andresg...@apple.com
- Date
- 2020-03-04 23:00:19 -0800 (Wed, 04 Mar 2020)
Log Message
Fix for test accessibility/mac/aria-liveregions-addedelement.html in IsolatedTree mode.
https://bugs.webkit.org/show_bug.cgi?id=208624
Reviewed by Chris Fleizach.
Test: accessibility/mac/aria-liveregions-addedelement.html
LayoutTests can request the focused element before they call any method
in the WebAccessibilityObjectWrapper through AccessibilityController::focusedElement,
and thus the focused element may be amongst the pending appends of the
IsolatedTree. This change sets the focused element in the isolated
treee during generation, so it can be returned to the AccessibilityController
even if no WebAccessibilityObjectWrapper calls have been made.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::generateIsolatedTree):
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::focusedUIElement):
(WebCore::AXIsolatedTree::setFocusedNode):
* accessibility/isolatedtree/AXIsolatedTree.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (257902 => 257903)
--- trunk/Source/WebCore/ChangeLog 2020-03-05 06:38:23 UTC (rev 257902)
+++ trunk/Source/WebCore/ChangeLog 2020-03-05 07:00:19 UTC (rev 257903)
@@ -1,3 +1,26 @@
+2020-03-04 Andres Gonzalez <andresg...@apple.com>
+
+ Fix for test accessibility/mac/aria-liveregions-addedelement.html in IsolatedTree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=208624
+
+ Reviewed by Chris Fleizach.
+
+ Test: accessibility/mac/aria-liveregions-addedelement.html
+
+ LayoutTests can request the focused element before they call any method
+ in the WebAccessibilityObjectWrapper through AccessibilityController::focusedElement,
+ and thus the focused element may be amongst the pending appends of the
+ IsolatedTree. This change sets the focused element in the isolated
+ treee during generation, so it can be returned to the AccessibilityController
+ even if no WebAccessibilityObjectWrapper calls have been made.
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::generateIsolatedTree):
+ * accessibility/isolatedtree/AXIsolatedTree.cpp:
+ (WebCore::AXIsolatedTree::focusedUIElement):
+ (WebCore::AXIsolatedTree::setFocusedNode):
+ * accessibility/isolatedtree/AXIsolatedTree.h:
+
2020-03-04 Simon Fraser <simon.fra...@apple.com>
Make m_slowRepaintObjects a WeakHashSet
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (257902 => 257903)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2020-03-05 06:38:23 UTC (rev 257902)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2020-03-05 07:00:19 UTC (rev 257903)
@@ -3130,7 +3130,7 @@
auto* axFocus = axObjectCache->focusedObject(document);
if (axFocus)
- tree->setFocusedNodeID(axFocus->objectID());
+ tree->setFocusedNode(axFocus->objectID());
return makeRef(*tree);
}
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (257902 => 257903)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2020-03-05 06:38:23 UTC (rev 257902)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2020-03-05 07:00:19 UTC (rev 257903)
@@ -150,7 +150,6 @@
RefPtr<AXIsolatedObject> AXIsolatedTree::focusedUIElement()
{
- m_focusedNodeID = m_pendingFocusedNodeID;
return nodeForID(m_focusedNodeID);
}
@@ -166,6 +165,27 @@
m_readerThreadNodeMap.add(root->objectID(), WTFMove(root));
}
+void AXIsolatedTree::setFocusedNode(AXID axID)
+{
+ ASSERT(isMainThread());
+ LockHolder locker { m_changeLogLock };
+ m_focusedNodeID = axID;
+ if (axID == InvalidAXID)
+ return;
+
+ if (m_readerThreadNodeMap.contains(m_focusedNodeID))
+ return; // Nothing to do, the focus is set.
+
+ // If the focused object is in the pending appends, add it to the reader
+ // map, so that we can return the right focused object if requested before
+ // pending appends are applied.
+ for (const auto& item : m_pendingAppends) {
+ if (item.m_isolatedObject->objectID() == m_focusedNodeID
+ && m_readerThreadNodeMap.add(m_focusedNodeID, item.m_isolatedObject.get()) && item.m_wrapper)
+ m_readerThreadNodeMap.get(m_focusedNodeID)->attachPlatformWrapper(item.m_wrapper);
+ }
+}
+
void AXIsolatedTree::setFocusedNodeID(AXID axID)
{
LockHolder locker { m_changeLogLock };
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (257902 => 257903)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2020-03-05 06:38:23 UTC (rev 257902)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2020-03-05 07:00:19 UTC (rev 257903)
@@ -74,9 +74,15 @@
void removeNode(AXID);
void removeSubtree(AXID);
+ // Both setRootNode and setFocusedNode must be called only during the
+ // generation of the IsolatedTree.
+ // The focused node needs to be set during the generation because a request
+ // for it can come in before pending changes are applied. For focused node
+ // updates, use setFocusNodeID.
void setRootNode(Ref<AXIsolatedObject>&);
+ void setFocusedNode(AXID);
void setFocusedNodeID(AXID);
-
+
// Call on AX thread
void applyPendingChanges();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes