mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Make the compositor rather than layout determine the position of
each iframe. 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 both the sizes and positions of iframes are determined by the compositor. Layout layerizes all iframes and marks the iframe layers with the appropriate pipeline and subpage IDs so that the compositor can place them correctly. This approach is similar in spirit to Gecko's `RefLayer` infrastructure. The logic that determines when it is time to take the screenshot for reftests has been significantly revamped to deal with this change in delegation of responsibility. Additionally, this code removes the infrastructure that sends layout data back to the layout task to be destroyed, since it is now all thread-safe and can be destroyed on the script task. The failing tests now fail because of a pre-existing bug related to intrinsic heights and borders on inline replaced elements. They happened to pass before because we never rendered the iframes at all, which meant they never had a chance to draw the red border the tests expect to not render! Closes #7377.
This commit is contained in:
parent
ed0d70e234
commit
c72d0c2ed0
20 changed files with 602 additions and 389 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue