• Ian Prest's avatar
    A11y: Fix hang in ElementProviderFromPoint · e2717b31
    Ian Prest authored
    As described in the bug, |ElementProviderFromPoint| was hanging when
    performing hit-testing on the PDF toolbar buttons.  Stepping through the
    code, it was apparent that the loop in that function was alternating
    between two different elements, and never exiting... but only when the
    monitor scale-factor was something other than 100%!
    
    Stepping a little deeper, it became apparent that the problem was in
    |BrowserAccessibilityManager::CachingAsyncHitTest|.  It is passing the
    |scaled_point| when it recurses on the |root_manager|, meaning that the
    point was getting scaled twice in that case.
    
    The result was that |CachingAsyncHitTest| would return a different
    element depending on whether you called it on the root manager or a
    child manager... and these were the two elements that we were
    alternating between in |ElementProviderFromPoint|.
    
    The solution is to pass the original |screen_point| to the recursive
    call.  (I also reordered the code to make the flow more obvious.)
    
    Bug: 1032299
    Change-Id: Ief01a2e961d14ad75eec3f1017a98c57f77613a3
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1957129Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
    Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
    Commit-Queue: Ian Prest <iapres@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#724032}
    e2717b31
browser_accessibility_manager_unittest.cc 67.5 KB