diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index e1e3305dca8..7bde3a8213e 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -29,7 +29,6 @@ extern crate net_traits; #[macro_use] extern crate profile_traits; extern crate script_traits; -extern crate serde; extern crate style_traits; extern crate time; extern crate url; @@ -39,18 +38,13 @@ extern crate webrender; extern crate webrender_traits; pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread}; -use euclid::size::{Size2D, TypedSize2D}; +use euclid::size::TypedSize2D; use gfx::paint_thread::ChromeToPaintMsg; -use gfx_traits::Epoch; use ipc_channel::ipc::{IpcSender}; use layout_traits::LayoutControlChan; -use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData}; -use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId}; -use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData, WindowSizeType}; +use msg::constellation_msg::PipelineId; use script_traits::ConstellationControlMsg; -use std::collections::HashMap; use std::sync::mpsc::Sender; -use url::Url; use util::geometry::PagePx; mod compositor; @@ -61,40 +55,7 @@ mod surface_map; mod touch; pub mod windowing; -/// Specifies whether the script or layout thread needs to be ticked for animation. -#[derive(Deserialize, Serialize)] -pub enum AnimationTickType { - Script, - Layout, -} - -/// Messages from the compositor to the constellation. -#[derive(Deserialize, Serialize)] -pub enum CompositorMsg { - Exit, - FrameSize(PipelineId, Size2D), - /// Request that the constellation send the FrameId corresponding to the document - /// with the provided pipeline id - GetFrame(PipelineId, IpcSender>), - /// Request that the constellation send the current pipeline id for the provided frame - /// id, or for the root frame if this is None, over a provided channel. - /// Also returns a boolean saying whether the document has finished loading or not. - GetPipeline(Option, IpcSender>), - /// Requests that the constellation inform the compositor of the title of the pipeline - /// immediately. - GetPipelineTitle(PipelineId), - InitLoadUrl(Url), - /// Query the constellation to see if the current compositor output is stable - IsReadyToSaveImage(HashMap), - KeyEvent(Key, KeyState, KeyModifiers), - LoadUrl(PipelineId, LoadData), - Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection), - WindowSize(WindowSizeData, WindowSizeType), - /// Requests that the constellation instruct layout to begin a new tick of the animation. - TickAnimation(PipelineId, AnimationTickType), - /// Dispatch a webdriver command - WebDriverCommand(WebDriverCommandMsg), -} +pub use script_traits::{AnimationTickType, ConstellationMsg as CompositorMsg}; pub struct SendableFrameTree { pub pipeline: CompositionPipeline, diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 2dee02fec59..8d39895ed46 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -41,9 +41,10 @@ use gfx_traits::Epoch; use gfx_traits::LayerId; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; -use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; -use msg::constellation_msg::{PanicMsg, PipelineId, PipelineNamespaceId}; -use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{FrameId, Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId}; +use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData}; +use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeType}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; @@ -51,6 +52,8 @@ use net_traits::image_cache_thread::ImageCacheThread; use net_traits::response::HttpsState; use profile_traits::mem; use std::any::Any; +use std::collections::HashMap; +use url::Url; use util::ipc::OptionalOpaqueIpcSender; pub use script_msg::{LayoutMsg, ScriptMsg}; @@ -491,3 +494,47 @@ impl MozBrowserErrorType { } } } + +/// Specifies whether the script or layout thread needs to be ticked for animation. +#[derive(Deserialize, Serialize)] +pub enum AnimationTickType { + /// The script thread. + Script, + /// The layout thread. + Layout, +} + +/// Messages to the constellation. +#[derive(Deserialize, Serialize)] +pub enum ConstellationMsg { + /// Exit the constellation. + Exit, + /// Inform the constellation of the size of the viewport. + FrameSize(PipelineId, Size2D), + /// Request that the constellation send the FrameId corresponding to the document + /// with the provided pipeline id + GetFrame(PipelineId, IpcSender>), + /// Request that the constellation send the current pipeline id for the provided frame + /// id, or for the root frame if this is None, over a provided channel. + /// Also returns a boolean saying whether the document has finished loading or not. + GetPipeline(Option, IpcSender>), + /// Requests that the constellation inform the compositor of the title of the pipeline + /// immediately. + GetPipelineTitle(PipelineId), + /// Request to load the initial page. + InitLoadUrl(Url), + /// Query the constellation to see if the current compositor output is stable + IsReadyToSaveImage(HashMap), + /// Inform the constellation of a key event. + KeyEvent(Key, KeyState, KeyModifiers), + /// Request to load a page. + LoadUrl(PipelineId, LoadData), + /// Request to navigate a frame. + Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection), + /// Inform the constellation of a window being resized. + WindowSize(WindowSizeData, WindowSizeType), + /// Requests that the constellation instruct layout to begin a new tick of the animation. + TickAnimation(PipelineId, AnimationTickType), + /// Dispatch a webdriver command + WebDriverCommand(WebDriverCommandMsg), +}