⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284687 in webkit


Ignore:
Timestamp:
Oct 22, 2021, 9:23:23 AM (5 years ago)
Author:
Ayumi Kojima
Message:

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

Location:
trunk/Source/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r284685 r284687  
     12021-10-22  Ayumi Kojima  <ayumi_kojima@apple.com>
     2
     3        Unreviewed, reverting r284606.
     4
     5        Reverting because this commit caused accessibility/ios-
     6        simulator/accessibility-aria-table-children.html to fail
     7
     8        Reverted changeset:
     9
     10        "AX: Any addition of children should funnel through
     11        AccessibilityObject::addChild"
     12        https://bugs.webkit.org/show_bug.cgi?id=231914
     13        https://commits.webkit.org/r284606
     14
    1152021-10-22  Ayumi Kojima  <ayumi_kojima@apple.com>
    216
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp

    r284606 r284687  
    6868    row.setRowIndex((int)m_rows.size());
    6969    m_rows.append(&row);
    70     addChild(&row);
     70
     71    // Try adding the row if it's not ignoring accessibility,
     72    // otherwise add its children (the cells) as the grid's children.
     73    if (!row.accessibilityIsIgnored())
     74        m_children.append(&row);
     75    else
     76        m_children.appendVector(row.children());
     77
    7178    appendedRows.add(&row);
    7279    return true;
     
    136143        column.setParent(this);
    137144        m_columns.append(&column);
    138         addChild(&column);
     145        if (!column.accessibilityIsIgnored())
     146            m_children.append(&column);
    139147    }
    140148
    141     addChild(headerContainer());
     149    auto* headerContainerObject = headerContainer();
     150    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
     151        m_children.append(headerContainerObject);
    142152}
    143153   
  • trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp

    r284606 r284687  
    7474    m_haveChildren = true;
    7575
    76     for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems())
    77         addChild(listBoxOptionAccessibilityObject(listItem));
     76    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
     77        AccessibilityObject* listOption = listBoxOptionAccessibilityObject(listItem);
     78        if (listOption && !listOption->accessibilityIsIgnored())
     79            m_children.append(listOption);
     80    }
    7881}
    7982
  • trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp

    r284606 r284687  
    8383
    8484    m_haveChildren = true;
    85     addChild(list);
     85    m_children.append(list);
     86
    8687    list->addChildren();
    8788}
  • trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp

    r284606 r284687  
    9797    m_haveChildren = true;
    9898
    99     for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems())
    100         addChild(menuListOptionAccessibilityObject(listItem));
     99    for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
     100        // FIXME: Why does AccessibilityListBox::addChildren check accessibilityIsIgnored but this does not?
     101        if (auto option = menuListOptionAccessibilityObject(listItem))
     102            m_children.append(option);
     103    }
    101104}
    102105
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r284675 r284687  
    484484        results.append(object);
    485485}
    486 
    487 #ifndef NDEBUG
    488 static bool isTableComponent(AXCoreObject& axObject)
    489 {
    490     return axObject.isTable() || axObject.isTableColumn() || axObject.isTableRow() || axObject.isTableCell();
    491 }
    492 #endif
    493 
     486   
    494487void AccessibilityObject::insertChild(AXCoreObject* child, unsigned index)
    495488{
     
    524517            m_children.insert(index + i, children[i]);
    525518    } else {
    526         // Table component child-parent relationships often don't line up properly, hence the need for methods
    527         // like parentTable() and parentRow(). Exclude them from this ASSERT.
    528         ASSERT((!isTableComponent(*child) && !isTableComponent(*this)) ? child->parentObject() == this : true);
     519        ASSERT(child->parentObject() == this);
    529520        m_children.insert(index, child);
    530521    }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r284675 r284687  
    32843284        areaObject.setParent(this);
    32853285        if (!areaObject.accessibilityIsIgnored())
    3286             addChild(&areaObject);
     3286            m_children.append(&areaObject);
    32873287        else
    32883288            axObjectCache()->remove(areaObject.objectID());
     
    33113311    axSpinButton.setSpinButtonElement(downcast<SpinButtonElement>(spinButtonElement));
    33123312    axSpinButton.setParent(this);
    3313     addChild(&axSpinButton);
     3313    m_children.append(&axSpinButton);
    33143314}
    33153315   
     
    33753375    // the parent must be set, because there's no other way to get back to who created the image.
    33763376    root->setParent(this);
    3377     addChild(root);
     3377   
     3378    if (root->accessibilityIsIgnored()) {
     3379        for (const auto& child : root->children())
     3380            m_children.append(child);
     3381    } else
     3382        m_children.append(root);
    33783383}
    33793384
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp

    r284606 r284687  
    164164    auto& scrollBarObject = downcast<AccessibilityScrollbar>(*cache->getOrCreate(scrollbar));
    165165    scrollBarObject.setParent(this);
    166     addChild(&scrollBarObject);
     166    m_children.append(&scrollBarObject);
    167167    return &scrollBarObject;
    168168}
  • trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp

    r284606 r284687  
    101101        cache->remove(thumb.objectID());
    102102    else
    103         addChild(&thumb);
     103        m_children.append(&thumb);
    104104}
    105105
  • trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp

    r284606 r284687  
    9292    incrementor.setIsIncrementor(true);
    9393    incrementor.setParent(this);
    94     addChild(&incrementor);
     94    m_children.append(&incrementor);
    9595
    9696    auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart));
    9797    decrementor.setIsIncrementor(false);
    9898    decrementor.setParent(this);
    99     addChild(&decrementor);
     99    m_children.append(&decrementor);
    100100}
    101101   
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r284606 r284687  
    395395        if (auto caption = tableElement->caption()) {
    396396            AccessibilityObject* axCaption = axObjectCache()->getOrCreate(caption.get());
    397             // While `addChild` won't insert ignored children, we still need this accessibilityIsIgnored
    398             // check so that `addChild` doesn't try to add the caption's children in its stead. Basically,
    399             // explicitly checking accessibilityIsIgnored() ignores the caption and any of its children.
    400397            if (axCaption && !axCaption->accessibilityIsIgnored())
    401                 addChild(axCaption);
     398                m_children.append(axCaption);
    402399        }
    403400    }
     
    424421        column.setParent(this);
    425422        m_columns.append(&column);
    426         addChild(&column);
    427     }
    428     addChild(headerContainer());
     423        if (!column.accessibilityIsIgnored())
     424            m_children.append(&column);
     425    }
     426
     427    auto* headerContainerObject = headerContainer();
     428    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
     429        m_children.append(headerContainerObject);
    429430
    430431    // Sometimes the cell gets the wrong role initially because it is created before the parent
     
    451452    row.setRowIndex(static_cast<int>(m_rows.size()));
    452453    m_rows.append(&row);
    453     addChild(&row);
     454    if (!row.accessibilityIsIgnored())
     455        m_children.append(&row);
    454456    appendedRows.add(&row);
    455457       
  • trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp

    r284606 r284687  
    203203            continue;
    204204           
    205         addChild(cell);
     205        m_children.append(cell);
    206206    }
    207207}
  • trunk/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp

    r284606 r284687  
    7474        return;
    7575
    76     for (auto& columnHeader : parentTable.columnHeaders())
    77         addChild(columnHeader.get());
     76    m_children = parentTable.columnHeaders();
    7877
    7978    for (const auto& child : m_children)
  • trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp

    r284606 r284687  
    110110    return nullptr;
    111111}
    112 
     112   
    113113AXCoreObject* AccessibilityTableRow::headerObject()
    114114{
     
    151151{
    152152    // If the element specifies its cells through aria-owns, return that first.
    153     AccessibilityChildrenVector ariaOwnedElements;
    154     ariaOwnsElements(ariaOwnedElements);
    155     if (ariaOwnedElements.size()) {
    156         for (auto& ariaOwnedElement : ariaOwnedElements)
    157             addChild(ariaOwnedElement.get());
    158     }
     153    AccessibilityChildrenVector ariaOwns;
     154    ariaOwnsElements(ariaOwns);
     155    if (ariaOwns.size())
     156        m_children = WTFMove(ariaOwns);
    159157    else
    160158        AccessibilityRenderObject::addChildren();
Note: See TracChangeset for help on using the changeset viewer.