servo: Merge #7423 - layout: Make the compositor rather than layout determine the position of each iframe (from pcwalton:iframe-stacking-context-position); r=glennw
The old code that attempted to do this during layout wasn't able to work for multiple reasons: it couldn't know where the iframe was going to be on the page (because of nested iframes), and at the time it was building the display list for a fragment it couldn't know where that fragment was going to be in page coordinates. This patch rewrites that code so that only the size of an iframe is determined during layout, and the position is determined by the compositor. Layout layerizes iframes and marks the iframe layers with the appropriate subpage ID so that the compositor can place them correctly. Closes #7377. Source-Repo: https://github.com/servo/servo Source-Revision: a0cb657fe80859dd8862361631268479d1045432
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use azure::azure_hl::Color;
|
||||
use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
||||
use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId, SubpageId};
|
||||
use euclid::{Matrix4, Point2D, Rect, Size2D};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use layers::layers::{BufferRequest, LayerBufferSet};
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use std::fmt::{self, Debug, Formatter};
|
||||
use util::geometry::Au;
|
||||
|
||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
|
||||
@@ -124,6 +125,9 @@ pub struct LayerProperties {
|
||||
pub transform: Matrix4,
|
||||
/// The perspective transform for this layer
|
||||
pub perspective: Matrix4,
|
||||
/// The subpage that this layer represents. If this is `Some`, this layer represents an
|
||||
/// iframe.
|
||||
pub subpage_layer_info: Option<SubpageLayerInfo>,
|
||||
/// Whether this layer establishes a new 3d rendering context.
|
||||
pub establishes_3d_context: bool,
|
||||
/// Whether this layer scrolls its overflow area.
|
||||
@@ -166,3 +170,15 @@ pub enum ScriptToCompositorMsg {
|
||||
ResizeTo(Size2D<u32>),
|
||||
Exit,
|
||||
}
|
||||
|
||||
/// Subpage (i.e. iframe)-specific information about each layer.
|
||||
#[derive(Clone, Copy, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct SubpageLayerInfo {
|
||||
/// The ID of the pipeline.
|
||||
pub pipeline_id: PipelineId,
|
||||
/// The ID of the subpage.
|
||||
pub subpage_id: SubpageId,
|
||||
/// The offset of the subpage within this layer (to account for borders).
|
||||
pub origin: Point2D<Au>,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
use canvas_traits::CanvasMsg;
|
||||
use compositor_msg::Epoch;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use hyper::header::Headers;
|
||||
@@ -221,7 +220,7 @@ pub enum Msg {
|
||||
LoadComplete(PipelineId),
|
||||
/// Dispatched after the DOM load event has fired on a document
|
||||
DOMLoad(PipelineId),
|
||||
FrameRect(PipelineId, SubpageId, Rect<f32>),
|
||||
FrameSize(PipelineId, SubpageId, Size2D<f32>),
|
||||
LoadUrl(PipelineId, LoadData),
|
||||
ScriptLoadedURLInIFrame(Url, PipelineId, SubpageId, Option<SubpageId>, IFrameSandboxState),
|
||||
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
|
||||
@@ -273,6 +272,9 @@ pub enum Msg {
|
||||
IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>),
|
||||
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.
|
||||
NodeStatus(Option<String>),
|
||||
/// Requests that the pipeline ID of the subpage identified by a (pipeline ID, subpage ID)
|
||||
/// pair be sent to the compositor via a `CreateLayerForSubpage` message.
|
||||
PrepareForSubpageLayerCreation(PipelineId, SubpageId),
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Deserialize, Serialize, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user