Title: [257948] trunk/Source/WebCore
Revision
257948
Author
andresg...@apple.com
Date
2020-03-05 14:50:32 -0800 (Thu, 05 Mar 2020)

Log Message

Fix for several failures of LayoutTests in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=208658

Reviewed by Chris Fleizach.

- Exposes the scrollView method through the AXCoreObject interface so
that wrapper code can use it for both AXObjects and IsolatedObjects.
- Fix for a crash/assert where InvalidAXID cannot be passed as key to
the HashMap methods.

* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityScrollView.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::scrollView const):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::applyPendingChanges):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper scrollViewParent]):
(-[WebAccessibilityObjectWrapper _accessibilityShowContextMenu]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257947 => 257948)


--- trunk/Source/WebCore/ChangeLog	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/ChangeLog	2020-03-05 22:50:32 UTC (rev 257948)
@@ -1,3 +1,27 @@
+2020-03-05  Andres Gonzalez  <andresg...@apple.com>
+
+        Fix for several failures of LayoutTests in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=208658
+
+        Reviewed by Chris Fleizach.
+
+        - Exposes the scrollView method through the AXCoreObject interface so
+        that wrapper code can use it for both AXObjects and IsolatedObjects.
+        - Fix for a crash/assert where InvalidAXID cannot be passed as key to
+        the HashMap methods.
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityObjectInterface.h:
+        * accessibility/AccessibilityScrollView.h:
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::scrollView const):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::applyPendingChanges):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper scrollViewParent]):
+        (-[WebAccessibilityObjectWrapper _accessibilityShowContextMenu]):
+
 2020-03-05  Jacob Uphoff  <jacob_uph...@apple.com>
 
         Unreviewed, rolling out r257945.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (257947 => 257948)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-03-05 22:50:32 UTC (rev 257948)
@@ -466,6 +466,7 @@
     Frame* frame() const override;
     Frame* mainFrame() const override;
     Document* topDocument() const override;
+    ScrollView* scrollView() const override { return nullptr; }
     ScrollView* scrollViewAncestor() const override;
     String language() const override;
     // 1-based, to match the aria-level spec.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (257947 => 257948)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2020-03-05 22:50:32 UTC (rev 257948)
@@ -875,6 +875,7 @@
     virtual Frame* frame() const = 0;
     virtual Frame* mainFrame() const = 0;
     virtual Document* topDocument() const = 0;
+    virtual ScrollView* scrollView() const = 0;
     virtual ScrollView* scrollViewAncestor() const = 0;
     virtual String language() const = 0;
     // 1-based, to match the aria-level spec.

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollView.h (257947 => 257948)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollView.h	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollView.h	2020-03-05 22:50:32 UTC (rev 257948)
@@ -37,7 +37,7 @@
 public:
     static Ref<AccessibilityScrollView> create(ScrollView*);
     AccessibilityRole roleValue() const override { return AccessibilityRole::ScrollArea; }
-    ScrollView* scrollView() const { return m_scrollView; }
+    ScrollView* scrollView() const override { return m_scrollView; }
 
     virtual ~AccessibilityScrollView();
 

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (257947 => 257948)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-03-05 22:50:32 UTC (rev 257948)
@@ -1611,6 +1611,13 @@
     return nullptr;
 }
 
+ScrollView* AXIsolatedObject::scrollView() const
+{
+    if (auto* object = associatedAXObject())
+        return object->scrollView();
+    return nullptr;
+}
+
 ScrollView* AXIsolatedObject::scrollViewAncestor() const
 {
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (257947 => 257948)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-03-05 22:50:32 UTC (rev 257948)
@@ -827,6 +827,7 @@
     Frame* frame() const override;
     Frame* mainFrame() const override;
     Document* topDocument() const override;
+    ScrollView* scrollView() const override;
     ScrollView* scrollViewAncestor() const override;
     void childrenChanged() override;
     void textChanged() override;

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (257947 => 257948)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-03-05 22:50:32 UTC (rev 257948)
@@ -228,6 +228,9 @@
     m_focusedNodeID = m_pendingFocusedNodeID;
 
     for (const auto& axID : m_pendingRemovals) {
+        if (axID == InvalidAXID)
+            continue;
+
         if (auto object = nodeForID(axID))
             object->detach(AccessibilityDetachmentType::ElementDestroyed);
         m_readerThreadNodeMap.remove(axID);
@@ -236,6 +239,8 @@
 
     for (const auto& item : m_pendingAppends) {
         AXID axID = item.m_isolatedObject->objectID();
+        if (axID == InvalidAXID)
+            continue;
 
         if (m_readerThreadNodeMap.get(axID) != &item.m_isolatedObject.get()) {
             // The new IsolatedObject is a replacement for an existing object

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (257947 => 257948)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-03-05 22:32:56 UTC (rev 257947)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-03-05 22:50:32 UTC (rev 257948)
@@ -2271,15 +2271,16 @@
 - (id)scrollViewParent
 {
     return Accessibility::retrieveAutoreleasedValueFromMainThread<id>([protectedSelf = RetainPtr<WebAccessibilityObjectWrapper>(self)] () -> RetainPtr<id> {
-        if (!is<AccessibilityScrollView>(protectedSelf.get().axBackingObject))
+        auto* backingObject = protectedSelf.get().axBackingObject;
+        if (!backingObject || !backingObject->isScrollView())
             return nil;
 
         // If this scroll view provides it's parent object (because it's a sub-frame), then
         // we should not find the remoteAccessibilityParent.
-        if (protectedSelf.get().axBackingObject->parentObject())
+        if (backingObject->parentObject())
             return nil;
 
-        ScrollView* scroll = downcast<AccessibilityScrollView>(*protectedSelf.get().axBackingObject).scrollView();
+        auto* scroll = backingObject->scrollView();
         if (!scroll)
             return nil;
 
@@ -3421,8 +3422,8 @@
     if (frameView) {
         // Find the appropriate scroll view to use to convert the contents to the window.
         for (auto* parent = self.axBackingObject->parentObject(); parent; parent = parent->parentObject()) {
-            if (is<AccessibilityScrollView>(*parent)) {
-                if (auto scrollView = downcast<AccessibilityScrollView>(*parent).scrollView()) {
+            if (parent->isScrollView()) {
+                if (auto* scrollView = parent->scrollView()) {
                     if (!frameView->platformWidget())
                         rect = scrollView->contentsToRootView(rect);
                     else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to