From cac06e579ce2135baf9cba735abe55830f8d83d4 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 7 Apr 2016 16:22:51 -0700 Subject: [PATCH 1/2] Remove unused argument to adjust_clipping_region_for_children --- components/layout/block.rs | 3 +-- components/layout/display_list_builder.rs | 6 ++---- components/layout/inline.rs | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 519a76c08e7..103ac4c679c 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1921,8 +1921,7 @@ impl Flow for BlockFlow { CoordinateSystem::Own); self.fragment.adjust_clipping_region_for_children( &mut clip, - &stacking_relative_border_box, - self.base.flags.contains(IS_ABSOLUTELY_POSITIONED)); + &stacking_relative_border_box); // Process children. for kid in self.base.child_iter() { diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 0c04c839450..638011fdcf8 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -229,8 +229,7 @@ pub trait FragmentDisplayListBuilding { /// Adjusts the clipping region for descendants of this fragment as appropriate. fn adjust_clipping_region_for_children(&self, current_clip: &mut ClippingRegion, - stacking_relative_border_box: &Rect, - is_absolutely_positioned: bool); + stacking_relative_border_box: &Rect); /// Adjusts the clipping rectangle for a fragment to take the `clip` property into account /// per CSS 2.1 ยง 11.1.2. @@ -1439,8 +1438,7 @@ impl FragmentDisplayListBuilding for Fragment { fn adjust_clipping_region_for_children(&self, current_clip: &mut ClippingRegion, - stacking_relative_border_box: &Rect, - is_absolutely_positioned: bool) { + stacking_relative_border_box: &Rect) { // Don't clip if we're text. if self.is_scanned_text_fragment() { return diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 94a61bdd061..d9d750b0e83 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -1682,8 +1682,7 @@ impl Flow for InlineFlow { fragment.stacking_relative_content_box(&stacking_relative_border_box); let mut clip = self.base.clip.clone(); fragment.adjust_clipping_region_for_children(&mut clip, - &stacking_relative_border_box, - false); + &stacking_relative_border_box); let is_positioned = fragment.is_positioned(); match fragment.specific { SpecificFragmentInfo::InlineBlock(ref mut info) => { From 66806229ad8394e308ea1199401bdac01d92d994 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 7 Apr 2016 16:24:10 -0700 Subject: [PATCH 2/2] Prevent unnecessary copying in strip_leading_whitespace_if_necessary --- components/layout/fragment.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index bb761603f2f..50ecb69e025 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -2344,7 +2344,10 @@ impl Fragment { modified = true; continue } - new_text_string.push_str(&unscanned_text_fragment_info.text[i..]); + // Finished processing leading control chars and whitespace. + if modified { + new_text_string.push_str(&unscanned_text_fragment_info.text[i..]); + } break } if modified {