servo: Merge #16258 - Overwrite default RunInfo values with the first real ones encountered (from jdm:panic-at-the-ellipsis); r=pcwalton,stshine

TextRunScanner::flush_clump_to_list compares the values in the RunInfo object against the ones determined from the current fragment, but these values can be arbitrary defaults that don't mean anything useful.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14783
- [X] There are tests for these changes

Source-Repo: https://github.com/servo/servo
Source-Revision: 9c0d8e44a005ef68f805569f535a6ffa1f46d627

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 1e2f19a6b308fab9e8928854fae879125bee6b77
This commit is contained in:
Josh Matthews 2017-04-12 23:09:53 -05:00
parent ccbf32129b
commit 55ef876320

View File

@ -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;
let new_mapping_needed = 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);
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);