Title: [284687] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (284686 => 284687)


--- trunk/Source/WebCore/ChangeLog	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/ChangeLog	2021-10-22 16:23:23 UTC (rev 284687)
@@ -1,5 +1,19 @@
 2021-10-22  Ayumi Kojima  <ayumi_koj...@apple.com>
 
+        Unreviewed, reverting r284606.
+
+        Reverting because this commit caused accessibility/ios-
+        simulator/accessibility-aria-table-children.html to fail
+
+        Reverted changeset:
+
+        "AX: Any addition of children should funnel through
+        AccessibilityObject::addChild"
+        https://bugs.webkit.org/show_bug.cgi?id=231914
+        https://commits.webkit.org/r284606
+
+2021-10-22  Ayumi Kojima  <ayumi_koj...@apple.com>
+
         Unreviewed, reverting r284654.
 
         Reverting because this commit caused scrolling tests to fail

Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -67,7 +67,14 @@
     
     row.setRowIndex((int)m_rows.size());
     m_rows.append(&row);
-    addChild(&row);
+
+    // Try adding the row if it's not ignoring accessibility,
+    // otherwise add its children (the cells) as the grid's children.
+    if (!row.accessibilityIsIgnored())
+        m_children.append(&row);
+    else
+        m_children.appendVector(row.children());
+
     appendedRows.add(&row);
     return true;
 }
@@ -135,10 +142,13 @@
         column.setColumnIndex(i);
         column.setParent(this);
         m_columns.append(&column);
-        addChild(&column);
+        if (!column.accessibilityIsIgnored())
+            m_children.append(&column);
     }
 
-    addChild(headerContainer());
+    auto* headerContainerObject = headerContainer();
+    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
+        m_children.append(headerContainerObject);
 }
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -73,8 +73,11 @@
 
     m_haveChildren = true;
 
-    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems())
-        addChild(listBoxOptionAccessibilityObject(listItem));
+    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
+        AccessibilityObject* listOption = listBoxOptionAccessibilityObject(listItem);
+        if (listOption && !listOption->accessibilityIsIgnored())
+            m_children.append(listOption);
+    }
 }
 
 void AccessibilityListBox::setSelectedChildren(const AccessibilityChildrenVector& children)

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -82,7 +82,8 @@
     }
 
     m_haveChildren = true;
-    addChild(list);
+    m_children.append(list);
+
     list->addChildren();
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -96,8 +96,11 @@
 
     m_haveChildren = true;
 
-    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems())
-        addChild(menuListOptionAccessibilityObject(listItem));
+    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
+        // FIXME: Why does AccessibilityListBox::addChildren check accessibilityIsIgnored but this does not?
+        if (auto option = menuListOptionAccessibilityObject(listItem))
+            m_children.append(option);
+    }
 }
 
 void AccessibilityMenuListPopup::childrenChanged()

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -483,14 +483,7 @@
     if (object)
         results.append(object);
 }
-
-#ifndef NDEBUG
-static bool isTableComponent(AXCoreObject& axObject)
-{
-    return axObject.isTable() || axObject.isTableColumn() || axObject.isTableRow() || axObject.isTableCell();
-}
-#endif
-
+    
 void AccessibilityObject::insertChild(AXCoreObject* child, unsigned index)
 {
     if (!child)
@@ -523,9 +516,7 @@
         for (size_t i = 0; i < length; ++i)
             m_children.insert(index + i, children[i]);
     } else {
-        // Table component child-parent relationships often don't line up properly, hence the need for methods
-        // like parentTable() and parentRow(). Exclude them from this ASSERT.
-        ASSERT((!isTableComponent(*child) && !isTableComponent(*this)) ? child->parentObject() == this : true);
+        ASSERT(child->parentObject() == this);
         m_children.insert(index, child);
     }
     

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -3283,7 +3283,7 @@
         areaObject.setHTMLMapElement(map);
         areaObject.setParent(this);
         if (!areaObject.accessibilityIsIgnored())
-            addChild(&areaObject);
+            m_children.append(&areaObject);
         else
             axObjectCache()->remove(areaObject.objectID());
     }
@@ -3310,7 +3310,7 @@
     auto& axSpinButton = downcast<AccessibilitySpinButton>(*axObjectCache()->create(AccessibilityRole::SpinButton));
     axSpinButton.setSpinButtonElement(downcast<SpinButtonElement>(spinButtonElement));
     axSpinButton.setParent(this);
-    addChild(&axSpinButton);
+    m_children.append(&axSpinButton);
 }
     
 bool AccessibilityRenderObject::isSVGImage() const
