layout: Properly count characters when segmenting IFC text#42399
Merged
mrobinson merged 1 commit intoservo:mainfrom Feb 6, 2026
Merged
layout: Properly count characters when segmenting IFC text#42399mrobinson merged 1 commit intoservo:mainfrom
mrobinson merged 1 commit intoservo:mainfrom
Conversation
There was a bug where characters were not properly counted when segmeting IFC text. Immediately incrementing the `current_character_index` meant that the count was always one character off. This character count is mainly used for drawing selections and really matters when multiple text segments are in a single IFC. This change fixes that by counting characters in the same way we were counting byte indices for the text. Signed-off-by: Martin Robinson <[email protected]>
c839ba5 to
c11df50
Compare
jdm
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There was a bug where characters were not properly counted when
segmeting IFC text. Immediately incrementing the
current_character_indexmeant that the count was always one characteroff. This character count is mainly used for drawing selections and
really matters when multiple text segments are in a single IFC. This
change fixes that by counting characters in the same way we were
counting byte indices for the text.
Testing: This change adds a Servo-specific WPT-style test. As it is quite
difficult to reproduce the correct display in a different way, a mismatch test
is used. Since this is mainly about appearance and is very specific to our
implementation the test is Servo-specific.
Fixes: #42354.