Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
AX: Refactor implementation of AX object relationships.
https://bugs.webkit.org/show_bug.cgi?id=240842 Reviewed by Chris Fleizach and Tyler Wilcock. Test: accessibility/grid-with-aria-owned-cells.html Relationships between AX objects were being computed by the methods AccessibilityObject::ariaElementsFromAttribute and ariaElementsReferencedByAttribute, both of which performed walks of the DOM tree to match ids between origin and target of a specific relationship, having a significant performance impact when called repeatedly. With this patch, these two methods are replaced with a single method, AccessibilityObject::relatedObjects, that in turn calls AXObjectCache::relatedObjectsFor. This AXObjectCache method computes and caches all relationships in one walk of the DoM tree. The cache is updated when relevant event notifications are received. This makes support of relationships between objects more efficient, and the code clearer. The test added exercises this implementation of relationships via the aria-owns attribute to relate table rows to their cells. The execution time of this test before this change was estimated in one system at about 1.91s, and after the change was reduced to 1.87s. * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::objectsForIDs const): (WebCore::AXObjectCache::handleActiveDescendantChanged): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::relationAttributes): (WebCore::AXObjectCache::symmetricRelation): (WebCore::AXObjectCache::attributeToRelationType): (WebCore::AXObjectCache::addRelation): (WebCore::AXObjectCache::updateRelationsIfNeeded): (WebCore::AXObjectCache::relatedObjectsFor): * Source/WebCore/accessibility/AXObjectCache.h: (WebCore::AXObjectCache::relationsNeedUpdate): * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::relatedObjects const): (WebCore::AccessibilityObject::activeDescendantOfObjects const): (WebCore::AccessibilityObject::controlledObjects const): (WebCore::AccessibilityObject::controllers const): (WebCore::AccessibilityObject::describedByObjects const): (WebCore::AccessibilityObject::descriptionForObjects const): (WebCore::AccessibilityObject::detailedByObjects const): (WebCore::AccessibilityObject::detailsForObjects const): (WebCore::AccessibilityObject::errorMessageObjects const): (WebCore::AccessibilityObject::errorMessageForObjects const): (WebCore::AccessibilityObject::flowToObjects const): (WebCore::AccessibilityObject::flowFromObjects const): (WebCore::AccessibilityObject::labelledByObjects const): (WebCore::AccessibilityObject::labelForObjects const): (WebCore::AccessibilityObject::ownedObjects const): (WebCore::AccessibilityObject::owners const): (WebCore::AccessibilityObject::ariaElementsFromAttribute const): Deleted. (WebCore::AccessibilityObject::ariaElementsReferencedByAttribute const): Deleted. * Source/WebCore/accessibility/AccessibilityObject.h: * Source/WebCore/accessibility/AccessibilityObjectInterface.h: (WebCore::Accessibility::findRelatedObjectInAncestry): * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::activeDescendant const): * Source/WebCore/accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::columnHeaders): * Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp: (WebCore::AccessibilityObjectAtspi::relationMap const): * Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]): * LayoutTests/accessibility/grid-with-aria-owned-cells-expected.txt: Added. * LayoutTests/accessibility/grid-with-aria-owned-cells.html: Added. Canonical link: https://commits.webkit.org/251008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information