Skip to content

Commit 11d23a4

Browse files
author
bors-servo
committed
Auto merge of #7950 - mrobinson:layerize-iframes, r=pcwalton
Integrate iframes into the display list Instead of always promoting iframes to StackingContexts, integrate them into the display list. This prevents stacking bugs when non-stacking-context elements should be drawn on top of iframes. To accomplish this, we add another step to ordering layer creation, where LayeredItems in the DisplayList are added to layers described by the LayerInfo structures collected at the end of the DisplayList. Unlayered items that follow these layered items are added to synthesized layers. Another result of this change is that iframe layers can be positioned directly at the location of the iframe fragment, eliminating the need for the SubpageLayerInfo struct entirely. Iframes are the first type of content treated this way, but this change opens up the possibility to properly order canvas and all other layered content that does not create a stacking context. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7950) <!-- Reviewable:end -->
2 parents c3ab711 + ac5525a commit 11d23a4

File tree

13 files changed

+271
-91
lines changed

13 files changed

+271
-91
lines changed

components/compositing/compositor.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
670670
scroll_policy: ScrollPolicy::Scrollable,
671671
transform: Matrix4::identity(),
672672
perspective: Matrix4::identity(),
673-
subpage_layer_info: None,
673+
subpage_pipeline_id: None,
674674
establishes_3d_context: true,
675675
scrolls_overflow_area: false,
676676
};
@@ -819,18 +819,16 @@ impl<Window: WindowMethods> IOCompositor<Window> {
819819
}
820820

821821
// If this layer contains a subpage, then create the root layer for that subpage now.
822-
if let Some(ref subpage_layer_info) = layer_properties.subpage_layer_info {
822+
if let Some(ref subpage_pipeline_id) = layer_properties.subpage_pipeline_id {
823823
let subpage_layer_properties = LayerProperties {
824824
id: LayerId::null(),
825825
parent_id: None,
826-
rect: Rect::new(Point2D::new(subpage_layer_info.origin.x.to_f32_px(),
827-
subpage_layer_info.origin.y.to_f32_px()),
828-
layer_properties.rect.size),
826+
rect: Rect::new(Point2D::zero(), layer_properties.rect.size),
829827
background_color: layer_properties.background_color,
830828
scroll_policy: ScrollPolicy::Scrollable,
831829
transform: Matrix4::identity(),
832830
perspective: Matrix4::identity(),
833-
subpage_layer_info: layer_properties.subpage_layer_info,
831+
subpage_pipeline_id: layer_properties.subpage_pipeline_id,
834832
establishes_3d_context: true,
835833
scrolls_overflow_area: true,
836834
};
@@ -840,13 +838,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
840838
} else {
841839
WantsScrollEventsFlag::DoesntWantScrollEvents
842840
};
843-
let subpage_layer = CompositorData::new_layer(subpage_layer_info.pipeline_id,
841+
let subpage_layer = CompositorData::new_layer(*subpage_pipeline_id,
844842
subpage_layer_properties,
845843
wants_scroll_events,
846844
new_layer.tile_size);
847845
*subpage_layer.masks_to_bounds.borrow_mut() = true;
848846
new_layer.add_child(subpage_layer);
849-
self.pending_subpages.insert(subpage_layer_info.pipeline_id);
847+
self.pending_subpages.insert(*subpage_pipeline_id);
850848
}
851849

852850
parent_layer.add_child(new_layer.clone());
@@ -871,13 +869,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
871869
/// Sends the size of the given subpage up to the constellation. This will often trigger a
872870
/// reflow of that subpage.
873871
fn update_subpage_size_if_necessary(&self, layer_properties: &LayerProperties) {
874-
let subpage_layer_info = match layer_properties.subpage_layer_info {
875-
Some(ref subpage_layer_info) => *subpage_layer_info,
872+
let subpage_pipeline_id = match layer_properties.subpage_pipeline_id {
873+
Some(ref subpage_pipeline_id) => subpage_pipeline_id,
876874
None => return,
877875
};
878876

879877
let ConstellationChan(ref chan) = self.constellation_chan;
880-
chan.send(ConstellationMsg::FrameSize(subpage_layer_info.pipeline_id,
878+
chan.send(ConstellationMsg::FrameSize(*subpage_pipeline_id,
881879
layer_properties.rect.size)).unwrap();
882880
}
883881

components/compositing/compositor_layer.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ impl CompositorData {
6161
requested_epoch: Epoch(0),
6262
painted_epoch: Epoch(0),
6363
scroll_offset: Point2D::typed(0., 0.),
64-
subpage_info: layer_properties.subpage_layer_info.map(|subpage_layer_info| {
65-
subpage_layer_info.pipeline_id
66-
}),
64+
subpage_info: layer_properties.subpage_pipeline_id,
6765
};
6866

6967
Rc::new(Layer::new(Rect::from_untyped(&layer_properties.rect),
@@ -485,8 +483,8 @@ impl RcCompositorLayer for Rc<Layer<CompositorData>> {
485483
if let Some(layer_pipeline_id) = layer_pipeline_id {
486484
for layer_properties in new_layers.iter() {
487485
// Keep this layer if a reference to it exists.
488-
if let Some(ref subpage_layer_info) = layer_properties.subpage_layer_info {
489-
if subpage_layer_info.pipeline_id == layer_pipeline_id {
486+
if let Some(ref subpage_pipeline_id) = layer_properties.subpage_pipeline_id {
487+
if *subpage_pipeline_id == layer_pipeline_id {
490488
return true
491489
}
492490
}

0 commit comments

Comments
 (0)