Title: [264784] trunk/Source/WebCore
Revision
264784
Author
andresg...@apple.com
Date
2020-07-23 13:00:43 -0700 (Thu, 23 Jul 2020)

Log Message

Update the isolated tree even when there is no client request.
https://bugs.webkit.org/show_bug.cgi?id=214692

Reviewed by Chris Fleizach.

AXObjectCache::updateIsolatedTree was checking for isIsolatedTreeEnabled,
which in turn checks for whether the clientSupportsIsolatedTree. Often
at the time updateIsolatedTree is called, there is no client request
since client requests and updates occur in separate threads,
independently from each other. Thus the isolated tree wasn't being
updated. This patch removes the check for isIsolatedTreeEnabled and rely
on the presence of an isolated tree for the given PageID to perform the
update.
In addition, added an update of the isolated tree for AXLoadingEvent::AXLoadingFinished.
This fixes several instance of dynamic content page changes that were
not being reflected on the isolated tree.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::clientSupportsIsolatedTree): Some logging.
(WebCore::AXObjectCache::isIsolatedTreeEnabled): Some logging.
(WebCore::AXObjectCache::frameLoadingEventNotification): Calls updateIsolatedTree.
(WebCore::AXObjectCache::updateIsolatedTree): Handles AXLoadingEvents.
* accessibility/AXObjectCache.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (264783 => 264784)


--- trunk/Source/WebCore/ChangeLog	2020-07-23 19:46:11 UTC (rev 264783)
+++ trunk/Source/WebCore/ChangeLog	2020-07-23 20:00:43 UTC (rev 264784)
@@ -1,3 +1,29 @@
+2020-07-23  Andres Gonzalez  <andresg...@apple.com>
+
+        Update the isolated tree even when there is no client request.
+        https://bugs.webkit.org/show_bug.cgi?id=214692
+
+        Reviewed by Chris Fleizach.
+
+        AXObjectCache::updateIsolatedTree was checking for isIsolatedTreeEnabled,
+        which in turn checks for whether the clientSupportsIsolatedTree. Often
+        at the time updateIsolatedTree is called, there is no client request
+        since client requests and updates occur in separate threads,
+        independently from each other. Thus the isolated tree wasn't being
+        updated. This patch removes the check for isIsolatedTreeEnabled and rely
+        on the presence of an isolated tree for the given PageID to perform the
+        update.
+        In addition, added an update of the isolated tree for AXLoadingEvent::AXLoadingFinished.
+        This fixes several instance of dynamic content page changes that were
+        not being reflected on the isolated tree.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::clientSupportsIsolatedTree): Some logging.
+        (WebCore::AXObjectCache::isIsolatedTreeEnabled): Some logging.
+        (WebCore::AXObjectCache::frameLoadingEventNotification): Calls updateIsolatedTree.
+        (WebCore::AXObjectCache::updateIsolatedTree): Handles AXLoadingEvents.
+        * accessibility/AXObjectCache.h:
+
 2020-07-23  Clark Wang  <clark_w...@apple.com>
 
         Added PeriodicWave constructor according to spec

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (264783 => 264784)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-07-23 19:46:11 UTC (rev 264783)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-07-23 20:00:43 UTC (rev 264784)
@@ -700,19 +700,25 @@
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
 bool AXObjectCache::clientSupportsIsolatedTree()
 {
+    AXTRACE("AXObjectCache::clientSupportsIsolatedTree");
+
     if (!RuntimeEnabledFeatures::sharedFeatures().isAccessibilityIsolatedTreeEnabled())
         return false;
 
+    AXLOG(makeString("_AXGetClientForCurrentRequestUntrusted = ", static_cast<unsigned>(_AXGetClientForCurrentRequestUntrusted())));
     return _AXGetClientForCurrentRequestUntrusted() == kAXClientTypeVoiceOver;
 }
 
 bool AXObjectCache::isIsolatedTreeEnabled()
 {
+    AXTRACE("AXObjectCache::isIsolatedTreeEnabled");
+
     if (UNLIKELY(_AXGetClientForCurrentRequestUntrusted() == kAXClientTypeWebKitTesting))
         return true;
 
     // If isolated tree mode is on, return true whether the client supports
     // isolated tree mode or the call is off of the main thread.
+    AXLOG(makeString("_AXSIsolatedTreeMode = ", _AXSIsolatedTreeModeFunctionIsAvailable() ? _AXSIsolatedTreeMode_Soft() : 0));
     return _AXSIsolatedTreeModeFunctionIsAvailable() && _AXSIsolatedTreeMode_Soft() != AXSIsolatedTreeModeOff
         && (!isMainThread() || clientSupportsIsolatedTree());
 }
