Title: [289368] trunk/Source/WebCore
Revision
289368
Author
[email protected]
Date
2022-02-08 05:25:19 -0800 (Tue, 08 Feb 2022)

Log Message

AX: When updating the isolated tree with a remove and add of the same object, the wrapper is not re-attached
https://bugs.webkit.org/show_bug.cgi?id=236273

Reviewed by Andres Gonzalez.

In AXIsolatedTree::applyPendingChanges, we process node and subtree
removals before tree additions. When doing these removals, we detach
the object and wrapper from each other. This is fine unless that same
object is slated to be added again (e.g. it was moved in the DOM), as
we don't always re-attach a wrapper. [WebAccessibilityObjectWrapperBase axBackingObject]
will always return nil for objects in this state.

In this patch, when processing m_pendingAppends, we now attach a
wrapper to any object that has become `isDetached` (i.e. the object
has no wrapper, or the object has a wrapper but the wrapper does not
point at the object).

Fixes ~15 tests in isolated tree mode.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::applyPendingChanges):
* accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::isDetached const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289367 => 289368)


--- trunk/Source/WebCore/ChangeLog	2022-02-08 12:43:33 UTC (rev 289367)
+++ trunk/Source/WebCore/ChangeLog	2022-02-08 13:25:19 UTC (rev 289368)
@@ -1,3 +1,30 @@
+2022-02-08  Tyler Wilcock  <[email protected]>
+
+        AX: When updating the isolated tree with a remove and add of the same object, the wrapper is not re-attached
+        https://bugs.webkit.org/show_bug.cgi?id=236273
+
+        Reviewed by Andres Gonzalez.
+
+        In AXIsolatedTree::applyPendingChanges, we process node and subtree
+        removals before tree additions. When doing these removals, we detach
+        the object and wrapper from each other. This is fine unless that same
+        object is slated to be added again (e.g. it was moved in the DOM), as
+        we don't always re-attach a wrapper. [WebAccessibilityObjectWrapperBase axBackingObject]
+        will always return nil for objects in this state.
+
+        In this patch, when processing m_pendingAppends, we now attach a
+        wrapper to any object that has become `isDetached` (i.e. the object
+        has no wrapper, or the object has a wrapper but the wrapper does not
+        point at the object).
+
+        Fixes ~15 tests in isolated tree mode.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::applyPendingChanges):
+        * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
+        (WebCore::AXIsolatedObject::isDetached const):
+
 2022-02-08  Philippe Normand  <[email protected]>
 
         [GStreamer] Test webkit/WebKitWebView/display-usermedia-permission-request times out

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (289367 => 289368)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-02-08 12:43:33 UTC (rev 289367)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-02-08 13:25:19 UTC (rev 289368)
@@ -512,11 +512,13 @@
     m_childrenIDs.clear();
 }
 
+#if !PLATFORM(MAC)
 bool AXIsolatedObject::isDetached() const
 {
     ASSERT_NOT_REACHED();
     return false;
 }
+#endif
 
 void AXIsolatedObject::detachFromParent()
 {

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (289367 => 289368)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-02-08 12:43:33 UTC (rev 289367)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-02-08 13:25:19 UTC (rev 289368)
@@ -608,10 +608,10 @@
             m_readerThreadNodeMap.remove(axID);
         }
 
-        if (!item.isolatedObject->wrapper()) {
-            // The new object hasn't been attached a wrapper yet, so attach it.
+        // If the new object hasn't been attached to a wrapper yet, or if it was detached from
+        // the wrapper when processing removals above, we must attach / re-attach it.
+        if (item.isolatedObject->isDetached())
             item.isolatedObject->attachPlatformWrapper(wrapper.get());
-        }
 
         auto addResult = m_readerThreadNodeMap.add(axID, item.isolatedObject.get());
         // The newly added object must have a wrapper.

Modified: trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm (289367 => 289368)


--- trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2022-02-08 12:43:33 UTC (rev 289367)
+++ trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2022-02-08 13:25:19 UTC (rev 289368)
@@ -65,6 +65,11 @@
     });
 }
 
+bool AXIsolatedObject::isDetached() const
+{
+    return !wrapper() || [wrapper() axBackingObject] != this;
+}
+
 void AXIsolatedObject::attachPlatformWrapper(AccessibilityObjectWrapper* wrapper)
 {
     [wrapper attachIsolatedObject:this];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to