Skip to content
Permalink
Browse files

Backed out changeset c424ad1c5f94 for build failures a=backout CLOSED…

… TREE

Backs out #17892
  • Loading branch information...
Gecko Backout authored and moz-servo-sync committed Jul 28, 2017
1 parent f022936 commit 3f1af3e62fbe982c2833da54df4aaf762be1442e

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -6,7 +6,7 @@ use CompositionPipeline;
use SendableFrameTree;
use compositor_thread::{CompositorProxy, CompositorReceiver};
use compositor_thread::{InitialCompositorState, Msg, RenderListener};
use euclid::{Point2D, TypedPoint2D, TypedVector2D, ScaleFactor};
use euclid::{Point2D, TypedPoint2D, TypedVector2D, TypedRect, ScaleFactor, TypedSize2D};
use gfx_traits::Epoch;
use gleam::gl;
use image::{DynamicImage, ImageFormat, RgbImage};
@@ -34,8 +34,7 @@ use style_traits::viewport::ViewportConstraints;
use time::{precise_time_ns, precise_time_s};
use touch::{TouchHandler, TouchAction};
use webrender;
use webrender_api::{self, ClipId, DeviceUintRect, DeviceUintSize, LayoutPoint, LayoutVector2D};
use webrender_api::{ScrollEventPhase, ScrollLocation, ScrollClamping};
use webrender_api::{self, ClipId, LayoutPoint, LayoutVector2D, ScrollEventPhase, ScrollLocation, ScrollClamping};
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods};

#[derive(Debug, PartialEq)]
@@ -111,10 +110,10 @@ pub struct IOCompositor<Window: WindowMethods> {
scale: ScaleFactor<f32, LayerPixel, DevicePixel>,

/// The size of the rendering area.
frame_size: DeviceUintSize,
frame_size: TypedSize2D<u32, DevicePixel>,

/// The position and size of the window within the rendering area.
window_rect: DeviceUintRect,
window_rect: TypedRect<u32, DevicePixel>,

/// "Mobile-style" zoom that does not reflow the page.
viewport_zoom: PinchZoomFactor,
@@ -180,9 +179,6 @@ pub struct IOCompositor<Window: WindowMethods> {
/// The webrender renderer.
webrender: webrender::Renderer,

/// The active webrender document.
webrender_document: webrender_api::DocumentId,

/// The webrender interface, if enabled.
webrender_api: webrender_api::RenderApi,

@@ -382,8 +378,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
scroll_in_progress: false,
in_scroll_transaction: None,
webrender: state.webrender,
webrender_document: state.webrender_document,
webrender_api: state.webrender_api,
webrender_api: state.webrender_api_sender.create_api(),
}
}

@@ -680,8 +675,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.root_pipeline = Some(frame_tree.pipeline.clone());

let pipeline_id = frame_tree.pipeline.id.to_webrender();
self.webrender_api.set_root_pipeline(self.webrender_document, pipeline_id);
self.webrender_api.generate_frame(self.webrender_document, None);
self.webrender_api.set_root_pipeline(pipeline_id);
self.webrender_api.generate_frame(None);

self.create_pipeline_details_for_frame_tree(&frame_tree);

@@ -705,7 +700,14 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn send_window_size(&self, size_type: WindowSizeType) {
let dppx = self.page_zoom * self.hidpi_factor();

self.webrender_api.set_window_parameters(self.webrender_document, self.frame_size, self.window_rect);
let window_rect = {
let offset = webrender_api::DeviceUintPoint::new(self.window_rect.origin.x, self.window_rect.origin.y);
let size = webrender_api::DeviceUintSize::new(self.window_rect.size.width, self.window_rect.size.height);
webrender_api::DeviceUintRect::new(offset, size)
};

let frame_size = webrender_api::DeviceUintSize::new(self.frame_size.width, self.frame_size.height);
self.webrender_api.set_window_parameters(frame_size, window_rect);

let initial_viewport = self.window_rect.size.to_f32() / dppx;

@@ -725,9 +727,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}

fn scroll_fragment_to_point(&mut self, id: ClipId, point: Point2D<f32>) {
self.webrender_api.scroll_node_with_id(self.webrender_document,
LayoutPoint::from_untyped(&point),
id,
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id,
ScrollClamping::ToContentBounds);
}

@@ -821,12 +821,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
WindowEvent::ToggleWebRenderProfiler => {
let profiler_enabled = self.webrender.get_profiler_enabled();
self.webrender.set_profiler_enabled(!profiler_enabled);
self.webrender_api.generate_frame(self.webrender_document, None);
self.webrender_api.generate_frame(None);
}
}
}

