Closed Bug 1774330 Opened 2 years ago Closed 2 years ago

[CTW] Hit testing can return a descendant from a different subtree

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: Jamie, Assigned: morgan)

References

Details

Attachments

(1 file)

STR:

  1. Open this test case:
    data:text/html,<h1>A</h1><h1>B</h1>
  2. Get the top left coordinate for A.
  3. Get the Accessible for B.
  4. Call ChildAtPoint on B (step 3), passing the coordinates for A (step 2).
    • Expected: null
    • Actual: The Accessible for A

The ordering of the viewport cache and the way we walk it guarantees that we won't return a child which is shallower in the tree; i.e. has a lower z-index. However, it guarantees nothing about the same z-index in a completely different subtree. Normally, this isn't a problem because you don't normally hit test in one subtree with coordinates from another; you normally hit test on an ancestor with coordinates inside that ancestor. However, for correctness, we should probably fix this.

I think we can just verify that the descendant we're returning is really a descendant of this; i.e. return null if !this->IsAncestorOf(result).

I think this bug is causing our out of flow tests to fail in some configurations. I guess that makes sense: there's nothing preventing us from returning an out of flow node if the out of flow node occurs first in the viewport cache. That said, that does mean that if you hit test from the root, whether or not you get the out of flow node depends on the configuration, which is weird.

Actually, we should probably check IsAncestorOf on any Accessible we match. This should handle the out of flow case properly and let it keep walking the viewport candidates.

Assignee: nobody → mreschenberg
Pushed by mreschenberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b9f4e162223c
Only return ancestors from ChildAtPoint r=eeejay
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: