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:
Ulf Nilsson 2016-05-11 23:52:33 +02:00
parent a85db48623
commit c8db7da36a

View file

@ -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)