Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b4dc91691b737cb15d9afba686ae4127cd44352
      
https://github.com/WebKit/WebKit/commit/5b4dc91691b737cb15d9afba686ae4127cd44352
  Author: Tyler Wilcock <[email protected]>
  Date:   2024-04-17 (Wed, 17 Apr 2024)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-display/accessibility/display-contents-role-and-label-expected.txt
    M 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-display/accessibility/display-contents-role-and-label-expected.txt
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
    M Source/WebCore/accessibility/AccessibilityObject.cpp
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
    M Source/WebCore/accessibility/AccessibilityRenderObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

  Log Message:
  -----------
  AX: For children of display:contents elements, nextSibling() and 
previousSibling() can return non-siblings
https://bugs.webkit.org/show_bug.cgi?id=272606
rdar://problem/126376582

Reviewed by Chris Fleizach and Andres Gonzalez.

Prior to this patch, calling nextSibling() and previousSibling() on children of 
display:contents elements could return
non-siblings. This can cause the AX tree to be wrong, and for us to compute the 
wrong accessibility text, as computing
it requires walking the DOM / render tree via nextSibling().

This patch addresses this issue by ensuring that if we end up in a different 
display:contents container than we started
in, we stop traversing, as those are not our siblings.

To avoid having to maintain this state in the several places we iterate from 
firstChild() to nextSibling(), this logic
is encapsulated in two new iterators: AXSiblingIterator and AXChildIterator.

This allows us to pass four more WPT subtests in 
accessibility/display-contents-role-and-label.html.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-display/accessibility/display-contents-role-and-label-expected.txt:
* 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-display/accessibility/display-contents-role-and-label-expected.txt:
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::firstFocusableChild):
(WebCore::AXObjectCache::focusCurrentModal):
* Source/WebCore/accessibility/AXTreeIterator.h: Added.
(WebCore::AXChildIterator::AXChildIterator):
(WebCore::AXChildIterator::begin):
(WebCore::AXChildIterator::end):
(WebCore::AXSiblingIterator::AXSiblingIterator):
(WebCore::AXSiblingIterator::begin):
(WebCore::AXSiblingIterator::end):
(WebCore::AXSiblingIterator::rbegin):
(WebCore::AXSiblingIterator::rend):
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::shouldUseAccessibilityObjectInnerText):
(WebCore::AccessibilityNodeObject::textUnderElement const):
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::nextSiblingUnignored const):
(WebCore::AccessibilityObject::previousSiblingUnignored const):
(WebCore::Accessibility::appendChildrenToArray):
* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::nextSibling const):
(WebCore::AccessibilityRenderObject::addChildren):
* Source/WebCore/accessibility/AccessibilityRenderObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
Add missing includes that only compiled by happenstance due to the
makeup of the unified sources (broken with my addition of a new source).

Canonical link: https://commits.webkit.org/277651@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to