diff options
Diffstat (limited to 'components/layout/text.rs')
-rw-r--r-- | components/layout/text.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/components/layout/text.rs b/components/layout/text.rs index da89ae495b8..22fbeb9ad1a 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -173,6 +173,7 @@ impl TextRunScanner { let mut insertion_point = None; for (fragment_index, in_fragment) in self.clump.iter().enumerate() { + debug!(" flushing {:?}", in_fragment); let mut mapping = RunMapping::new(&run_info_list[..], &run_info, fragment_index); let text; let selection; @@ -239,7 +240,6 @@ impl TextRunScanner { mapping.flush(&mut mappings, &mut run_info, &**text, - insertion_point, compression, text_transform, &mut last_whitespace, @@ -269,7 +269,6 @@ impl TextRunScanner { mapping.flush(&mut mappings, &mut run_info, &**text, - insertion_point, compression, text_transform, &mut last_whitespace, @@ -606,15 +605,12 @@ impl RunMapping { mappings: &mut Vec<RunMapping>, run_info: &mut RunInfo, text: &str, - insertion_point: Option<CharIndex>, compression: CompressionMode, text_transform: text_transform::T, last_whitespace: &mut bool, start_position: &mut usize, end_position: usize) { - if *start_position == end_position && insertion_point.is_none() { - return; - } + let was_empty = *start_position == end_position; let old_byte_length = run_info.text.len(); *last_whitespace = util::transform_text(&text[(*start_position)..end_position], compression, @@ -633,8 +629,11 @@ impl RunMapping { run_info.character_length = run_info.character_length + character_count; *start_position = end_position; - // Don't flush mappings that contain no characters and no insertion_point. - if character_count == 0 && !self.contains_insertion_point(insertion_point) { + // Don't save mappings that contain only discarded characters. + // (But keep ones that contained no characters to begin with, since they might have been + // generated by an empty flow to draw its borders/padding/insertion point.) + let is_empty = character_count == 0; + if is_empty && !was_empty { return; } |