diff options
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/display_list_builder.rs | 40 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 16 |
2 files changed, 27 insertions, 29 deletions
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 49c140cbedb..666b70990cc 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -25,7 +25,7 @@ use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayIte use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion}; use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList}; use gfx::display_list::{GradientDisplayItem}; -use gfx::display_list::{GradientStop, ImageDisplayItem, LineDisplayItem}; +use gfx::display_list::{GradientStop, ImageDisplayItem, LayerInfo, LineDisplayItem}; use gfx::display_list::{OpaqueNode, SolidColorDisplayItem}; use gfx::display_list::{StackingContext, TextDisplayItem, TextOrientation}; use gfx::paint_task::THREAD_TINT_COLORS; @@ -1279,6 +1279,18 @@ impl FragmentDisplayListBuilding for Fragment { filters.push(Filter::Opacity(effects.opacity)) } + let subpage_layer_info = match self.specific { + SpecificFragmentInfo::Iframe(ref iframe_fragment_info) => { + let border_padding = self.border_padding.to_physical(self.style().writing_mode); + Some(SubpageLayerInfo { + pipeline_id: iframe_fragment_info.pipeline_id, + subpage_id: iframe_fragment_info.subpage_id, + origin: Point2D::new(border_padding.left, border_padding.top), + }) + } + _ => None, + }; + let canvas_or_iframe = match self.specific { SpecificFragmentInfo::Canvas(_) | SpecificFragmentInfo::Iframe(_) => true, _ => false @@ -1287,17 +1299,19 @@ impl FragmentDisplayListBuilding for Fragment { // There are three situations that need layers: when the fragment has the HAS_LAYER // flag, when this is a canvas or iframe fragment, and when we are building a layer // tree for overflow scrolling. - let layer_id = if mode == StackingContextCreationMode::InnerScrollWrapper { - Some(self.layer_id_for_overflow_scroll()) + let layer_info = if mode == StackingContextCreationMode::InnerScrollWrapper { + Some(LayerInfo::new(self.layer_id_for_overflow_scroll(), + scroll_policy, + subpage_layer_info)) } else if self.flags.contains(HAS_LAYER) || canvas_or_iframe { - Some(self.layer_id()) + Some(LayerInfo::new(self.layer_id(), scroll_policy, subpage_layer_info)) } else { None }; // If it's a canvas we must propagate the layer and the renderer to the paint task. if let SpecificFragmentInfo::Canvas(ref fragment_info) = self.specific { - let layer_id = layer_id.unwrap(); + let layer_id = layer_info.unwrap().layer_id; if let Some(ref ipc_renderer) = fragment_info.ipc_renderer { layout_context.shared .canvas_layers_sender @@ -1305,18 +1319,6 @@ impl FragmentDisplayListBuilding for Fragment { } } - let subpage_layer_info = match self.specific { - SpecificFragmentInfo::Iframe(ref iframe_fragment_info) => { - let border_padding = self.border_padding.to_physical(self.style().writing_mode); - Some(SubpageLayerInfo { - pipeline_id: iframe_fragment_info.pipeline_id, - subpage_id: iframe_fragment_info.subpage_id, - origin: Point2D::new(border_padding.left, border_padding.top), - }) - } - _ => None, - }; - let scrolls_overflow_area = mode == StackingContextCreationMode::OuterScrollWrapper; let transform_style = self.style().get_used_transform_style(); let establishes_3d_context = scrolls_overflow_area || @@ -1332,9 +1334,7 @@ impl FragmentDisplayListBuilding for Fragment { perspective, establishes_3d_context, scrolls_overflow_area, - scroll_policy, - layer_id, - subpage_layer_info)) + layer_info)) } fn clipping_region_for_children(&self, diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index ee77270e62b..a91a84ca2ee 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -27,8 +27,7 @@ use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUti use flow_ref::{self, FlowRef}; use fnv::FnvHasher; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; -use gfx::display_list::StackingContext; -use gfx::display_list::{ClippingRegion, DisplayList, OpaqueNode}; +use gfx::display_list::{ClippingRegion, DisplayList, LayerInfo, OpaqueNode, StackingContext}; use gfx::font_cache_task::FontCacheTask; use gfx::font_context; use gfx::paint_task::{LayoutToPaintMsg, PaintLayer}; @@ -1119,7 +1118,6 @@ impl LayoutTask { .add_to(&mut *display_list); let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size); - let layer_id = layout_root.layer_id(); let stacking_context = Arc::new(StackingContext::new(display_list, &origin, &origin, @@ -1130,8 +1128,6 @@ impl LayoutTask { Matrix4::identity(), true, false, - ScrollPolicy::Scrollable, - Some(layer_id), None)); if opts::get().dump_display_list { stacking_context.print("DisplayList".to_owned()); @@ -1142,10 +1138,12 @@ impl LayoutTask { rw_data.stacking_context = Some(stacking_context.clone()); - let paint_layer = PaintLayer::new(layout_root.layer_id(), - root_background_color, - stacking_context, - ScrollPolicy::Scrollable); + let layer_info = LayerInfo::new(layout_root.layer_id(), + ScrollPolicy::Scrollable, + None); + let paint_layer = PaintLayer::new_with_stacking_context(layer_info, + stacking_context, + root_background_color); debug!("Layout done!"); |