From 54bb138ddcbb853acb089c728b14bf5fe6255023 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 4 Jul 2016 14:03:16 +0200 Subject: [PATCH 1/3] Move WebDriverCommandMsg to script_traits. --- components/constellation/constellation.rs | 3 +-- components/msg/constellation_msg.rs | 16 ++----------- components/script_traits/lib.rs | 28 +++++++++++++++++++---- components/webdriver_server/lib.rs | 4 ++-- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 585fc5372fe..45f41cd82d2 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -24,7 +24,6 @@ use gfx_traits::Epoch; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use layout_traits::LayoutThreadFactory; -use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::{FrameId, FrameType, PipelineId}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection}; @@ -46,7 +45,7 @@ use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorM use script_traits::{DocumentState, LayoutControlMsg}; use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; -use script_traits::{MozBrowserEvent, MozBrowserErrorType}; +use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg}; use std::borrow::ToOwned; use std::collections::HashMap; use std::io::Error as IOError; diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 8d81702c465..5ab9ac75a3b 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -6,16 +6,15 @@ //! reduce coupling between these two components. use euclid::scale_factor::ScaleFactor; -use euclid::size::{Size2D, TypedSize2D}; +use euclid::size::TypedSize2D; use hyper::header::Headers; use hyper::method::Method; -use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; +use ipc_channel::ipc::IpcSharedMemory; use layers::geometry::DevicePixel; use std::cell::Cell; use std::fmt; use url::Url; use util::geometry::{PagePx, ViewportPx}; -use webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use webrender_traits; pub type PanicMsg = (Option, String, String); @@ -186,17 +185,6 @@ bitflags! { } } -#[derive(Deserialize, Serialize)] -pub enum WebDriverCommandMsg { - GetWindowSize(PipelineId, IpcSender), - LoadUrl(PipelineId, LoadData, IpcSender), - Refresh(PipelineId, IpcSender), - ScriptCommand(PipelineId, WebDriverScriptCommand), - SendKeys(PipelineId, Vec<(Key, KeyModifiers, KeyState)>), - SetWindowSize(PipelineId, Size2D, IpcSender), - TakeScreenshot(PipelineId, IpcSender>), -} - #[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)] pub enum PixelFormat { K8, // Luminance channel only diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 5b1b169e8aa..75671dff2ff 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -43,11 +43,10 @@ use gfx_traits::StackingContextId; use heapsize::HeapSizeOf; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; -use msg::constellation_msg::{FrameId, FrameType, Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{FrameId, FrameType, Image, 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 msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData, WindowSizeType}; +use msg::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::ImageCacheThread; @@ -522,6 +521,27 @@ pub struct StackingContextScrollState { pub scroll_offset: Point2D, } +/// Messages to the constellation originating from the WebDriver server. +#[derive(Deserialize, Serialize)] +pub enum WebDriverCommandMsg { + /// Get the window size. + GetWindowSize(PipelineId, IpcSender), + /// Load a URL in the pipeline with the given ID. + LoadUrl(PipelineId, LoadData, IpcSender), + /// Refresh the pipeline with the given ID. + Refresh(PipelineId, IpcSender), + /// Pass a webdriver command to the script thread of the pipeline with the + /// given ID for execution. + ScriptCommand(PipelineId, WebDriverScriptCommand), + /// Act as if keys were pressed in the pipeline with the given ID. + SendKeys(PipelineId, Vec<(Key, KeyModifiers, KeyState)>), + /// Set the window size. + SetWindowSize(PipelineId, Size2D, IpcSender), + /// Take a screenshot of the window, if the pipeline with the given ID is + /// the root pipeline. + TakeScreenshot(PipelineId, IpcSender>), +} + /// Messages to the constellation. #[derive(Deserialize, Serialize)] pub enum ConstellationMsg { diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 586bbac1def..39a91e2143b 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -32,13 +32,13 @@ use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use keys::keycodes_to_keys; use msg::constellation_msg::{FrameId, LoadData, PipelineId}; -use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg}; +use msg::constellation_msg::{NavigationDirection, PixelFormat}; use msg::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId}; use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use regex::Captures; use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; -use script_traits::ConstellationMsg; +use script_traits::{ConstellationMsg, WebDriverCommandMsg}; use std::borrow::ToOwned; use std::collections::BTreeMap; use std::net::{SocketAddr, SocketAddrV4}; From b8fe9e9637a0824b028c307c0648052ccb6090a1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 4 Jul 2016 14:30:38 +0200 Subject: [PATCH 2/3] Move WindowSizeData to script_traits. --- components/compositing/compositor.rs | 10 ++++----- components/constellation/constellation.rs | 4 ++-- components/constellation/pipeline.rs | 4 ++-- components/msg/Cargo.toml | 2 -- components/msg/constellation_msg.rs | 17 --------------- components/msg/lib.rs | 2 -- components/script/dom/bindings/trace.rs | 4 ++-- components/script/dom/window.rs | 5 ++--- components/script/script_thread.rs | 4 ++-- components/script_layout_interface/message.rs | 4 ++-- components/script_traits/Cargo.toml | 1 + components/script_traits/lib.rs | 21 ++++++++++++++++++- components/servo/Cargo.lock | 3 +-- ports/cef/Cargo.lock | 3 +-- 14 files changed, 40 insertions(+), 44 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index bc450c44c59..270a6b656d0 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -28,16 +28,16 @@ use layers::platform::surface::NativeDisplay; use layers::rendergl; use layers::rendergl::RenderContext; use layers::scene::Scene; -use msg::constellation_msg::{Image, PixelFormat}; -use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; -use msg::constellation_msg::{NavigationDirection, PipelineId, PipelineIndex, PipelineNamespaceId}; -use msg::constellation_msg::{WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{LoadData, NavigationDirection, PipelineId}; +use msg::constellation_msg::{PipelineIndex, PipelineNamespaceId, 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, AnimationTickType, ConstellationControlMsg}; use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton, MouseEventType}; -use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType, TouchId}; +use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType}; +use script_traits::{TouchId, WindowSizeData}; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::{HashMap, HashSet}; use std::fs::File; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 45f41cd82d2..9c7ca3fa3ad 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -27,7 +27,7 @@ use layout_traits::LayoutThreadFactory; use msg::constellation_msg::{FrameId, FrameType, PipelineId}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection}; -use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{SubpageId, WindowSizeType}; use msg::constellation_msg::{self, PanicMsg}; use msg::webdriver_msg; use net_traits::bluetooth_thread::BluetoothMethodMsg; @@ -45,7 +45,7 @@ use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorM use script_traits::{DocumentState, LayoutControlMsg}; use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; -use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg}; +use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg, WindowSizeData}; use std::borrow::ToOwned; use std::collections::HashMap; use std::io::Error as IOError; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index b86cc7ad695..5c472dc250e 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -18,7 +18,7 @@ use ipc_channel::router::ROUTER; use layers::geometry::DevicePixel; use layout_traits::LayoutThreadFactory; use msg::constellation_msg::{FrameId, FrameType, LoadData, PanicMsg, PipelineId}; -use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData}; +use msg::constellation_msg::{PipelineNamespaceId, SubpageId}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::ImageCacheThread; @@ -26,7 +26,7 @@ use profile_traits::mem as profile_mem; use profile_traits::time; use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent}; use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg}; -use script_traits::{ScriptThreadFactory, TimerEventRequest}; +use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData}; use std::collections::HashMap; use std::io::Error as IOError; use std::process; diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index 86185814757..dfa430505ca 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -17,13 +17,11 @@ heapsize = "0.3.0" heapsize_plugin = "0.1.2" hyper = {version = "0.9.9", features = ["serde-serialization"]} ipc-channel = {git = "https://github.com/servo/ipc-channel"} -layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]} plugins = {path = "../plugins"} rustc-serialize = "0.3.4" serde = "0.7.11" serde_macros = "0.7.11" url = {version = "1.0.0", features = ["heap_size", "serde"]} -util = {path = "../util", features = ["servo"]} [dependencies.webrender_traits] git = "https://github.com/servo/webrender_traits" diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 5ab9ac75a3b..b0047e6043d 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -5,33 +5,16 @@ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling between these two components. -use euclid::scale_factor::ScaleFactor; -use euclid::size::TypedSize2D; use hyper::header::Headers; use hyper::method::Method; use ipc_channel::ipc::IpcSharedMemory; -use layers::geometry::DevicePixel; use std::cell::Cell; use std::fmt; use url::Url; -use util::geometry::{PagePx, ViewportPx}; use webrender_traits; pub type PanicMsg = (Option, String, String); -#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)] -pub struct WindowSizeData { - /// The size of the initial layout viewport, before parsing an - /// http://www.w3.org/TR/css-device-adapt/#initial-viewport - pub initial_viewport: TypedSize2D, - - /// The "viewing area" in page px. See `PagePx` documentation for details. - pub visible_viewport: TypedSize2D, - - /// The resolution of the window in dppx, not including any "pinch zoom" factor. - pub device_pixel_ratio: ScaleFactor, -} - #[derive(Deserialize, Eq, PartialEq, Serialize, Copy, Clone, HeapSizeOf)] pub enum WindowSizeType { Initial, diff --git a/components/msg/lib.rs b/components/msg/lib.rs index bac2f1a6011..a3eda6b1796 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -15,11 +15,9 @@ extern crate euclid; extern crate heapsize; extern crate hyper; extern crate ipc_channel; -extern crate layers; extern crate rustc_serialize; extern crate serde; extern crate url; -extern crate util; extern crate webrender_traits; pub mod constellation_msg; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index d066db9dfcb..7404e96b95d 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -56,7 +56,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, TraceKind, JSObject, JSTracer}; use js::jsval::JSVal; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, PipelineId, SubpageId, WindowSizeData, WindowSizeType, ReferrerPolicy}; +use msg::constellation_msg::{FrameType, PipelineId, SubpageId, WindowSizeType, ReferrerPolicy}; use net_traits::filemanager_thread::{SelectedFileId, RelativePos}; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -70,7 +70,7 @@ use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; use script_runtime::ScriptChan; -use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress}; +use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress, WindowSizeData}; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::boxed::FnBox; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 6f012e9c31e..181e29f9263 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -43,8 +43,7 @@ use js::jsapi::{JS_GetRuntime, JS_GC, MutableHandleValue, SetWindowProxy}; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId}; -use msg::constellation_msg::{WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId, WindowSizeType}; use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -66,7 +65,7 @@ use script_thread::SendableMainThreadScriptChan; use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper}; use script_traits::{ConstellationControlMsg, UntrustedNodeAddress}; use script_traits::{DocumentState, MsDuration, TimerEvent, TimerEventId}; -use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource}; +use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource, WindowSizeData}; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::Cell; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 7a23867fc8b..92bfaf87244 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -65,7 +65,7 @@ use js::jsval::UndefinedValue; use js::rust::Runtime; use mem::heap_size_of_self_and_children; use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace}; -use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{SubpageId, WindowSizeType}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::LoadData as NetLoadData; use net_traits::bluetooth_thread::BluetoothMethodMsg; @@ -87,7 +87,7 @@ use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent}; use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg}; use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource}; -use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress}; +use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData}; use std::borrow::ToOwned; use std::cell::Cell; use std::collections::{HashMap, HashSet}; diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index e3c8a14e4c3..a2b92853218 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -7,12 +7,12 @@ use euclid::point::Point2D; use euclid::rect::Rect; use gfx_traits::{Epoch, LayerId}; use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use msg::constellation_msg::{PanicMsg, PipelineId, WindowSizeData}; +use msg::constellation_msg::{PanicMsg, PipelineId}; use net_traits::image_cache_thread::ImageCacheThread; use profile_traits::mem::ReportsChan; use rpc::LayoutRPC; use script_traits::{ConstellationControlMsg, LayoutControlMsg}; -use script_traits::{LayoutMsg as ConstellationMsg, StackingContextScrollState}; +use script_traits::{LayoutMsg as ConstellationMsg, StackingContextScrollState, WindowSizeData}; use std::sync::Arc; use std::sync::mpsc::{Receiver, Sender}; use string_cache::Atom; diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 26612783a85..3c28cc00f23 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -17,6 +17,7 @@ gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" heapsize_plugin = "0.1.2" ipc-channel = {git = "https://github.com/servo/ipc-channel"} +layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]} libc = "0.2" msg = {path = "../msg"} net_traits = {path = "../net_traits"} diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 75671dff2ff..938d754ce71 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -18,6 +18,7 @@ extern crate euclid; extern crate gfx_traits; extern crate heapsize; extern crate ipc_channel; +extern crate layers; extern crate libc; extern crate msg; extern crate net_traits; @@ -37,15 +38,18 @@ use euclid::Size2D; use euclid::length::Length; use euclid::point::Point2D; use euclid::rect::Rect; +use euclid::scale_factor::ScaleFactor; +use euclid::size::TypedSize2D; use gfx_traits::Epoch; use gfx_traits::LayerId; use gfx_traits::StackingContextId; use heapsize::HeapSizeOf; use ipc_channel::ipc::{IpcReceiver, IpcSender}; +use layers::geometry::DevicePixel; use libc::c_void; use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId}; -use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData, WindowSizeType}; +use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeType}; use msg::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; @@ -56,6 +60,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::collections::HashMap; use std::sync::mpsc::{Sender, Receiver}; use url::Url; +use util::geometry::{PagePx, ViewportPx}; use util::ipc::OptionalOpaqueIpcSender; pub use script_msg::{LayoutMsg, ScriptMsg, EventResult}; @@ -521,6 +526,20 @@ pub struct StackingContextScrollState { pub scroll_offset: Point2D, } +/// Data about the window size. +#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)] +pub struct WindowSizeData { + /// The size of the initial layout viewport, before parsing an + /// http://www.w3.org/TR/css-device-adapt/#initial-viewport + pub initial_viewport: TypedSize2D, + + /// The "viewing area" in page px. See `PagePx` documentation for details. + pub visible_viewport: TypedSize2D, + + /// The resolution of the window in dppx, not including any "pinch zoom" factor. + pub device_pixel_ratio: ScaleFactor, +} + /// Messages to the constellation originating from the WebDriver server. #[derive(Deserialize, Serialize)] pub enum WebDriverCommandMsg { diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 98ff10d0483..70a5c4e9d58 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1384,13 +1384,11 @@ dependencies = [ "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", "plugins 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "util 0.0.1", "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", ] @@ -2012,6 +2010,7 @@ dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", + "layers 0.2.6 (git+https://github.com/servo/rust-layers)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 22f9af94530..fc12206253c 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1286,13 +1286,11 @@ dependencies = [ "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", "plugins 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "util 0.0.1", "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", ] @@ -1856,6 +1854,7 @@ dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", + "layers 0.2.6 (git+https://github.com/servo/rust-layers)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", From 77caf83098baf8a9157d388442abcd243eb5825c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 4 Jul 2016 14:45:29 +0200 Subject: [PATCH 3/3] Move webdriver_msg to script_traits. --- components/constellation/constellation.rs | 2 +- components/msg/Cargo.toml | 3 --- components/msg/lib.rs | 4 ---- components/script/dom/window.rs | 2 +- components/script/script_thread.rs | 2 +- components/script/webdriver_handlers.rs | 4 ++-- components/script_traits/Cargo.toml | 2 ++ components/script_traits/lib.rs | 5 ++++- components/{msg => script_traits}/webdriver_msg.rs | 4 +++- components/servo/Cargo.lock | 5 ++--- components/webdriver_server/lib.rs | 4 ++-- ports/cef/Cargo.lock | 5 ++--- 12 files changed, 20 insertions(+), 22 deletions(-) rename components/{msg => script_traits}/webdriver_msg.rs (97%) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 9c7ca3fa3ad..7c3a95dbc54 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -29,7 +29,6 @@ use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection}; use msg::constellation_msg::{SubpageId, WindowSizeType}; use msg::constellation_msg::{self, PanicMsg}; -use msg::webdriver_msg; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::filemanager_thread::FileManagerThreadMsg; use net_traits::image_cache_thread::ImageCacheThread; @@ -40,6 +39,7 @@ use pipeline::{ChildProcess, InitialPipelineState, Pipeline}; use profile_traits::mem; use profile_traits::time; use rand::{random, Rng, SeedableRng, StdRng}; +use script_traits::webdriver_msg; use script_traits::{AnimationState, AnimationTickType, CompositorEvent}; use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg}; use script_traits::{DocumentState, LayoutControlMsg}; diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index dfa430505ca..72359201734 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -10,15 +10,12 @@ path = "lib.rs" [dependencies] bitflags = "0.7" -cookie = { version = "0.2.5", features = ["serialize-rustc", "serialize-serde"]} cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} -euclid = "0.7.1" heapsize = "0.3.0" heapsize_plugin = "0.1.2" hyper = {version = "0.9.9", features = ["serde-serialization"]} ipc-channel = {git = "https://github.com/servo/ipc-channel"} plugins = {path = "../plugins"} -rustc-serialize = "0.3.4" serde = "0.7.11" serde_macros = "0.7.11" url = {version = "1.0.0", features = ["heap_size", "serde"]} diff --git a/components/msg/lib.rs b/components/msg/lib.rs index a3eda6b1796..13923b16b6e 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -10,15 +10,11 @@ #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags; -extern crate cookie as cookie_rs; -extern crate euclid; extern crate heapsize; extern crate hyper; extern crate ipc_channel; -extern crate rustc_serialize; extern crate serde; extern crate url; extern crate webrender_traits; pub mod constellation_msg; -pub mod webdriver_msg; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 181e29f9263..4eaa1c6e568 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -44,7 +44,6 @@ use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use libc; use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId, WindowSizeType}; -use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; use net_traits::storage_thread::StorageType; @@ -63,6 +62,7 @@ use script_layout_interface::rpc::{MarginStyleResponse, ResolvedStyleResponse}; use script_runtime::{ScriptChan, ScriptPort, maybe_take_panic_result}; use script_thread::SendableMainThreadScriptChan; use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper}; +use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use script_traits::{ConstellationControlMsg, UntrustedNodeAddress}; use script_traits::{DocumentState, MsDuration, TimerEvent, TimerEventId}; use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource, WindowSizeData}; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 92bfaf87244..2367ecc0fd9 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -66,7 +66,6 @@ use js::rust::Runtime; use mem::heap_size_of_self_and_children; use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace}; use msg::constellation_msg::{SubpageId, WindowSizeType}; -use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::LoadData as NetLoadData; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread}; @@ -83,6 +82,7 @@ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use script_runtime::{ScriptPort, StackRootTLS, new_rt_and_cx, get_reports}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{TouchEvent, TouchpadPressureEvent}; +use script_traits::webdriver_msg::WebDriverScriptCommand; use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent}; use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg}; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 16395e53bc0..2711cfb1225 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -31,12 +31,12 @@ use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{JSContext, HandleValue}; use js::jsval::UndefinedValue; use msg::constellation_msg::PipelineId; -use msg::webdriver_msg::WebDriverCookieError; -use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue}; use net_traits::CookieSource::{HTTP, NonHTTP}; use net_traits::CoreResourceMsg::{GetCookiesDataForUrl, SetCookiesForUrlWithData}; use net_traits::IpcSend; use script_thread::get_browsing_context; +use script_traits::webdriver_msg::WebDriverCookieError; +use script_traits::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue}; use url::Url; fn find_node_by_unique_id(context: &BrowsingContext, diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 3c28cc00f23..8df51d11d6e 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -11,6 +11,7 @@ path = "lib.rs" [dependencies] app_units = "0.2.5" canvas_traits = {path = "../canvas_traits"} +cookie = { version = "0.2.5", features = ["serialize-rustc", "serialize-serde"]} devtools_traits = {path = "../devtools_traits"} euclid = "0.7.1" gfx_traits = {path = "../gfx_traits"} @@ -24,6 +25,7 @@ net_traits = {path = "../net_traits"} offscreen_gl_context = "0.1.2" plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} +rustc-serialize = "0.3.4" serde = "0.7.11" serde_macros = "0.7.11" style_traits = {path = "../style_traits", features = ["servo"]} diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 938d754ce71..bd82a498d46 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -13,6 +13,7 @@ extern crate app_units; extern crate canvas_traits; +extern crate cookie as cookie_rs; extern crate devtools_traits; extern crate euclid; extern crate gfx_traits; @@ -24,6 +25,7 @@ extern crate msg; extern crate net_traits; extern crate offscreen_gl_context; extern crate profile_traits; +extern crate rustc_serialize; extern crate serde; extern crate style_traits; extern crate time; @@ -31,6 +33,7 @@ extern crate url; extern crate util; mod script_msg; +pub mod webdriver_msg; use app_units::Au; use devtools_traits::ScriptToDevtoolsControlMsg; @@ -50,7 +53,6 @@ use libc::c_void; use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId}; use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeType}; -use msg::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::ImageCacheThread; @@ -62,6 +64,7 @@ use std::sync::mpsc::{Sender, Receiver}; use url::Url; use util::geometry::{PagePx, ViewportPx}; use util::ipc::OptionalOpaqueIpcSender; +use webdriver_msg::{LoadStatus, WebDriverScriptCommand}; pub use script_msg::{LayoutMsg, ScriptMsg, EventResult}; diff --git a/components/msg/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs similarity index 97% rename from components/msg/webdriver_msg.rs rename to components/script_traits/webdriver_msg.rs index ea848ce431d..0694c97f29d 100644 --- a/components/msg/webdriver_msg.rs +++ b/components/script_traits/webdriver_msg.rs @@ -2,10 +2,12 @@ * 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 constellation_msg::PipelineId; +#![allow(missing_docs)] + use cookie_rs::Cookie; use euclid::rect::Rect; use ipc_channel::ipc::IpcSender; +use msg::constellation_msg::PipelineId; use rustc_serialize::json::{Json, ToJson}; use url::Url; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 70a5c4e9d58..4dcd8197b2e 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1377,15 +1377,12 @@ name = "msg" version = "0.0.1" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", "plugins 0.0.1", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2004,6 +2001,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", + "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", @@ -2017,6 +2015,7 @@ dependencies = [ "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "style_traits 0.0.1", diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 39a91e2143b..5e862f36d9d 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -33,11 +33,11 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use keys::keycodes_to_keys; use msg::constellation_msg::{FrameId, LoadData, PipelineId}; use msg::constellation_msg::{NavigationDirection, PixelFormat}; -use msg::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId}; -use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use regex::Captures; use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; +use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId}; +use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use script_traits::{ConstellationMsg, WebDriverCommandMsg}; use std::borrow::ToOwned; use std::collections::BTreeMap; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index fc12206253c..8ddc81e43ac 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1279,15 +1279,12 @@ name = "msg" version = "0.0.1" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", "plugins 0.0.1", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1848,6 +1845,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", + "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", @@ -1861,6 +1859,7 @@ dependencies = [ "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "style_traits 0.0.1",