Ensure the break-offset is greater than the non-hangable run end #27016
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.
The ShapeLineBreaker::NextBreakOpportunity function determines the
non-hangable run end based on the currently break-offset. This value
is, by definition, always smaller than the break-offset. However, if
the break-offset value exceed the range_end, we use this as the actual
offset.
If we have reached this scenario because there is no breaking
opportunity to prevent the overflow, then we just call ShapeToEnd and
return. Otherwise, we continue processing the text item. In this
situation, we must ensure that the new offset is greater than the
previously computed non-hangable run end, since it's possible that we
end up using it as the final offset, leading to the assert violation
described in the bug, since the used break-offset is smaller than the
item's end.
This CL adds the logic to prevent this situation, clearing the
non-hangable run end and computing it again, if necessary, based on
the new offset.
Bug: 1161793
Change-Id: Ie10ffae3c654aefa626d80abd01bd38e026c9e27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2604908
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842461}