diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 5d29140e356..5d7b72b0910 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -2,9 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use AnimationTickType; use CompositionPipeline; -use CompositorMsg as ConstellationMsg; use SendableFrameTree; use app_units::Au; use compositor_layer::{CompositorData, CompositorLayer, RcCompositorLayer, WantsScrollEventsFlag}; @@ -37,8 +35,9 @@ use msg::constellation_msg::{WindowSizeData, WindowSizeType}; use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent}; -use script_traits::{AnimationState, ConstellationControlMsg, LayoutControlMsg}; -use script_traits::{MouseButton, MouseEventType, TouchpadPressurePhase, TouchEventType, TouchId}; +use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg}; +use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton}; +use script_traits::{MouseEventType, TouchpadPressurePhase, TouchEventType, TouchId}; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::{HashMap, HashSet}; use std::fs::File; diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index 79beb580daf..69c60cd2e0b 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -4,7 +4,6 @@ //! Communication with the compositor thread. -use CompositorMsg as ConstellationMsg; use SendableFrameTree; use compositor::{self, CompositingReason}; use euclid::point::Point2D; @@ -16,7 +15,7 @@ use layers::platform::surface::{NativeDisplay, NativeSurface}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId}; use profile_traits::mem; use profile_traits::time; -use script_traits::{AnimationState, EventResult, ScriptToCompositorMsg}; +use script_traits::{AnimationState, ConstellationMsg, EventResult, ScriptToCompositorMsg}; use std::fmt::{Debug, Error, Formatter}; use std::rc::Rc; use std::sync::mpsc::{Receiver, Sender, channel}; diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index e1e3305dca8..472c7bbd71f 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,41 +55,6 @@ 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 struct SendableFrameTree { pub pipeline: CompositionPipeline, pub size: Option>, diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index d0cd2973001..f595b4f6573 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -13,10 +13,9 @@ use canvas::canvas_paint_thread::CanvasPaintThread; use canvas::webgl_paint_thread::WebGLPaintThread; use canvas_traits::CanvasMsg; use clipboard::ClipboardContext; -use compositing::CompositorMsg as FromCompositorMsg; +use compositing::SendableFrameTree; use compositing::compositor_thread::CompositorProxy; use compositing::compositor_thread::Msg as ToCompositorMsg; -use compositing::{AnimationTickType, SendableFrameTree}; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; @@ -49,7 +48,8 @@ use profile_traits::time; use rand::{random, Rng, SeedableRng, StdRng}; #[cfg(not(target_os = "windows"))] use sandboxing::content_process_sandbox_profile; -use script_traits::{AnimationState, CompositorEvent, ConstellationControlMsg}; +use script_traits::{AnimationState, AnimationTickType, CompositorEvent}; +use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg}; use script_traits::{DocumentState, LayoutControlMsg}; use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; 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), +} diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 8e69e676201..335c040e61c 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -2480,7 +2480,6 @@ dependencies = [ name = "webdriver_server" version = "0.0.1" dependencies = [ - "compositing 0.0.1", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2490,6 +2489,7 @@ dependencies = [ "plugins 0.0.1", "regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "script_traits 0.0.1", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 16403134a1b..e208a4e89f1 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -58,7 +58,6 @@ fn webdriver(port: u16, constellation: Sender) { fn webdriver(_port: u16, _constellation: Sender) { } use compositing::CompositorEventListener; -use compositing::CompositorMsg as ConstellationMsg; use compositing::compositor_thread::InitialCompositorState; use compositing::windowing::WindowEvent; use compositing::windowing::WindowMethods; @@ -79,6 +78,7 @@ use profile::mem as profile_mem; use profile::time as profile_time; use profile_traits::mem; use profile_traits::time; +use script_traits::ConstellationMsg; use std::rc::Rc; use std::sync::mpsc::Sender; use util::resource_files::resources_dir_path; diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index de365ebdae3..d2e22b98b1a 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -9,7 +9,6 @@ name = "webdriver_server" path = "lib.rs" [dependencies] -compositing = {path = "../compositing"} msg = {path = "../msg"} plugins = {path = "../plugins"} util = {path = "../util"} @@ -20,6 +19,7 @@ log = "0.3.5" hyper = "0.9" rustc-serialize = "0.3.4" regex = "0.1.55" +script_traits = {path = "../script_traits"} url = {version = "1.0.0", features = ["heap_size"]} uuid = { version = "0.2", features = ["v4"] } webdriver = "0.9" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 92c339fb7d5..83771a1b070 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -10,7 +10,6 @@ #![deny(unsafe_code)] -extern crate compositing; extern crate euclid; extern crate hyper; extern crate image; @@ -18,6 +17,7 @@ extern crate ipc_channel; extern crate msg; extern crate regex; extern crate rustc_serialize; +extern crate script_traits; extern crate url; extern crate util; extern crate uuid; @@ -25,7 +25,6 @@ extern crate webdriver; mod keys; -use compositing::CompositorMsg as ConstellationMsg; use euclid::Size2D; use hyper::method::Method::{self, Post}; use image::{DynamicImage, ImageFormat, RgbImage}; @@ -37,6 +36,7 @@ use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriv use regex::Captures; use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; +use script_traits::ConstellationMsg; use std::borrow::ToOwned; use std::collections::BTreeMap; use std::net::{SocketAddr, SocketAddrV4}; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index a21f7c2de47..5f86dec09d8 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -2341,7 +2341,6 @@ dependencies = [ name = "webdriver_server" version = "0.0.1" dependencies = [ - "compositing 0.0.1", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2351,6 +2350,7 @@ dependencies = [ "plugins 0.0.1", "regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "script_traits 0.0.1", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",