@@ -1540,6 +1546,11 @@
         return;
 
     AccessibilityObject* obj = getOrCreate(contentRenderer);
+
+#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+    updateIsolatedTree(*obj, loadingEvent);
+#endif
+
     frameLoadingEventPlatformNotification(obj, loadingEvent);
 }
 
@@ -3137,19 +3148,19 @@
 void AXObjectCache::updateIsolatedTree(AXCoreObject& object, AXNotification notification)
 {
     AXTRACE("AXObjectCache::updateIsolatedTree");
-
-    if (!isIsolatedTreeEnabled())
-        return;
-
     AXLOG(std::make_pair(&object, notification));
     AXLOG(*this);
 
-    if (!m_pageID || object.objectID() == InvalidAXID)
+    if (!m_pageID || object.objectID() == InvalidAXID) {
+        AXLOG("No pageID or objectID");
         return;
+    }
 
     auto tree = AXIsolatedTree::treeForPageID(*m_pageID);
-    if (!tree)
+    if (!tree) {
+        AXLOG("No isolated tree for m_pageID.");
         return;
+    }
 
     switch (notification) {
     case AXCheckedStateChanged:
@@ -3165,6 +3176,13 @@
     }
 }
 
+void AXObjectCache::updateIsolatedTree(AXCoreObject& object, AXLoadingEvent notification)
+{
+    AXTRACE("AXObjectCache::updateIsolatedTree");
+    if (notification == AXLoadingFinished)
+        updateIsolatedTree(object, AXChildrenChanged);
+}
+
 // FIXME: should be added to WTF::Vector.
 template<typename T, typename F>
 static bool appendIfNotContainsMatching(Vector<T>& vector, const T& value, F matches)
@@ -3178,18 +3196,18 @@
 void AXObjectCache::updateIsolatedTree(const Vector<std::pair<RefPtr<AXCoreObject>, AXNotification>>& notifications)
 {
     AXTRACE("AXObjectCache::updateIsolatedTree");
-
-    if (!isIsolatedTreeEnabled())
-        return;
-
     AXLOG(*this);
 
-    if (!m_pageID)
+    if (!m_pageID) {
+        AXLOG("No pageID.");
         return;
+    }
 
     auto tree = AXIsolatedTree::treeForPageID(*m_pageID);
-    if (!tree)
+    if (!tree) {
+        AXLOG("No isolated tree for m_pageID");
         return;
+    }
 
     // Filter out multiple notifications for the same object. This avoids
     // updating the isolated tree multiple times unnecessarily.

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (264783 => 264784)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-07-23 19:46:11 UTC (rev 264783)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-07-23 20:00:43 UTC (rev 264784)
@@ -370,6 +370,7 @@
     static Ref<AXIsolatedTree> generateIsolatedTree(PageIdentifier, Document&);
     RefPtr<AXIsolatedTree> getOrCreateIsolatedTree() const;
     void updateIsolatedTree(AXCoreObject&, AXNotification);
+    void updateIsolatedTree(AXCoreObject&, AXLoadingEvent);
     void updateIsolatedTree(const Vector<std::pair<RefPtr<AXCoreObject>, AXNotification>>&);
     static void initializeSecondaryAXThread();
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to