diff options
author | Martin Robinson <mrobinson@igalia.com> | 2015-10-01 15:42:24 -0700 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2015-10-05 13:35:31 -0700 |
commit | 553f1fc192d93df3a1427a474b35c0fababca249 (patch) | |
tree | 9eee4467d09737493d3c378bb340266bad372daa /components/gfx/paint_task.rs | |
parent | ba2714f4f607da77bd7200f88cfa16c1d10da9cd (diff) | |
download | servo-553f1fc192d93df3a1427a474b35c0fababca249.tar.gz servo-553f1fc192d93df3a1427a474b35c0fababca249.zip |
Rework how StackingContexts are dynamically added to layers
StackingContexts are added to layers when it is necessary to maintain
their ordering on top of other layered StackingContexts. Instead of
tracking the information about a layer scattered around into different
structs, combine it all into LayerInfo. LayerInfo will be used in the
future to hold layer information for DisplayItems that are layerized
independently of StackingContexts.
Diffstat (limited to 'components/gfx/paint_task.rs')
-rw-r--r-- | components/gfx/paint_task.rs | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index c63c84d9970..08da0e6aaeb 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -8,7 +8,7 @@ use app_units::Au; use azure::AzFloat; use azure::azure_hl::{BackendType, Color, DrawTarget, SurfaceFormat}; use canvas_traits::CanvasMsg; -use display_list::{self, StackingContext}; +use display_list::{self, LayerInfo, StackingContext}; use euclid::Matrix4; use euclid::point::Point2D; use euclid::rect::Rect; @@ -19,7 +19,7 @@ use ipc_channel::ipc::IpcSender; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::platform::surface::{NativeDisplay, NativeSurface}; use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties, PaintListener}; -use msg::compositor_msg::{ScrollPolicy}; +use msg::compositor_msg::{ScrollPolicy, SubpageLayerInfo}; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::PipelineExitType; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; @@ -51,20 +51,36 @@ pub struct PaintLayer { pub stacking_context: Arc<StackingContext>, /// The scrolling policy of this layer. pub scroll_policy: ScrollPolicy, + /// The subpage that this layer represents, if there is one. + pub subpage_layer_info: Option<SubpageLayerInfo>, } impl PaintLayer { /// Creates a new `PaintLayer`. - pub fn new(id: LayerId, + pub fn new(layer_info: LayerInfo, background_color: Color, - stacking_context: Arc<StackingContext>, - scroll_policy: ScrollPolicy) + stacking_context: Arc<StackingContext>) -> PaintLayer { PaintLayer { - id: id, + id: layer_info.layer_id, background_color: background_color, stacking_context: stacking_context, - scroll_policy: scroll_policy, + scroll_policy: layer_info.scroll_policy, + subpage_layer_info: layer_info.subpage_layer_info, + } + } + + /// Creates a new `PaintLayer` with a stacking context. + pub fn new_with_stacking_context(layer_info: LayerInfo, + stacking_context: Arc<StackingContext>, + background_color: Color) + -> PaintLayer { + PaintLayer { + id: layer_info.layer_id, + background_color: background_color, + stacking_context: stacking_context, + scroll_policy: layer_info.scroll_policy, + subpage_layer_info: layer_info.subpage_layer_info, } } @@ -382,12 +398,12 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static { parent_id: parent_id, rect: layer_position, background_color: paint_layer.background_color, - scroll_policy: paint_layer.stacking_context.scroll_policy, + scroll_policy: paint_layer.scroll_policy, transform: transform, perspective: perspective, establishes_3d_context: paint_layer.stacking_context.establishes_3d_context, scrolls_overflow_area: paint_layer.stacking_context.scrolls_overflow_area, - subpage_layer_info: paint_layer.stacking_context.subpage_layer_info, + subpage_layer_info: paint_layer.subpage_layer_info, }); // When there is a new layer, the transforms and origin are handled by the compositor, |