aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/text.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-04-04 09:16:26 -0400
committerJosh Matthews <josh@joshmatthews.net>2017-04-13 09:56:48 +1000
commita20d0bccef0706cdfaac8d932e80782581ad542f (patch)
treecaf391c2fe1211a3f32cbc2644f9a63d8c8bff4d /components/layout/text.rs
parentca3cd64d6b1999292d634bfa237c2705e6d575c1 (diff)
downloadservo-a20d0bccef0706cdfaac8d932e80782581ad542f.tar.gz
servo-a20d0bccef0706cdfaac8d932e80782581ad542f.zip
Overwrite default RunInfo values with the first real ones encountered.
Diffstat (limited to 'components/layout/text.rs')
-rw-r--r--components/layout/text.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 0299199af39..5c9b93edee1 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -234,17 +234,22 @@ impl TextRunScanner {
let flush_run = run_info.font_index != font_index ||
run_info.bidi_level != bidi_level ||
!compatible_script;
- let flush_mapping = flush_run || mapping.selected != selected;
-
- if flush_mapping {
- mapping.flush(&mut mappings,
- &mut run_info,
- &**text,
- compression,
- text_transform,
- &mut last_whitespace,
- &mut start_position,
- end_position);
+ let new_mapping_needed = flush_run || mapping.selected != selected;
+
+ if new_mapping_needed {
+ // We ignore empty mappings at the very start of a fragment.
+ // The run info values are uninitialized at this point so
+ // flushing an empty mapping is pointless.
+ if end_position > 0 {
+ mapping.flush(&mut mappings,
+ &mut run_info,
+ &**text,
+ compression,
+ text_transform,
+ &mut last_whitespace,
+ &mut start_position,
+ end_position);
+ }
if run_info.text.len() > 0 {
if flush_run {
run_info.flush(&mut run_info_list, &mut insertion_point);