Changeset 284606 in webkit
- Timestamp:
- Oct 21, 2021, 9:27:29 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
-
ChangeLog (modified) (1 diff)
-
accessibility/AccessibilityARIAGrid.cpp (modified) (2 diffs)
-
accessibility/AccessibilityListBox.cpp (modified) (1 diff)
-
accessibility/AccessibilityMenuList.cpp (modified) (1 diff)
-
accessibility/AccessibilityMenuListPopup.cpp (modified) (1 diff)
-
accessibility/AccessibilityObject.cpp (modified) (2 diffs)
-
accessibility/AccessibilityRenderObject.cpp (modified) (3 diffs)
-
accessibility/AccessibilityScrollView.cpp (modified) (1 diff)
-
accessibility/AccessibilitySlider.cpp (modified) (1 diff)
-
accessibility/AccessibilitySpinButton.cpp (modified) (1 diff)
-
accessibility/AccessibilityTable.cpp (modified) (3 diffs)
-
accessibility/AccessibilityTableColumn.cpp (modified) (1 diff)
-
accessibility/AccessibilityTableHeaderContainer.cpp (modified) (1 diff)
-
accessibility/AccessibilityTableRow.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r284604 r284606 1 2021-10-21 Tyler Wilcock <tyler_w@apple.com> 2 3 AX: Any addition of children should funnel through AccessibilityObject::addChild 4 https://bugs.webkit.org/show_bug.cgi?id=231914 5 6 Reviewed by Chris Fleizach. 7 8 All addition of children now goes through 9 AccessibilityObject::addChild. This is good for two reasons: 10 11 1. It ensures we aren't inserting ignored elements into the tree. 12 `insertChild` (downstream of `addChild`) checks this. Prior to this 13 patch, there were cases where we could insert ignored children into the 14 tree because no check was made. 15 16 2. We can reliably set state on the child based on the state of the 17 parent at insertion time. For example, children can set a flag if 18 any of their ancestors have an application or document role, which can 19 be useful for some AX clients. 20 21 * accessibility/AccessibilityARIAGrid.cpp: 22 (WebCore::AccessibilityARIAGrid::addTableCellChild): 23 (WebCore::AccessibilityARIAGrid::addChildren): 24 * accessibility/AccessibilityListBox.cpp: 25 (WebCore::AccessibilityListBox::addChildren): 26 * accessibility/AccessibilityMenuList.cpp: 27 (WebCore::AccessibilityMenuList::addChildren): 28 * accessibility/AccessibilityMenuListPopup.cpp: 29 (WebCore::AccessibilityMenuListPopup::addChildren): 30 * accessibility/AccessibilityObject.cpp: 31 (WebCore::isAutofillButton): 32 (WebCore::isTableComponent): 33 (WebCore::AccessibilityObject::insertChild): 34 * accessibility/AccessibilityRenderObject.cpp: 35 (WebCore::AccessibilityRenderObject::addImageMapChildren): 36 (WebCore::AccessibilityRenderObject::addTextFieldChildren): 37 (WebCore::AccessibilityRenderObject::addRemoteSVGChildren): 38 * accessibility/AccessibilityScrollView.cpp: 39 (WebCore::AccessibilityScrollView::addChildScrollbar): 40 * accessibility/AccessibilitySlider.cpp: 41 (WebCore::AccessibilitySlider::addChildren): 42 * accessibility/AccessibilitySpinButton.cpp: 43 (WebCore::AccessibilitySpinButton::addChildren): 44 * accessibility/AccessibilityTable.cpp: 45 (WebCore::AccessibilityTable::addChildren): 46 (WebCore::AccessibilityTable::addTableCellChild): 47 * accessibility/AccessibilityTableColumn.cpp: 48 (WebCore::AccessibilityTableColumn::addChildren): 49 * accessibility/AccessibilityTableHeaderContainer.cpp: 50 (WebCore::AccessibilityTableHeaderContainer::addChildren): 51 * accessibility/AccessibilityTableRow.cpp: 52 (WebCore::AccessibilityTableRow::addChildren): 53 1 54 2021-10-21 Antti Koivisto <antti@apple.com> 2 55 -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
r265514 r284606 68 68 row.setRowIndex((int)m_rows.size()); 69 69 m_rows.append(&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 70 addChild(&row); 78 71 appendedRows.add(&row); 79 72 return true; … … 143 136 column.setParent(this); 144 137 m_columns.append(&column); 145 if (!column.accessibilityIsIgnored()) 146 m_children.append(&column); 138 addChild(&column); 147 139 } 148 140 149 auto* headerContainerObject = headerContainer(); 150 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored()) 151 m_children.append(headerContainerObject); 141 addChild(headerContainer()); 152 142 } 153 143 -
trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp
r268454 r284606 74 74 m_haveChildren = true; 75 75 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 } 76 for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) 77 addChild(listBoxOptionAccessibilityObject(listItem)); 81 78 } 82 79 -
trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp
r277660 r284606 83 83 84 84 m_haveChildren = true; 85 m_children.append(list); 86 85 addChild(list); 87 86 list->addChildren(); 88 87 } -
trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
r266805 r284606 97 97 m_haveChildren = true; 98 98 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 } 99 for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) 100 addChild(menuListOptionAccessibilityObject(listItem)); 104 101 } 105 102 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r284529 r284606 484 484 results.append(object); 485 485 } 486 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 487 494 void AccessibilityObject::insertChild(AXCoreObject* child, unsigned index) 488 495 { … … 517 524 m_children.insert(index + i, children[i]); 518 525 } else { 519 ASSERT(child->parentObject() == this); 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); 520 529 m_children.insert(index, child); 521 530 } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r284524 r284606 3284 3284 areaObject.setParent(this); 3285 3285 if (!areaObject.accessibilityIsIgnored()) 3286 m_children.append(&areaObject);3286 addChild(&areaObject); 3287 3287 else 3288 3288 axObjectCache()->remove(areaObject.objectID()); … … 3317 3317 axSpinButton.setSpinButtonElement(downcast<SpinButtonElement>(spinButtonElement)); 3318 3318 axSpinButton.setParent(this); 3319 m_children.append(&axSpinButton);3319 addChild(&axSpinButton); 3320 3320 } 3321 3321 … … 3381 3381 // the parent must be set, because there's no other way to get back to who created the image. 3382 3382 root->setParent(this); 3383 3384 if (root->accessibilityIsIgnored()) { 3385 for (const auto& child : root->children()) 3386 m_children.append(child); 3387 } else 3388 m_children.append(root); 3383 addChild(root); 3389 3384 } 3390 3385 -
trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp
r284009 r284606 164 164 auto& scrollBarObject = downcast<AccessibilityScrollbar>(*cache->getOrCreate(scrollbar)); 165 165 scrollBarObject.setParent(this); 166 m_children.append(&scrollBarObject);166 addChild(&scrollBarObject); 167 167 return &scrollBarObject; 168 168 } -
trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp
r283269 r284606 101 101 cache->remove(thumb.objectID()); 102 102 else 103 m_children.append(&thumb);103 addChild(&thumb); 104 104 } 105 105 -
trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp
r265514 r284606 92 92 incrementor.setIsIncrementor(true); 93 93 incrementor.setParent(this); 94 m_children.append(&incrementor);94 addChild(&incrementor); 95 95 96 96 auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart)); 97 97 decrementor.setIsIncrementor(false); 98 98 decrementor.setParent(this); 99 m_children.append(&decrementor);99 addChild(&decrementor); 100 100 } 101 101 -
trunk/Source/WebCore/accessibility/AccessibilityTable.cpp
r277269 r284606 395 395 if (auto caption = tableElement->caption()) { 396 396 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. 397 400 if (axCaption && !axCaption->accessibilityIsIgnored()) 398 m_children.append(axCaption);401 addChild(axCaption); 399 402 } 400 403 } … … 421 424 column.setParent(this); 422 425 m_columns.append(&column); 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); 426 addChild(&column); 427 } 428 addChild(headerContainer()); 430 429 431 430 // Sometimes the cell gets the wrong role initially because it is created before the parent … … 452 451 row.setRowIndex(static_cast<int>(m_rows.size())); 453 452 m_rows.append(&row); 454 if (!row.accessibilityIsIgnored()) 455 m_children.append(&row); 453 addChild(&row); 456 454 appendedRows.add(&row); 457 455 -
trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp
r261729 r284606 203 203 continue; 204 204 205 m_children.append(cell);205 addChild(cell); 206 206 } 207 207 } -
trunk/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
r257200 r284606 74 74 return; 75 75 76 m_children = parentTable.columnHeaders(); 76 for (auto& columnHeader : parentTable.columnHeaders()) 77 addChild(columnHeader.get()); 77 78 78 79 for (const auto& child : m_children) -
trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp
r277269 r284606 110 110 return nullptr; 111 111 } 112 112 113 113 AXCoreObject* AccessibilityTableRow::headerObject() 114 114 { … … 151 151 { 152 152 // If the element specifies its cells through aria-owns, return that first. 153 AccessibilityChildrenVector ariaOwns; 154 ariaOwnsElements(ariaOwns); 155 if (ariaOwns.size()) 156 m_children = WTFMove(ariaOwns); 153 AccessibilityChildrenVector ariaOwnedElements; 154 ariaOwnsElements(ariaOwnedElements); 155 if (ariaOwnedElements.size()) { 156 for (auto& ariaOwnedElement : ariaOwnedElements) 157 addChild(ariaOwnedElement.get()); 158 } 157 159 else 158 160 AccessibilityRenderObject::addChildren();
Note:
See TracChangeset
for help on using the changeset viewer.