• Ethan Jimenez's avatar
    Fix CreateNextLineStartPosition and CreatePreviousLineEndPosition · 7934ec52
    Ethan Jimenez authored
    1. There was a bug in `AXPosition::CreateNextLineStartPosition` where we
       assumed that, after moving past the end of an `AXTree` not finding a
       next line start, the end of the original anchor would be the same as
       the end of the entire tree's text representation.
    
       This was not true if the last line of the text representation was
       composed by multiple anchors and the function was called from a leaf
       text position located at one of such anchors other than the last.
    
       Fixing such issue by returning `CreatePositionAtEndOfAnchor` from the
       last leaf text position of the `AXTree` (rooted at the original
       position's anchor if the result is its descendant).
    
       The same bug was present in `CreatePreviousLineEndPosition`, but in
       the inverted scenario of the previous line end of the first line.
    
    2. Adding unit test to cover the scenario mentioned above.
    
    Bug: 928948
    Change-Id: I7c98aa5ae6d881cc884cd2fc8bf517780e82dccf
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747854
    Commit-Queue: Ethan Jimenez <ethavar@microsoft.com>
    Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
    Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#686547}
    7934ec52
ax_node_position_unittest.cc 266 KB