@@ -3374,7 +3374,12 @@
     // In order to connect the AX hierarchy from the SVG root element from the loaded resource
     // the parent must be set, because there's no other way to get back to who created the image.
     root->setParent(this);
-    addChild(root);
+    
+    if (root->accessibilityIsIgnored()) {
+        for (const auto& child : root->children())
+            m_children.append(child);
+    } else
+        m_children.append(root);
 }
 
 void AccessibilityRenderObject::addCanvasChildren()

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -163,7 +163,7 @@
 
     auto& scrollBarObject = downcast<AccessibilityScrollbar>(*cache->getOrCreate(scrollbar));
     scrollBarObject.setParent(this);
-    addChild(&scrollBarObject);
+    m_children.append(&scrollBarObject);
     return &scrollBarObject;
 }
         

Modified: trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -100,7 +100,7 @@
     if (thumb.accessibilityIsIgnored())
         cache->remove(thumb.objectID());
     else
-        addChild(&thumb);
+        m_children.append(&thumb);
 }
 
 const AtomString& AccessibilitySlider::getAttribute(const QualifiedName& attribute) const

Modified: trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -91,12 +91,12 @@
     auto& incrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart));
     incrementor.setIsIncrementor(true);
     incrementor.setParent(this);
-    addChild(&incrementor);
+    m_children.append(&incrementor);
 
     auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart));
     decrementor.setIsIncrementor(false);
     decrementor.setParent(this);
-    addChild(&decrementor);
+    m_children.append(&decrementor);
 }
     
 void AccessibilitySpinButton::step(int amount)

Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -394,11 +394,8 @@
     if (HTMLTableElement* tableElement = this->tableElement()) {
         if (auto caption = tableElement->caption()) {
             AccessibilityObject* axCaption = axObjectCache()->getOrCreate(caption.get());
-            // While `addChild` won't insert ignored children, we still need this accessibilityIsIgnored
-            // check so that `addChild` doesn't try to add the caption's children in its stead. Basically,
-            // explicitly checking accessibilityIsIgnored() ignores the caption and any of its children.
             if (axCaption && !axCaption->accessibilityIsIgnored())
-                addChild(axCaption);
+                m_children.append(axCaption);
         }
     }
 
@@ -423,10 +420,14 @@
         column.setColumnIndex(i);
         column.setParent(this);
         m_columns.append(&column);
-        addChild(&column);
+        if (!column.accessibilityIsIgnored())
+            m_children.append(&column);
     }
-    addChild(headerContainer());
 
+    auto* headerContainerObject = headerContainer();
+    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
+        m_children.append(headerContainerObject);
+
     // Sometimes the cell gets the wrong role initially because it is created before the parent
     // determines whether it is an accessibility table. Iterate all the cells and allow them to
     // update their roles now that the table knows its status.
@@ -450,7 +451,8 @@
     
     row.setRowIndex(static_cast<int>(m_rows.size()));
     m_rows.append(&row);
-    addChild(&row);
+    if (!row.accessibilityIsIgnored())
+        m_children.append(&row);
     appendedRows.add(&row);
         
     // store the maximum number of columns

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -202,7 +202,7 @@
         if (m_children.size() > 0 && m_children.last() == cell)
             continue;
             
-        addChild(cell);
+        m_children.append(cell);
     }
 }
     

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -73,8 +73,7 @@
     if (!parentTable.isExposable())
         return;
 
-    for (auto& columnHeader : parentTable.columnHeaders())
-        addChild(columnHeader.get());
+    m_children = parentTable.columnHeaders();
 
     for (const auto& child : m_children)
         m_headerRect.unite(child->elementRect());

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp (284686 => 284687)


--- trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp	2021-10-22 16:05:19 UTC (rev 284686)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp	2021-10-22 16:23:23 UTC (rev 284687)
@@ -109,7 +109,7 @@
     
     return nullptr;
 }
-
+    
 AXCoreObject* AccessibilityTableRow::headerObject()
 {
     if (!m_renderer || !m_renderer->isTableRow())
@@ -150,12 +150,10 @@
 void AccessibilityTableRow::addChildren()
 {
     // If the element specifies its cells through aria-owns, return that first.
-    AccessibilityChildrenVector ariaOwnedElements;
-    ariaOwnsElements(ariaOwnedElements);
-    if (ariaOwnedElements.size()) {
-        for (auto& ariaOwnedElement : ariaOwnedElements)
-            addChild(ariaOwnedElement.get());
-    }
+    AccessibilityChildrenVector ariaOwns;
+    ariaOwnsElements(ariaOwns);
+    if (ariaOwns.size())
+        m_children = WTFMove(ariaOwns);
     else
         AccessibilityRenderObject::addChildren();
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to