[editing] Ranges with equivalent positions should be collapsed
Before this patch, for an ephemeral range created with different but equivalent positions, IsCollapsed() would return false. Analogously, for a selection created with an extent different than but equivalent to the the base, IsCaret() would return false. This could result in SelectionTypeAdjuster::AdjustSelection trying to create an ephemeral range with an end position preceding the start one, producing a DCHECK failure. Therefore, this patch changes the EphemeralRangeTemplate constructor and SelectionTemplate::Builder::Extend so that the end (or extent) position is set to the start (or base) one if they are equivalent. However, this is not done if the start (or base) position is a <br>, since editing/deleting/delete_after_block_image.html would fail. Bug: 1143292 TEST=EphemeralRangeTest.EquivalentPositions TEST=SelectionTest.EquivalentPositions Change-Id: I3e9194b09c4bda893c05a70fdae858aa6aa22f21 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550834 Commit-Queue: Oriol Brufau <obrufau@igalia.com> Reviewed-by:Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#832687}
Showing
Please register or sign in to comment