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

Changeset 220042 in webkit


Ignore:
Timestamp:
Jul 29, 2017, 3:27:00 AM (9 years ago)
Author:
n_wang@apple.com
Message:

AX: findMatchingObjects doesn't work when the startObject is ignored
​https://bugs.webkit.org/show_bug.cgi?id=174965

Reviewed by Chris Fleizach.

Source/WebCore:

findMatchingObjects would return a wrong element if we pass in an ignored
start object. To fix this, we should use the closest accessible sibling as
the start object.

Test: accessibility/mac/search-predicate-from-ignored-element.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::appendChildrenToArray):

LayoutTests:

  • accessibility/mac/search-predicate-from-ignored-element-expected.txt: Added.
  • accessibility/mac/search-predicate-from-ignored-element.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220041 r220042  
     12017-07-29  Nan Wang  <n_wang@apple.com>
     2
     3        AX: findMatchingObjects doesn't work when the startObject is ignored
     4        https://bugs.webkit.org/show_bug.cgi?id=174965
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/mac/search-predicate-from-ignored-element-expected.txt: Added.
     9        * accessibility/mac/search-predicate-from-ignored-element.html: Added.
     10
    1112017-07-29  Aaron Chu  <aaron_chu@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r220041 r220042  
     12017-07-29  Nan Wang  <n_wang@apple.com>
     2
     3        AX: findMatchingObjects doesn't work when the startObject is ignored
     4        https://bugs.webkit.org/show_bug.cgi?id=174965
     5
     6        Reviewed by Chris Fleizach.
     7
     8        findMatchingObjects would return a wrong element if we pass in an ignored
     9        start object. To fix this, we should use the closest accessible sibling as
     10        the start object.
     11
     12        Test: accessibility/mac/search-predicate-from-ignored-element.html
     13
     14        * accessibility/AccessibilityObject.cpp:
     15        (WebCore::appendChildrenToArray):
     16
    1172017-07-29  Aaron Chu  <aaron_chu@apple.com>
    218
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r219751 r220042  
    611611    size_t endIndex = isForward ? 0 : childrenSize;
    612612
     613    // If the startObject is ignored, we should use an accessible sibling as a start element instead.
     614    if (startObject && startObject->accessibilityIsIgnored() && startObject->isDescendantOfObject(object)) {
     615        AccessibilityObject* parentObject = startObject->parentObject();
     616        // Go up the parent chain to find the highest ancestor that's also being ignored.
     617        while (parentObject && parentObject->accessibilityIsIgnored()) {
     618            if (parentObject == object)
     619                break;
     620            startObject = parentObject;
     621            parentObject = parentObject->parentObject();
     622        }
     623        // Get the un-ignored sibling based on the search direction, and update the searchPosition.
     624        while (startObject && startObject->accessibilityIsIgnored())
     625            startObject = isForward ? startObject->previousSibling() : startObject->nextSibling();
     626    }
     627   
    613628    size_t searchPosition = startObject ? searchChildren.find(startObject) : WTF::notFound;
     629   
    614630    if (searchPosition != WTF::notFound) {
    615631        if (isForward)
Note: See TracChangeset for help on using the changeset viewer.