[editing] Fix NextVisuallyDistinctCandidateAlgorithm
NextVisuallyDistinctCandidateAlgorithm used to iterate forwards and return the first candidate whose MostForwardCaretPosition was different than the MostForwardCaretPosition of the original position. However, it could happen that the returned candidate and the original position had the same MostBackwardCaretPosition, leading to crashes. Therefore, this patch ensures that both the forward and backward caret positions of the candidate are different. And for consistency, the same is done for PreviousVisuallyDistinctCandidateAlgorithm, even though I couldn't find a problematic case. Bug: 1138054 TEST=VisibleUnitsTest.nextPositionOfTable Change-Id: I1e97e42765d58f5db70fb79410c8e471582a9d4d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2501041 Commit-Queue: Oriol Brufau <obrufau@igalia.com> Reviewed-by:Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#821711}
Showing
Please register or sign in to comment