layout: Properly count characters when segmenting IFC text (#42399)

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.

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.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-02-06 14:37:19 +01:00
committed by GitHub
parent 4e85b9946f
commit edbce7e854
4 changed files with 50 additions and 4 deletions

View File

@@ -136,6 +136,19 @@
},
"reftest": {
"appearance": {
"input-text-caret-mixed-language.html": [
"9fd52d39a076d9d03876efd93af30402e17e5ee0",
[
null,
[
[
"/_mozilla/appearance/input-text-caret-mixed-language-ref.html",
"!="
]
],
{}
]
],
"input-textual-definite-width.html": [
"59f1797fab3d1889bbcb7863178c6c5ef9e54f19",
[
@@ -8269,6 +8282,10 @@
[]
],
"appearance": {
"input-text-caret-mixed-language-ref.html": [
"ff0b91f2a8857fdefa4a8a3d7d75e06e53e699cf",
[]
],
"input-textual-definite-width-ref.html": [
"7a256be23b3c084bb8477d7380a8b1801ec07f05",
[]