зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #15186 - Re revert the backed out PRs (from servo:re-revert); r=mbrubeck
r? anyone Source-Repo: https://github.com/servo/servo Source-Revision: 2b623fcc7a4319b217cd52d1049b228a9fcc165a
This commit is contained in:
Родитель
5b93c3d57e
Коммит
ecc8909f7e
|
@ -342,15 +342,13 @@ fn initialize_png(width: usize, height: usize) -> RenderTargetInfo {
|
||||||
|
|
||||||
struct RenderNotifier {
|
struct RenderNotifier {
|
||||||
compositor_proxy: Box<CompositorProxy>,
|
compositor_proxy: Box<CompositorProxy>,
|
||||||
constellation_chan: Sender<ConstellationMsg>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderNotifier {
|
impl RenderNotifier {
|
||||||
fn new(compositor_proxy: Box<CompositorProxy>,
|
fn new(compositor_proxy: Box<CompositorProxy>,
|
||||||
constellation_chan: Sender<ConstellationMsg>) -> RenderNotifier {
|
_: Sender<ConstellationMsg>) -> RenderNotifier {
|
||||||
RenderNotifier {
|
RenderNotifier {
|
||||||
compositor_proxy: compositor_proxy,
|
compositor_proxy: compositor_proxy,
|
||||||
constellation_chan: constellation_chan,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,16 +363,8 @@ impl webrender_traits::RenderNotifier for RenderNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pipeline_size_changed(&mut self,
|
fn pipeline_size_changed(&mut self,
|
||||||
pipeline_id: webrender_traits::PipelineId,
|
_: webrender_traits::PipelineId,
|
||||||
size: Option<webrender_traits::LayoutSize>) {
|
_: Option<webrender_traits::LayoutSize>) {
|
||||||
let pipeline_id = pipeline_id.from_webrender();
|
|
||||||
|
|
||||||
if let Some(size) = size {
|
|
||||||
let msg = ConstellationMsg::FrameSize(pipeline_id, size.to_untyped());
|
|
||||||
if let Err(e) = self.constellation_chan.send(msg) {
|
|
||||||
warn!("Compositor resize to constellation failed ({}).", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -817,12 +817,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
debug!("constellation exiting");
|
debug!("constellation exiting");
|
||||||
self.handle_exit();
|
self.handle_exit();
|
||||||
}
|
}
|
||||||
// The compositor discovered the size of a subframe. This needs to be reflected by all
|
|
||||||
// frame trees in the navigation context containing the subframe.
|
|
||||||
FromCompositorMsg::FrameSize(pipeline_id, size) => {
|
|
||||||
debug!("constellation got frame size message");
|
|
||||||
self.handle_frame_size_msg(pipeline_id, &TypedSize2D::from_untyped(&size));
|
|
||||||
}
|
|
||||||
FromCompositorMsg::GetFrame(pipeline_id, resp_chan) => {
|
FromCompositorMsg::GetFrame(pipeline_id, resp_chan) => {
|
||||||
debug!("constellation got get root pipeline message");
|
debug!("constellation got get root pipeline message");
|
||||||
self.handle_get_frame(pipeline_id, resp_chan);
|
self.handle_get_frame(pipeline_id, resp_chan);
|
||||||
|
@ -1089,6 +1083,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
FromLayoutMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
|
FromLayoutMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
|
||||||
self.handle_change_running_animations_state(pipeline_id, animation_state)
|
self.handle_change_running_animations_state(pipeline_id, animation_state)
|
||||||
}
|
}
|
||||||
|
// Layout sends new sizes for all subframes. This needs to be reflected by all
|
||||||
|
// frame trees in the navigation context containing the subframe.
|
||||||
|
FromLayoutMsg::FrameSizes(iframe_sizes) => {
|
||||||
|
debug!("constellation got frame size message");
|
||||||
|
self.handle_frame_size_msg(iframe_sizes);
|
||||||
|
}
|
||||||
FromLayoutMsg::SetCursor(cursor) => {
|
FromLayoutMsg::SetCursor(cursor) => {
|
||||||
self.handle_set_cursor_msg(cursor)
|
self.handle_set_cursor_msg(cursor)
|
||||||
}
|
}
|
||||||
|
@ -1327,30 +1327,30 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_frame_size_msg(&mut self,
|
fn handle_frame_size_msg(&mut self,
|
||||||
pipeline_id: PipelineId,
|
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>) {
|
||||||
size: &TypedSize2D<f32, PagePx>) {
|
for (pipeline_id, size) in iframe_sizes {
|
||||||
let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
|
let result = {
|
||||||
visible_viewport: *size,
|
let pipeline = match self.pipelines.get_mut(&pipeline_id) {
|
||||||
initial_viewport: *size * ScaleFactor::new(1.0),
|
Some(pipeline) => pipeline,
|
||||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
None => continue,
|
||||||
}, WindowSizeType::Initial);
|
};
|
||||||
|
|
||||||
// Store the new rect inside the pipeline
|
if pipeline.size == Some(size) {
|
||||||
let result = {
|
continue;
|
||||||
// Find the pipeline that corresponds to this rectangle. It's possible that this
|
|
||||||
// pipeline may have already exited before we process this message, so just
|
|
||||||
// early exit if that occurs.
|
|
||||||
match self.pipelines.get_mut(&pipeline_id) {
|
|
||||||
Some(pipeline) => {
|
|
||||||
pipeline.size = Some(*size);
|
|
||||||
pipeline.event_loop.send(msg)
|
|
||||||
}
|
}
|
||||||
None => return,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Err(e) = result {
|
pipeline.size = Some(size);
|
||||||
self.handle_send_error(pipeline_id, e);
|
let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
|
||||||
|
visible_viewport: size,
|
||||||
|
initial_viewport: size * ScaleFactor::new(1.0),
|
||||||
|
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||||
|
}, WindowSizeType::Initial);
|
||||||
|
|
||||||
|
pipeline.event_loop.send(msg)
|
||||||
|
};
|
||||||
|
if let Err(e) = result {
|
||||||
|
self.handle_send_error(pipeline_id, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use app_units::{AU_PER_PX, Au};
|
||||||
use block::{BlockFlow, BlockStackingContextType};
|
use block::{BlockFlow, BlockStackingContextType};
|
||||||
use canvas_traits::{CanvasData, CanvasMsg, FromLayoutMsg};
|
use canvas_traits::{CanvasData, CanvasMsg, FromLayoutMsg};
|
||||||
use context::SharedLayoutContext;
|
use context::SharedLayoutContext;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D};
|
||||||
use flex::FlexFlow;
|
use flex::FlexFlow;
|
||||||
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
||||||
use flow_ref::FlowRef;
|
use flow_ref::FlowRef;
|
||||||
|
@ -32,6 +32,7 @@ use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use list_item::ListItemFlow;
|
use list_item::ListItemFlow;
|
||||||
use model::{self, MaybeAuto};
|
use model::{self, MaybeAuto};
|
||||||
|
use msg::constellation_msg::PipelineId;
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
use net_traits::image_cache_thread::UsePlaceholder;
|
use net_traits::image_cache_thread::UsePlaceholder;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
|
@ -56,6 +57,7 @@ use style::servo::restyle_damage::REPAINT;
|
||||||
use style::values::{RGBA, computed};
|
use style::values::{RGBA, computed};
|
||||||
use style::values::computed::{AngleOrCorner, Gradient, GradientKind, LengthOrPercentage, LengthOrPercentageOrAuto};
|
use style::values::computed::{AngleOrCorner, Gradient, GradientKind, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||||
use style::values::specified::{HorizontalDirection, VerticalDirection};
|
use style::values::specified::{HorizontalDirection, VerticalDirection};
|
||||||
|
use style_traits::PagePx;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
use table_cell::CollapsedBordersForCell;
|
use table_cell::CollapsedBordersForCell;
|
||||||
use webrender_traits::{ColorF, GradientStop, ScrollPolicy};
|
use webrender_traits::{ColorF, GradientStop, ScrollPolicy};
|
||||||
|
@ -105,6 +107,10 @@ pub struct DisplayListBuildState<'a> {
|
||||||
/// The current scroll root id, used to keep track of state when
|
/// The current scroll root id, used to keep track of state when
|
||||||
/// recursively building and processing the display list.
|
/// recursively building and processing the display list.
|
||||||
pub current_scroll_root_id: ScrollRootId,
|
pub current_scroll_root_id: ScrollRootId,
|
||||||
|
|
||||||
|
/// Vector containing iframe sizes, used to inform the constellation about
|
||||||
|
/// new iframe sizes
|
||||||
|
pub iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DisplayListBuildState<'a> {
|
impl<'a> DisplayListBuildState<'a> {
|
||||||
|
@ -118,6 +124,7 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
processing_scroll_root_element: false,
|
processing_scroll_root_element: false,
|
||||||
current_stacking_context_id: StackingContextId::root(),
|
current_stacking_context_id: StackingContextId::root(),
|
||||||
current_scroll_root_id: ScrollRootId::root(),
|
current_scroll_root_id: ScrollRootId::root(),
|
||||||
|
iframe_sizes: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1443,6 +1450,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
iframe: fragment_info.pipeline_id,
|
iframe: fragment_info.pipeline_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let size = Size2D::new(item.bounds().size.width.to_f32_px(),
|
||||||
|
item.bounds().size.height.to_f32_px());
|
||||||
|
state.iframe_sizes.push((fragment_info.pipeline_id, TypedSize2D::from_untyped(&size)));
|
||||||
|
|
||||||
state.add_display_item(item);
|
state.add_display_item(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -933,6 +933,17 @@ impl LayoutThread {
|
||||||
let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
|
let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
|
||||||
build_state.root_stacking_context.bounds = origin;
|
build_state.root_stacking_context.bounds = origin;
|
||||||
build_state.root_stacking_context.overflow = origin;
|
build_state.root_stacking_context.overflow = origin;
|
||||||
|
|
||||||
|
if !build_state.iframe_sizes.is_empty() {
|
||||||
|
// build_state.iframe_sizes is only used here, so its okay to replace
|
||||||
|
// it with an empty vector
|
||||||
|
let iframe_sizes = std::mem::replace(&mut build_state.iframe_sizes, vec![]);
|
||||||
|
let msg = ConstellationMsg::FrameSizes(iframe_sizes);
|
||||||
|
if let Err(e) = self.constellation_chan.send(msg) {
|
||||||
|
warn!("Layout resize to constellation failed ({}).", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rw_data.display_list = Some(Arc::new(build_state.to_display_list()));
|
rw_data.display_list = Some(Arc::new(build_state.to_display_list()));
|
||||||
}
|
}
|
||||||
(ReflowGoal::ForScriptQuery, false) => {}
|
(ReflowGoal::ForScriptQuery, false) => {}
|
||||||
|
|
|
@ -696,8 +696,6 @@ pub enum WebDriverCommandMsg {
|
||||||
pub enum ConstellationMsg {
|
pub enum ConstellationMsg {
|
||||||
/// Exit the constellation.
|
/// Exit the constellation.
|
||||||
Exit,
|
Exit,
|
||||||
/// Inform the constellation of the size of the viewport.
|
|
||||||
FrameSize(PipelineId, Size2D<f32>),
|
|
||||||
/// Request that the constellation send the FrameId corresponding to the document
|
/// Request that the constellation send the FrameId corresponding to the document
|
||||||
/// with the provided pipeline id
|
/// with the provided pipeline id
|
||||||
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
|
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
|
||||||
|
|
|
@ -15,7 +15,7 @@ use WorkerScriptLoadOrigin;
|
||||||
use canvas_traits::CanvasMsg;
|
use canvas_traits::CanvasMsg;
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::size::Size2D;
|
use euclid::size::{Size2D, TypedSize2D};
|
||||||
use gfx_traits::ScrollRootId;
|
use gfx_traits::ScrollRootId;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection};
|
use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection};
|
||||||
|
@ -24,6 +24,7 @@ use net_traits::CoreResourceMsg;
|
||||||
use net_traits::storage_thread::StorageType;
|
use net_traits::storage_thread::StorageType;
|
||||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
use style_traits::PagePx;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
|
|
||||||
|
@ -32,6 +33,8 @@ use style_traits::viewport::ViewportConstraints;
|
||||||
pub enum LayoutMsg {
|
pub enum LayoutMsg {
|
||||||
/// Indicates whether this pipeline is currently running animations.
|
/// Indicates whether this pipeline is currently running animations.
|
||||||
ChangeRunningAnimationsState(PipelineId, AnimationState),
|
ChangeRunningAnimationsState(PipelineId, AnimationState),
|
||||||
|
/// Inform the constellation of the size of the pipeline's viewport.
|
||||||
|
FrameSizes(Vec<(PipelineId, TypedSize2D<f32, PagePx>)>),
|
||||||
/// Requests that the constellation inform the compositor of the a cursor change.
|
/// Requests that the constellation inform the compositor of the a cursor change.
|
||||||
SetCursor(Cursor),
|
SetCursor(Cursor),
|
||||||
/// Notifies the constellation that the viewport has been constrained in some manner
|
/// Notifies the constellation that the viewport has been constrained in some manner
|
||||||
|
|
Загрузка…
Ссылка в новой задаче