Fix whitespace_pre with incremental reflow turned on.

This implements fragment merging, in order to incrementally reflow linebroken
text. This makes the `whitespace_pre.html` reftest pass with incremental reflow
turned on with `-i`.
This commit is contained in:
Clark Gaebel 2014-10-13 12:20:56 -07:00
parent 6a11ee89de
commit 481adcd654
6 changed files with 209 additions and 30 deletions

View file

@ -199,7 +199,10 @@ impl TextRunScanner {
// Next, concatenate all of the transformed strings together, saving the new
// character indices.
let mut run_str = String::new();
let mut new_ranges: Vec<Range<CharIndex>> = vec![];
let mut new_ranges: Vec<Range<CharIndex>> =
Vec::with_capacity(transformed_strs.len());
let mut char_total = CharIndex(0);
for i in range(0, transformed_strs.len() as int) {
let added_chars = CharIndex(transformed_strs[i as uint].as_slice().char_len() as int);
@ -323,4 +326,3 @@ pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) ->
line_height::Length(l) => l
}
}