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.

Fixes #7566.
Fixes #7796.
This commit is contained in:
Martin Robinson 2015-10-09 17:08:35 -07:00
parent 90dd3cdc09
commit ac5525aeeb
13 changed files with 271 additions and 91 deletions

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
use azure::azure_hl::Color;
use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
use euclid::{Matrix4, Point2D, Rect, Size2D};
@ -120,7 +119,7 @@ pub struct LayerProperties {
pub perspective: Matrix4,
/// The subpage that this layer represents. If this is `Some`, this layer represents an
/// iframe.
pub subpage_layer_info: Option<SubpageLayerInfo>,
pub subpage_pipeline_id: Option<PipelineId>,
/// Whether this layer establishes a new 3d rendering context.
pub establishes_3d_context: bool,
/// Whether this layer scrolls its overflow area.
@ -163,13 +162,3 @@ pub enum ScriptToCompositorMsg {
ResizeTo(Size2D<u32>),
Exit,
}
/// Subpage (i.e. iframe)-specific information about each layer.
#[derive(Clone, Copy, Debug, Deserialize, Serialize, HeapSizeOf)]
pub struct SubpageLayerInfo {
/// The ID of the pipeline.
pub pipeline_id: PipelineId,
/// The offset of the subpage within this layer (to account for borders).
pub origin: Point2D<Au>,
}