mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Fix inline size adjustment when stripping trailing whitespace from fragments
The whitespace range was not properly shifted which caused us to adjust the fragment's inline size by the advance of a different set of characters. This was causing justified text lines to be too long or too short.
This commit is contained in:
parent
a85db48623
commit
c8db7da36a
1 changed files with 2 additions and 1 deletions
|
@ -2401,7 +2401,8 @@ impl Fragment {
|
|||
}
|
||||
let whitespace_start = ByteIndex(trailing_whitespace_start_byte as isize);
|
||||
let whitespace_len = scanned_text_fragment_info.range.length() - whitespace_start;
|
||||
let whitespace_range = Range::new(whitespace_start, whitespace_len);
|
||||
let mut whitespace_range = Range::new(whitespace_start, whitespace_len);
|
||||
whitespace_range.shift_by(scanned_text_fragment_info.range.begin());
|
||||
|
||||
let text_bounds = scanned_text_fragment_info.run
|
||||
.metrics_for_range(&whitespace_range)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue