mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: text: Don't consider the REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES if the fragment can wrap text.
This was making us fall in a loop where the start split was empty, but we didn't ignore it because the current fragment had this flag, but then we treated it differently depending on the white_space property. Not totally sure this is the proper fix, but it makes sense to me. In case it is: Fixes #12369.
This commit is contained in:
parent
8f13bb24f1
commit
383ba964ab
3 changed files with 22 additions and 22 deletions
|
@ -340,22 +340,21 @@ impl TextRunScanner {
|
|||
let mut byte_range = Range::new(ByteIndex(mapping.byte_range.begin() as isize),
|
||||
ByteIndex(mapping.byte_range.length() as isize));
|
||||
|
||||
let mut flags = ScannedTextFlags::empty();
|
||||
let text_size = old_fragment.border_box.size;
|
||||
|
||||
let requires_line_break_afterward_if_wrapping_on_newlines =
|
||||
scanned_run.run.text[mapping.byte_range.begin()..mapping.byte_range.end()]
|
||||
.ends_with('\n');
|
||||
|
||||
if requires_line_break_afterward_if_wrapping_on_newlines {
|
||||
byte_range.extend_by(ByteIndex(-1)); // Trim the '\n'
|
||||
flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
}
|
||||
|
||||
let text_size = old_fragment.border_box.size;
|
||||
|
||||
let mut flags = ScannedTextFlags::empty();
|
||||
if mapping.selected {
|
||||
flags.insert(SELECTED);
|
||||
}
|
||||
if requires_line_break_afterward_if_wrapping_on_newlines {
|
||||
flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
}
|
||||
|
||||
let insertion_point = if mapping.contains_insertion_point(scanned_run.insertion_point) {
|
||||
scanned_run.insertion_point
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue