diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-10-28 19:12:39 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-10-28 19:12:39 -0600 |
commit | c20bb66aef28e922c46aa69c9faaa94d83269e73 (patch) | |
tree | aebfcf76eab598f612163c832535f77b9faaa4a1 /components | |
parent | 08288fea411e001da9b35204ccf66f29c1d7dae6 (diff) | |
parent | 01965c399ef2ed3d01523be15ee27c2341e36ad2 (diff) | |
download | servo-c20bb66aef28e922c46aa69c9faaa94d83269e73.tar.gz servo-c20bb66aef28e922c46aa69c9faaa94d83269e73.zip |
auto merge of #3841 : pcwalton/servo/removing-whitespace-damage, r=cgaebel
Avoids total reflow of the entire document on the maze solver.
I have tested Wikipedia reflow and it still works.
r? @cgaebel
Diffstat (limited to 'components')
-rw-r--r-- | components/layout/construct.rs | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index da31fcf1ab2..28666be03bb 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -306,15 +306,13 @@ impl<'a> FlowConstructor<'a> { match whitespace_stripping { NoWhitespaceStripping => {} StripWhitespaceFromStart => { - flow::mut_base(flow.deref_mut()).restyle_damage.insert( - strip_ignorable_whitespace_from_start(&mut fragments)); + strip_ignorable_whitespace_from_start(&mut fragments); if fragments.is_empty() { return }; } StripWhitespaceFromEnd => { - flow::mut_base(flow.deref_mut()).restyle_damage.insert( - strip_ignorable_whitespace_from_end(&mut fragments)); + strip_ignorable_whitespace_from_end(&mut fragments); if fragments.is_empty() { return }; @@ -1232,36 +1230,26 @@ impl FlowConstructionUtils for FlowRef { } /// Strips ignorable whitespace from the start of a list of fragments. -/// -/// Returns some damage that must be added to the `InlineFlow`. -pub fn strip_ignorable_whitespace_from_start(this: &mut DList<Fragment>) -> RestyleDamage { +pub fn strip_ignorable_whitespace_from_start(this: &mut DList<Fragment>) { if this.is_empty() { - return RestyleDamage::empty() // Fast path. + return // Fast path. } - let mut damage = RestyleDamage::empty(); while !this.is_empty() && this.front().as_ref().unwrap().is_ignorable_whitespace() { debug!("stripping ignorable whitespace from start"); - damage = RestyleDamage::all(); drop(this.pop_front()); } - damage } /// Strips ignorable whitespace from the end of a list of fragments. -/// -/// Returns some damage that must be added to the `InlineFlow`. -pub fn strip_ignorable_whitespace_from_end(this: &mut DList<Fragment>) -> RestyleDamage { +pub fn strip_ignorable_whitespace_from_end(this: &mut DList<Fragment>) { if this.is_empty() { - return RestyleDamage::empty(); + return } - let mut damage = RestyleDamage::empty(); while !this.is_empty() && this.back().as_ref().unwrap().is_ignorable_whitespace() { debug!("stripping ignorable whitespace from end"); - damage = RestyleDamage::all(); drop(this.pop()); } - damage } |