Prevent break opportunity offset to surpass the item's range_end #25601
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When exploring breaking opportunities we were early return, and shaping
to the end, when we detected that current candidate overflow and next
breaking opportunity surpass the item's range end.
However, since we landed in r807457 the new TextBreakIterator's
behavior of breaking always after the space run, we can get some
opportunities that surpass the item's range_end even if the candidate
doesn't overflow. An example of this could be when trailing spaces are
located in different items.
This patch ensures that even when the candidate doesn't overflow, we
never consider breaking opportunity offsets that surpass the item's
range end; since we are not overflowing, we'll proceed with the shaping
logic considering range_end as maximum of the breaking opportunity
offset.
Bug: 1128571
Change-Id: I704eb8091cdca00713fed15e22749bb633bacc71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414196
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808007}