From f2af9f02311ab2e5796f089664ef35679fc05070 Mon Sep 17 00:00:00 2001 From: Dan Glastonbury Date: Tue, 4 Jun 2019 05:53:05 +0000 Subject: [PATCH] Bug 1550640 - P2: Remove dead code resulting from refactoring of ItemRange. r=Gankro Having `ItemRange` contain a byte slice means that the `display_list` and `pipeline_id` don't need to be threaded through code that accesses items from ItemRange. Differential Revision: https://phabricator.services.mozilla.com/D32781 --HG-- extra : moz-landing-system : lando --- .../webrender/src/display_list_flattener.rs | 54 ++----------------- gfx/wr/webrender/src/scene.rs | 11 ---- gfx/wr/wrench/src/yaml_frame_writer.rs | 12 +---- 3 files changed, 7 insertions(+), 70 deletions(-) diff --git a/gfx/wr/webrender/src/display_list_flattener.rs b/gfx/wr/webrender/src/display_list_flattener.rs index 54c3e65323e7..4214469ed7dc 100644 --- a/gfx/wr/webrender/src/display_list_flattener.rs +++ b/gfx/wr/webrender/src/display_list_flattener.rs @@ -578,24 +578,6 @@ impl<'a> DisplayListFlattener<'a> { scroll_root } - fn get_complex_clips( - &self, - pipeline_id: PipelineId, - complex_clips: ItemRange<'a, ComplexClipRegion>, - ) -> impl 'a + Iterator { - //Note: we could make this a bit more complex to early out - // on `complex_clips.is_empty()` if it's worth it - complex_clips.iter() - } - - fn get_clip_chain_items( - &self, - pipeline_id: PipelineId, - items: ItemRange<'a, ClipId>, - ) -> impl 'a + Iterator { - items.iter() - } - fn flatten_items( &mut self, traversal: &mut BuiltDisplayListIter<'a>, @@ -677,11 +659,10 @@ impl<'a> DisplayListFlattener<'a> { parent_node_index: SpatialNodeIndex, pipeline_id: PipelineId, ) { - let complex_clips = self.get_complex_clips(pipeline_id, item.complex_clip()); let current_offset = self.current_offset(parent_node_index); let clip_region = ClipRegion::create_for_clip_node( info.clip_rect, - complex_clips, + item.complex_clip().iter(), info.image_mask, ¤t_offset, ); @@ -756,11 +737,9 @@ impl<'a> DisplayListFlattener<'a> { } let composition_operations = { - // TODO(optimization?): self.traversal.display_list() - let display_list = self.scene.get_display_list_for_pipeline(pipeline_id); CompositeOps::new( - stacking_context.filter_ops_for_compositing(display_list, filters), - stacking_context.filter_datas_for_compositing(display_list, filter_datas), + stacking_context.filter_ops_for_compositing(filters), + stacking_context.filter_datas_for_compositing(filter_datas), stacking_context.mix_blend_mode_for_compositing(), ) }; @@ -984,7 +963,6 @@ impl<'a> DisplayListFlattener<'a> { &info.color, item.glyphs(), info.glyph_options, - pipeline_id, ); } DisplayItem::Rectangle(ref info) => { @@ -1053,7 +1031,6 @@ impl<'a> DisplayListFlattener<'a> { info.gradient.extend_mode, info.tile_size, info.tile_spacing, - pipeline_id, None, ) { self.add_nonshadowable_primitive( @@ -1081,7 +1058,6 @@ impl<'a> DisplayListFlattener<'a> { info.gradient.extend_mode, info.tile_size, info.tile_spacing, - pipeline_id, None, ); @@ -1122,7 +1098,6 @@ impl<'a> DisplayListFlattener<'a> { &layout, info, item.gradient_stops(), - pipeline_id, ); } DisplayItem::PushStackingContext(ref info) => { @@ -1164,10 +1139,9 @@ impl<'a> DisplayListFlattener<'a> { DisplayItem::Clip(ref info) => { let parent_space = self.get_space(&info.parent_space_and_clip.spatial_id); let current_offset = self.current_offset(parent_space); - let complex_clips = self.get_complex_clips(pipeline_id, item.complex_clip()); let clip_region = ClipRegion::create_for_clip_node( info.clip_rect, - complex_clips, + item.complex_clip().iter(), info.image_mask, ¤t_offset, ); @@ -1196,7 +1170,7 @@ impl<'a> DisplayListFlattener<'a> { let mut clip_chain_id = parent_clip_chain_id; // For each specified clip id - for clip_item in self.get_clip_chain_items(pipeline_id, item.clip_chain_items()) { + for clip_item in item.clip_chain_items() { // Map the ClipId to an existing clip chain node. let item_clip_node = self .id_to_index_mapper @@ -2502,7 +2476,6 @@ impl<'a> DisplayListFlattener<'a> { info: &LayoutPrimitiveInfo, border_item: &BorderDisplayItem, gradient_stops: ItemRange, - pipeline_id: PipelineId, ) { match border_item.details { BorderDetails::NinePatch(ref border) => { @@ -2544,7 +2517,6 @@ impl<'a> DisplayListFlattener<'a> { gradient.extend_mode, LayoutSize::new(border.height as f32, border.width as f32), LayoutSize::zero(), - pipeline_id, Some(Box::new(nine_patch)), ) { Some(prim) => prim, @@ -2569,7 +2541,6 @@ impl<'a> DisplayListFlattener<'a> { gradient.extend_mode, LayoutSize::new(border.height as f32, border.width as f32), LayoutSize::zero(), - pipeline_id, Some(Box::new(nine_patch)), ); @@ -2602,16 +2573,11 @@ impl<'a> DisplayListFlattener<'a> { extend_mode: ExtendMode, stretch_size: LayoutSize, mut tile_spacing: LayoutSize, - pipeline_id: PipelineId, nine_patch: Option>, ) -> Option { let mut prim_rect = info.rect; simplify_repeated_primitive(&stretch_size, &mut tile_spacing, &mut prim_rect); - // TODO(gw): It seems like we should be able to look this up once in - // flatten_root() and pass to all children here to avoid - // some hash lookups? - let display_list = self.scene.get_display_list_for_pipeline(pipeline_id); let mut max_alpha: f32 = 0.0; let stops = stops.iter().map(|stop| { @@ -2669,17 +2635,11 @@ impl<'a> DisplayListFlattener<'a> { extend_mode: ExtendMode, stretch_size: LayoutSize, mut tile_spacing: LayoutSize, - pipeline_id: PipelineId, nine_patch: Option>, ) -> RadialGradient { let mut prim_rect = info.rect; simplify_repeated_primitive(&stretch_size, &mut tile_spacing, &mut prim_rect); - // TODO(gw): It seems like we should be able to look this up once in - // flatten_root() and pass to all children here to avoid - // some hash lookups? - let display_list = self.scene.get_display_list_for_pipeline(pipeline_id); - let params = RadialGradientParams { start_radius, end_radius, @@ -2712,7 +2672,6 @@ impl<'a> DisplayListFlattener<'a> { text_color: &ColorF, glyph_range: ItemRange, glyph_options: Option, - pipeline_id: PipelineId, ) { let offset = self.current_offset(clip_and_scroll.spatial_node_index); @@ -2751,9 +2710,6 @@ impl<'a> DisplayListFlattener<'a> { flags, ); - // TODO(gw): We can do better than a hash lookup here... - let display_list = self.scene.get_display_list_for_pipeline(pipeline_id); - // TODO(gw): It'd be nice not to have to allocate here for creating // the primitive key, when the common case is that the // hash will match and we won't end up creating a new diff --git a/gfx/wr/webrender/src/scene.rs b/gfx/wr/webrender/src/scene.rs index df7bef22ff2f..c53356ba26b2 100644 --- a/gfx/wr/webrender/src/scene.rs +++ b/gfx/wr/webrender/src/scene.rs @@ -154,13 +154,6 @@ impl Scene { self.root_pipeline_id = Some(pipeline_id); } - pub fn get_display_list_for_pipeline(&self, pipeline_id: PipelineId) -> &BuiltDisplayList { - &self.pipelines - .get(&pipeline_id) - .expect("Expected to find display list for pipeline") - .display_list - } - pub fn set_display_list( &mut self, pipeline_id: PipelineId, @@ -207,12 +200,10 @@ pub trait StackingContextHelpers { fn mix_blend_mode_for_compositing(&self) -> Option; fn filter_ops_for_compositing( &self, - display_list: &BuiltDisplayList, input_filters: ItemRange, ) -> Vec; fn filter_datas_for_compositing( &self, - display_list: &BuiltDisplayList, input_filter_datas: &[TempFilterData], ) -> Vec; } @@ -227,7 +218,6 @@ impl StackingContextHelpers for StackingContext { fn filter_ops_for_compositing( &self, - display_list: &BuiltDisplayList, input_filters: ItemRange, ) -> Vec { // TODO(gw): Now that we resolve these later on, @@ -242,7 +232,6 @@ impl StackingContextHelpers for StackingContext { fn filter_datas_for_compositing( &self, - display_list: &BuiltDisplayList, input_filter_datas: &[TempFilterData], ) -> Vec { // TODO(gw): Now that we resolve these later on, diff --git a/gfx/wr/wrench/src/yaml_frame_writer.rs b/gfx/wr/wrench/src/yaml_frame_writer.rs index cc781739f154..a27916c333a7 100644 --- a/gfx/wr/wrench/src/yaml_frame_writer.rs +++ b/gfx/wr/wrench/src/yaml_frame_writer.rs @@ -253,7 +253,6 @@ fn write_stacking_context( properties: &SceneProperties, filter_iter: impl IntoIterator, filter_data_iter: &[TempFilterData], - display_list: &BuiltDisplayList, ) { enum_node(parent, "transform-style", sc.transform_style); @@ -395,7 +394,6 @@ fn radial_gradient_to_yaml( table: &mut Table, gradient: &webrender::api::RadialGradient, stops_range: ItemRange, - display_list: &BuiltDisplayList ) { point_node(table, "center", &gradient.center); size_node(table, "radius", &gradient.radius); @@ -811,7 +809,6 @@ impl YamlFrameWriter { fn make_complex_clips_node( &mut self, complex_clips: ItemRange, - list: &BuiltDisplayList, ) -> Option { let iter = complex_clips.iter(); if iter.len() == 0 { @@ -1055,7 +1052,6 @@ impl YamlFrameWriter { &mut v, &gradient, base.gradient_stops(), - display_list ); } } @@ -1138,7 +1134,6 @@ impl YamlFrameWriter { &mut v, &item.gradient, base.gradient_stops(), - display_list ); } DisplayItem::Iframe(item) => { @@ -1170,7 +1165,6 @@ impl YamlFrameWriter { &scene.properties, base.filters(), base.filter_datas(), - display_list, ); let mut sub_iter = base.sub_iter(); @@ -1201,8 +1195,7 @@ impl YamlFrameWriter { usize_node(&mut v, "id", clip_id_mapper.add_clip_id(item.id)); if let Some(complex) = self.make_complex_clips_node( - base.complex_clip(), - display_list, + base.complex_clip() ) { yaml_node(&mut v, "complex", complex); } @@ -1235,8 +1228,7 @@ impl YamlFrameWriter { vector_node(&mut v, "external-scroll-offset", &item.external_scroll_offset); if let Some(complex) = self.make_complex_clips_node( - base.complex_clip(), - display_list, + base.complex_clip() ) { yaml_node(&mut v, "complex", complex); }