Changeset 164321 in webkit


Ignore:
Timestamp:
Feb 18, 2014, 2:39:45 PM (12 years ago)
Author:
Samuel White
Message:

AX: Searching for "immediate descendants only" can return unexpected results.
https://bugs.webkit.org/show_bug.cgi?id=128986

Reviewed by Chris Fleizach.

Source/WebCore:

Missed an application of the immediateDescendantsOnly flag during the initial implementation. We
need to make sure we don't decend into the startObject first if it is provided. This fix causes
the outer loop to 'skip' the first iteration so only siblings of the startObject are considered.

No new tests, updated existing search-predicate-immediate-descendants-only.html test to cover this case.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::findMatchingObjects):

LayoutTests:

Updated test and expectations to make sure the results match traditional "children" results when appropriate.

  • platform/mac/accessibility/search-predicate-immediate-descendants-only-expected.txt:
  • platform/mac/accessibility/search-predicate-immediate-descendants-only.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164316 r164321  
     12014-02-18  Samuel White  <samuel_white@apple.com>
     2
     3        AX: Searching for "immediate descendants only" can return unexpected results.
     4        https://bugs.webkit.org/show_bug.cgi?id=128986
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Updated test and expectations to make sure the results match traditional "children" results when appropriate.
     9
     10        * platform/mac/accessibility/search-predicate-immediate-descendants-only-expected.txt:
     11        * platform/mac/accessibility/search-predicate-immediate-descendants-only.html:
     12
    1132014-02-18  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/LayoutTests/platform/mac/accessibility/search-predicate-immediate-descendants-only-expected.txt

    r164165 r164321  
    44
    55
    6 PASS allDescendantsCount is 6
    7 PASS immediateDescendantsCount is 3
     6PASS allDescendantsCount is 25
     7PASS immediateDescendantsCount is 6
     8PASS immediateDescendantsCount is childrenCount
    89PASS successfullyParsed is true
    910
  • trunk/LayoutTests/platform/mac/accessibility/search-predicate-immediate-descendants-only.html

    r164165 r164321  
    88
    99<div id="container">
    10 <ul><li>immediate descendant</li><li><ul><li>distant descendant</li></ul></li></ul>
    11 <ul><li>immediate descendant</li><li><ul><li>distant descendant</li></ul></li></ul>
    12 <ul><li>immediate descendant</li><li><ul><li>distant descendant</li></ul></li></ul>
     10<h1>heading<img src="resources/cake.png" alt="Cake"></h1>
     11<p>text <a href="#">link</a></p>
     12<ul><li>item</li><li><ul><li>subitem</li></ul></li></ul>
    1313</div>
    1414
     
    2424       
    2525        // All descendants.
    26         var allDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXListSearchKey", "", false, false);
    27         shouldBe("allDescendantsCount", "6");
     26        var allDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXAnyTypeSearchKey", "", false, false);
     27        shouldBe("allDescendantsCount", "25");
    2828       
    29         // Immediate descendants.
    30         var immediateDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXListSearchKey", "", false, true);
    31         shouldBe("immediateDescendantsCount", "3");
     29        // Immeditate descendants.
     30        var immediateDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXAnyTypeSearchKey", "", false, true);
     31        shouldBe("immediateDescendantsCount", "6");
     32       
     33        // The number of immediate descendants should be equal to the number of children (when using "AXAnyTypeSearchKey").
     34        var childrenCount = containerElement.childrenCount;
     35        shouldBe("immediateDescendantsCount", "childrenCount");
    3236       
    3337        // Hide superfluous text.
  • trunk/Source/WebCore/ChangeLog

    r164320 r164321  
     12014-02-18  Samuel White  <samuel_white@apple.com>
     2
     3        AX: Searching for "immediate descendants only" can return unexpected results.
     4        https://bugs.webkit.org/show_bug.cgi?id=128986
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Missed an application of the immediateDescendantsOnly flag during the initial implementation. We
     9        need to make sure we don't decend into the startObject first if it is provided. This fix causes
     10        the outer loop to 'skip' the first iteration so only siblings of the startObject are considered.
     11
     12        No new tests, updated existing search-predicate-immediate-descendants-only.html test to cover this case.
     13
     14        * accessibility/AccessibilityObject.cpp:
     15        (WebCore::AccessibilityObject::findMatchingObjects):
     16
    1172014-02-18 Ryosuke Niwa <rniwa@webkit.org>
    218
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r164165 r164321  
    490490        // already behind/ahead of start element.
    491491        AccessibilityChildrenVector searchStack;
    492         appendChildrenToArray(startObject, isForward, previousObject, searchStack);
     492        if (!criteria->immediateDescendantsOnly || startObject == this)
     493            appendChildrenToArray(startObject, isForward, previousObject, searchStack);
    493494
    494495        // This now does a DFS at the current level of the parent.
Note: See TracChangeset for help on using the changeset viewer.