fn on_resize_window_event(&mut self, new_size: DeviceUintSize) {
fn on_resize_window_event(&mut self, new_size: TypedSize2D<u32, DevicePixel>) {
debug!("compositor resizing to {:?}", new_size.to_untyped());

// A size change could also mean a resolution change.
@@ -1123,7 +1123,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
(combined_event.cursor.to_f32() / self.scale).to_untyped();
let location = webrender_api::ScrollLocation::Delta(delta);
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
self.webrender_api.scroll(self.webrender_document, location, cursor, combined_event.phase);
self.webrender_api.scroll(location, cursor, combined_event.phase);
last_combined_event = None
}
}
@@ -1179,7 +1179,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
};
let cursor = (combined_event.cursor.to_f32() / self.scale).to_untyped();
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
self.webrender_api.scroll(self.webrender_document, scroll_location, cursor, combined_event.phase);
self.webrender_api.scroll(scroll_location, cursor, combined_event.phase);
self.waiting_for_results_of_scroll = true
}

@@ -1277,7 +1277,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {

fn update_page_zoom_for_webrender(&mut self) {
let page_zoom = webrender_api::ZoomFactor::new(self.page_zoom.get());
self.webrender_api.set_page_zoom(self.webrender_document, page_zoom);
self.webrender_api.set_page_zoom(page_zoom);
}

/// Simulate a pinch zoom
@@ -1315,7 +1315,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {

fn send_viewport_rects(&self) {
let mut scroll_states_per_pipeline = HashMap::new();
for scroll_layer_state in self.webrender_api.get_scroll_node_state(self.webrender_document) {
for scroll_layer_state in self.webrender_api.get_scroll_node_state() {
if scroll_layer_state.id.external_id().is_none() &&
!scroll_layer_state.id.is_root_scroll_node() {
continue;
@@ -1464,7 +1464,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
debug!("compositor: compositing");

// Paint the scene.
self.webrender.render(self.frame_size);
let size = webrender_api::DeviceUintSize::from_untyped(&self.frame_size.to_untyped());
self.webrender.render(size);
});

let rv = match target {
@@ -1564,7 +1565,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}

if self.webrender.layers_are_bouncing_back() {
self.webrender_api.tick_scrolling_bounce_animations(self.webrender_document);
self.webrender_api.tick_scrolling_bounce_animations();
self.send_viewport_rects()
}
}
@@ -194,6 +194,5 @@ pub struct InitialCompositorState {
pub mem_profiler_chan: mem::ProfilerChan,
/// Instance of webrender API
pub webrender: webrender::Renderer,
pub webrender_document: webrender_api::DocumentId,
pub webrender_api: webrender_api::RenderApi,
pub webrender_api_sender: webrender_api::RenderApiSender,
}
@@ -6,7 +6,7 @@

use compositor_thread::EventLoopWaker;
use euclid::{Point2D, Size2D};
use euclid::{ScaleFactor, TypedPoint2D, TypedSize2D};
use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D};
use gleam::gl;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TraversalDirection};
@@ -18,7 +18,7 @@ use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc;
use style_traits::DevicePixel;
use style_traits::cursor::Cursor;
use webrender_api::{DeviceUintSize, DeviceUintRect, ScrollLocation};
use webrender_api::ScrollLocation;

#[derive(Clone)]
pub enum MouseWindowEvent {
@@ -41,7 +41,7 @@ pub enum WindowEvent {
/// message, the window must make the same GL context as in `PrepareRenderingEvent` current.
Refresh,
/// Sent when the window is resized.
Resize(DeviceUintSize),
Resize(TypedSize2D<u32, DevicePixel>),
/// Touchpad Pressure
TouchpadPressure(TypedPoint2D<f32, DevicePixel>, f32, TouchpadPressurePhase),
/// Sent when a new URL is to be loaded.
@@ -105,9 +105,9 @@ pub enum AnimationState {

pub trait WindowMethods {
/// Returns the rendering area size in hardware pixels.
fn framebuffer_size(&self) -> DeviceUintSize;
fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel>;
/// Returns the position and size of the window within the rendering area.
fn window_rect(&self) -> DeviceUintRect;
fn window_rect(&self) -> TypedRect<u32, DevicePixel>;
/// Returns the size of the window in density-independent "px" units.
fn size(&self) -> TypedSize2D<f32, DeviceIndependentPixel>;
/// Presents the window to the screen (perhaps by page flipping).
@@ -228,11 +228,8 @@ pub struct Constellation<Message, LTF, STF> {
/// timer thread.
scheduler_chan: IpcSender<TimerSchedulerMsg>,

/// A single WebRender document the constellation operates on.
webrender_document: webrender_api::DocumentId,

/// A channel for the constellation to send messages to the
/// WebRender thread.
/// Webrender thread.
webrender_api_sender: webrender_api::RenderApiSender,

/// The set of all event loops in the browser. We generate a new
@@ -328,9 +325,6 @@ pub struct InitialConstellationState {
/// A channel to the memory profiler thread.
pub mem_profiler_chan: mem::ProfilerChan,

/// Webrender document ID.
pub webrender_document: webrender_api::DocumentId,

/// Webrender API.
pub webrender_api_sender: webrender_api::RenderApiSender,

@@ -567,7 +561,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
webdriver: WebDriverData::new(),
scheduler_chan: TimerScheduler::start(),
document_states: HashMap::new(),
webrender_document: state.webrender_document,
webrender_api_sender: state.webrender_api_sender,
shutting_down: false,
handled_warnings: VecDeque::new(),
@@ -671,9 +664,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>

let result = Pipeline::spawn::<Message, LTF, STF>(InitialPipelineState {
id: pipeline_id,
browsing_context_id,
top_level_browsing_context_id,
parent_info,
browsing_context_id: browsing_context_id,
top_level_browsing_context_id: top_level_browsing_context_id,
parent_info: parent_info,
constellation_chan: self.script_sender.clone(),
layout_to_constellation_chan: self.layout_sender.clone(),
scheduler_chan: self.scheduler_chan.clone(),
@@ -682,18 +675,17 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
bluetooth_thread: self.bluetooth_thread.clone(),
swmanager_thread: self.swmanager_sender.clone(),
font_cache_thread: self.font_cache_thread.clone(),
resource_threads,
resource_threads: resource_threads,
time_profiler_chan: self.time_profiler_chan.clone(),
mem_profiler_chan: self.mem_profiler_chan.clone(),
window_size: initial_window_size,
event_loop,
load_data,
event_loop: event_loop,
load_data: load_data,
device_pixel_ratio: self.window_size.device_pixel_ratio,
pipeline_namespace_id: self.next_pipeline_namespace_id(),
prev_visibility,
prev_visibility: prev_visibility,
webrender_api_sender: self.webrender_api_sender.clone(),
webrender_document: self.webrender_document,
is_private,
is_private: is_private,
webvr_thread: self.webvr_thread.clone()
});

@@ -156,7 +156,6 @@ pub struct InitialPipelineState {
/// Information about the page to load.
pub load_data: LoadData,


/// The ID of the pipeline namespace for this script thread.
pub pipeline_namespace_id: PipelineNamespaceId,

@@ -166,9 +165,6 @@ pub struct InitialPipelineState {
/// Webrender api.
pub webrender_api_sender: webrender_api::RenderApiSender,

/// The ID of the document processed by this script thread.
pub webrender_document: webrender_api::DocumentId,

/// Whether this pipeline is considered private.
pub is_private: bool,
/// A channel to the webvr thread.
@@ -269,7 +265,6 @@ impl Pipeline {
script_content_process_shutdown_chan: script_content_process_shutdown_chan,
script_content_process_shutdown_port: script_content_process_shutdown_port,
webrender_api_sender: state.webrender_api_sender,
webrender_document: state.webrender_document,
webvr_thread: state.webvr_thread,
};

@@ -469,7 +464,6 @@ pub struct UnprivilegedPipelineContent {
script_content_process_shutdown_chan: IpcSender<()>,
script_content_process_shutdown_port: IpcReceiver<()>,
webrender_api_sender: webrender_api::RenderApiSender,
webrender_document: webrender_api::DocumentId,
webvr_thread: Option<IpcSender<WebVRMsg>>,
}

@@ -516,7 +510,6 @@ impl UnprivilegedPipelineContent {
self.mem_profiler_chan,
Some(self.layout_content_process_shutdown_chan),
self.webrender_api_sender,
self.webrender_document,
self.prefs.get("layout.threads").expect("exists").value()
.as_u64().expect("count") as usize,
paint_time_metrics);
Oops, something went wrong.

0 comments on commit 3f1af3e

Please sign in to comment.
You can’t perform that action at this time.