NormalizeTextRange handles range that span ignored nodes
This change fixes an exception in NormalizeTextRange for the fringe case when the range's |start_| and |end_| positions span ignored nodes. Consider the following case: text1<start_>|IGNORED node|<end_>text2 Due to |start_| and |end_| positions spanning ignored nodes, after we call AsLeafTextPosition{Before|After}Character() in NormalizeTextRange() we will end up with |normalized_start| and |normalized_end| position inverted: <normalized_end>text1|IGNORED node|<normalized_start>text2 For this scenario, we want to collapse the normlized range and set the positions to |normalized_start|. --- New expected behavior --- Before NormalizeTextRange(): text1<start_>|IGNORED node|<end_>text2 After NormalizeTextRange(): text1|IGNORED node|<start_>text2 <end_> Bug: 1021443 Change-Id: I8d9039fef3c47ce46d9dae1e3838655b317af439 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918305Reviewed-by:Nektarios Paisios <nektar@chromium.org> Reviewed-by:
Adam Ettenberger <adettenb@microsoft.com> Commit-Queue: Victor Fei <vicfei@microsoft.com> Cr-Commit-Position: refs/heads/master@{#716853}
Showing
Please register or sign in to comment