diff --git a/servo/components/compositing/constellation.rs b/servo/components/compositing/constellation.rs index 7013d9250de4..01cd79ca6ef4 100644 --- a/servo/components/compositing/constellation.rs +++ b/servo/components/compositing/constellation.rs @@ -28,7 +28,6 @@ use msg::compositor_msg::Epoch; use msg::constellation_msg::AnimationState; use msg::constellation_msg::CompositorMsg as FromCompositorMsg; use msg::constellation_msg::PaintMsg as FromPaintMsg; -use msg::constellation_msg::ScriptMsg as FromScriptMsg; use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::{FrameId, PipelineId}; use msg::constellation_msg::{IframeLoadInfo, IFrameSandboxState, MozBrowserEvent, NavigationDirection}; @@ -46,7 +45,7 @@ use profile_traits::mem; use profile_traits::time; use sandboxing; use script_traits::{CompositorEvent, ConstellationControlMsg, LayoutControlMsg}; -use script_traits::{ScriptState, ScriptTaskFactory}; +use script_traits::{ScriptMsg as FromScriptMsg, ScriptState, ScriptTaskFactory}; use script_traits::{TimerEventRequest}; use std::borrow::ToOwned; use std::collections::HashMap; diff --git a/servo/components/compositing/pipeline.rs b/servo/components/compositing/pipeline.rs index c32e1f12cd0d..ffcb915153c9 100644 --- a/servo/components/compositing/pipeline.rs +++ b/servo/components/compositing/pipeline.rs @@ -16,7 +16,6 @@ use layers::geometry::DevicePixel; use layout_traits::{LayoutControlChan, LayoutTaskFactory}; use msg::compositor_msg::ScriptToCompositorMsg; use msg::constellation_msg::PaintMsg; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId}; use msg::constellation_msg::{LoadData, MozBrowserEvent, WindowSizeData}; use msg::constellation_msg::{PipelineNamespaceId}; @@ -26,8 +25,8 @@ use net_traits::storage_task::StorageTask; use profile_traits::mem as profile_mem; use profile_traits::time; use script_traits::{ConstellationControlMsg, InitialScriptState}; -use script_traits::{LayoutControlMsg, NewLayoutInfo, ScriptTaskFactory}; -use script_traits::{TimerEventRequest}; +use script_traits::{LayoutControlMsg, NewLayoutInfo, ScriptMsg as ConstellationMsg}; +use script_traits::{ScriptTaskFactory, TimerEventRequest}; use std::mem; use std::sync::mpsc::{Receiver, Sender, channel}; use std::thread; diff --git a/servo/components/layout/animation.rs b/servo/components/layout/animation.rs index fc8c9aa70020..628b693a2c07 100644 --- a/servo/components/layout/animation.rs +++ b/servo/components/layout/animation.rs @@ -7,9 +7,9 @@ use flow::{self, Flow}; use gfx::display_list::OpaqueNode; use incremental::{self, RestyleDamage}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId}; use script::layout_interface::Animation; +use script_traits::ScriptMsg as ConstellationMsg; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::sync::mpsc::{Sender, Receiver}; @@ -162,4 +162,3 @@ pub fn update_style_for_animation(animation: &Animation, *style = new_style } - diff --git a/servo/components/layout/layout_task.rs b/servo/components/layout/layout_task.rs index cf7ca56da00d..b1cad3cbd4a9 100644 --- a/servo/components/layout/layout_task.rs +++ b/servo/components/layout/layout_task.rs @@ -35,7 +35,6 @@ use layout_debug; use layout_traits::LayoutTaskFactory; use log; use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask}; use parallel::{self, WorkQueueData}; @@ -50,6 +49,7 @@ use script::layout_interface::{LayoutRPC, OffsetParentResponse}; use script::layout_interface::{Msg, NewLayoutTaskInfo, Reflow, ReflowGoal, ReflowQueryType}; use script::layout_interface::{ScriptLayoutChan, ScriptReflow}; use script::reporter::CSSErrorReporter; +use script_traits::ScriptMsg as ConstellationMsg; use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; use sequential; use serde_json; diff --git a/servo/components/layout/query.rs b/servo/components/layout/query.rs index 68b454b4cbae..83f758b0f50f 100644 --- a/servo/components/layout/query.rs +++ b/servo/components/layout/query.rs @@ -14,11 +14,11 @@ use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use gfx::display_list::{DisplayItemMetadata, OpaqueNode}; use layout_task::LayoutTaskData; use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use opaque_node::OpaqueNodeMethods; use script::layout_interface::{ContentBoxResponse, ContentBoxesResponse, NodeGeometryResponse}; use script::layout_interface::{HitTestResponse, LayoutRPC, MouseOverResponse, OffsetParentResponse}; use script::layout_interface::{ResolvedStyleResponse, ScriptLayoutChan}; +use script_traits::ScriptMsg as ConstellationMsg; use selectors::parser::PseudoElement; use sequential; use std::ops::Deref; diff --git a/servo/components/layout_traits/lib.rs b/servo/components/layout_traits/lib.rs index bbcb1d612d8f..f595e0a7f166 100644 --- a/servo/components/layout_traits/lib.rs +++ b/servo/components/layout_traits/lib.rs @@ -24,10 +24,10 @@ extern crate util; use gfx::font_cache_task::FontCacheTask; use gfx::paint_task::LayoutToPaintMsg; use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use net_traits::image_cache_task::ImageCacheTask; use profile_traits::{mem, time}; +use script_traits::ScriptMsg as ConstellationMsg; use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel}; use url::Url; use util::ipc::OptionalIpcSender; diff --git a/servo/components/msg/Cargo.toml b/servo/components/msg/Cargo.toml index f933b405b1ea..74106e9eaba0 100644 --- a/servo/components/msg/Cargo.toml +++ b/servo/components/msg/Cargo.toml @@ -10,12 +10,6 @@ path = "lib.rs" [dependencies.util] path = "../util" -[dependencies.canvas_traits] -path = "../canvas_traits" - -[dependencies.style_traits] -path = "../style_traits" - [dependencies.azure] git = "https://github.com/servo/rust-azure" features = ["plugins"] @@ -27,10 +21,6 @@ features = ["plugins"] [dependencies.ipc-channel] git = "https://github.com/servo/ipc-channel" -[dependencies.offscreen_gl_context] -git = "https://github.com/ecoal95/rust-offscreen-rendering-context" -features = ["texture_surface"] - [dependencies.plugins] path = "../plugins" diff --git a/servo/components/msg/constellation_msg.rs b/servo/components/msg/constellation_msg.rs index 139a77bc4fb8..0edf9c38075c 100644 --- a/servo/components/msg/constellation_msg.rs +++ b/servo/components/msg/constellation_msg.rs @@ -5,24 +5,19 @@ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling between these two components. -use canvas_traits::CanvasMsg; use compositor_msg::Epoch; -use euclid::point::Point2D; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; use hyper::header::Headers; use hyper::method::Method; use ipc_channel::ipc::{self, IpcReceiver, IpcSender, IpcSharedMemory}; use layers::geometry::DevicePixel; -use offscreen_gl_context::GLContextAttributes; use serde::{Deserialize, Serialize}; use std::cell::Cell; use std::collections::HashMap; use std::fmt; use std::sync::mpsc::channel; -use style_traits::viewport::ViewportConstraints; use url::Url; -use util::cursor::Cursor; use util::geometry::{PagePx, ViewportPx}; use util::mem::HeapSizeOf; use webdriver_msg::{LoadStatus, WebDriverScriptCommand}; @@ -257,54 +252,6 @@ pub enum CompositorMsg { WebDriverCommand(WebDriverCommandMsg), } -/// Messages from the script to the constellation. -#[derive(Deserialize, Serialize)] -pub enum ScriptMsg { - /// Indicates whether this pipeline is currently running animations. - ChangeRunningAnimationsState(PipelineId, AnimationState), - /// Requests that a new 2D canvas thread be created. (This is done in the constellation because - /// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.) - CreateCanvasPaintTask(Size2D, IpcSender<(IpcSender, usize)>), - /// Requests that a new WebGL thread be created. (This is done in the constellation because - /// WebGL uses the GPU and we don't want to give untrusted content access to the GPU.) - CreateWebGLPaintTask(Size2D, - GLContextAttributes, - IpcSender, usize), String>>), - /// Dispatched after the DOM load event has fired on a document - /// Causes a `load` event to be dispatched to any enclosing frame context element - /// for the given pipeline. - DOMLoad(PipelineId), - Failure(Failure), - /// Notifies the constellation that this frame has received focus. - Focus(PipelineId), - /// Re-send a mouse button event that was sent to the parent window. - ForwardMouseButtonEvent(PipelineId, MouseEventType, MouseButton, Point2D), - /// Re-send a mouse move event that was sent to the parent window. - ForwardMouseMoveEvent(PipelineId, Point2D), - /// Requests that the constellation retrieve the current contents of the clipboard - GetClipboardContents(IpcSender), - /// tag finished parsing - HeadParsed, - LoadComplete(PipelineId), - LoadUrl(PipelineId, LoadData), - /// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode. - MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent), - Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection), - /// Favicon detected - NewFavicon(Url), - /// Status message to be displayed in the chrome, eg. a link URL on mouseover. - NodeStatus(Option), - /// Notification that this iframe should be removed. - RemoveIFrame(PipelineId), - ScriptLoadedURLInIFrame(IframeLoadInfo), - /// Requests that the constellation set the contents of the clipboard - SetClipboardContents(String), - /// Requests that the constellation inform the compositor of the a cursor change. - SetCursor(Cursor), - /// Notifies the constellation that the viewport has been constrained in some manner - ViewportConstrained(PipelineId, ViewportConstraints), -} - #[derive(Deserialize, HeapSizeOf, Serialize)] pub enum MouseEventType { Click, diff --git a/servo/components/msg/lib.rs b/servo/components/msg/lib.rs index c989835e7ea4..ca8383225fdd 100644 --- a/servo/components/msg/lib.rs +++ b/servo/components/msg/lib.rs @@ -9,7 +9,6 @@ extern crate app_units; extern crate azure; #[macro_use] extern crate bitflags; -extern crate canvas_traits; #[cfg(target_os = "macos")] extern crate core_foundation; extern crate euclid; @@ -18,10 +17,8 @@ extern crate hyper; extern crate io_surface; extern crate ipc_channel; extern crate layers; -extern crate offscreen_gl_context; extern crate rustc_serialize; extern crate serde; -extern crate style_traits; extern crate url; extern crate util; diff --git a/servo/components/script/clipboard_provider.rs b/servo/components/script/clipboard_provider.rs index 87e168ed2888..5c88a72aad48 100644 --- a/servo/components/script/clipboard_provider.rs +++ b/servo/components/script/clipboard_provider.rs @@ -4,7 +4,7 @@ use ipc_channel::ipc; use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; +use script_traits::ScriptMsg as ConstellationMsg; use std::borrow::ToOwned; use std::sync::mpsc::channel; diff --git a/servo/components/script/dom/bindings/global.rs b/servo/components/script/dom/bindings/global.rs index aaa37c5292c6..d3ece2ae98ea 100644 --- a/servo/components/script/dom/bindings/global.rs +++ b/servo/components/script/dom/bindings/global.rs @@ -18,12 +18,11 @@ use ipc_channel::ipc::IpcSender; use js::jsapi::GetGlobalForObjectCrossCompartment; use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue}; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, PipelineId}; use net_traits::ResourceTask; use profile_traits::mem; use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask}; -use script_traits::{MsDuration, TimerEventRequest}; +use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest}; use timers::{ScheduledCallback, TimerHandle}; use url::Url; use util::mem::HeapSizeOf; diff --git a/servo/components/script/dom/bindings/trace.rs b/servo/components/script/dom/bindings/trace.rs index 8c4a20d643ab..cbe870f073c6 100644 --- a/servo/components/script/dom/bindings/trace.rs +++ b/servo/components/script/dom/bindings/trace.rs @@ -54,7 +54,7 @@ use js::jsval::JSVal; use js::rust::Runtime; use layout_interface::{LayoutChan, LayoutRPC}; use libc; -use msg::constellation_msg::{ConstellationChan, ScriptMsg}; +use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData}; use net_traits::Metadata; use net_traits::image::base::Image; @@ -63,7 +63,7 @@ use net_traits::storage_task::StorageType; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_task::ScriptChan; -use script_traits::{TimerEventId, TimerSource, UntrustedNodeAddress}; +use script_traits::{ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress}; use selectors::parser::PseudoElement; use selectors::states::*; use serde::{Deserialize, Serialize}; diff --git a/servo/components/script/dom/canvasrenderingcontext2d.rs b/servo/components/script/dom/canvasrenderingcontext2d.rs index 119f819cf8e9..22e1c388f59e 100644 --- a/servo/components/script/dom/canvasrenderingcontext2d.rs +++ b/servo/components/script/dom/canvasrenderingcontext2d.rs @@ -35,10 +35,10 @@ use euclid::point::Point2D; use euclid::rect::Rect; use euclid::size::Size2D; use ipc_channel::ipc::{self, IpcSender}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use net_traits::image::base::PixelFormat; use net_traits::image_cache_task::ImageResponse; use num::{Float, ToPrimitive}; +use script_traits::ScriptMsg as ConstellationMsg; use std::str::FromStr; use std::sync::mpsc::channel; use std::{cmp, fmt}; diff --git a/servo/components/script/dom/document.rs b/servo/components/script/dom/document.rs index 7b375e34129e..b816624b10c3 100644 --- a/servo/components/script/dom/document.rs +++ b/servo/components/script/dom/document.rs @@ -81,7 +81,6 @@ use layout_interface::{HitTestResponse, MouseOverResponse}; use layout_interface::{LayoutChan, Msg}; use layout_interface::{ReflowGoal, ReflowQueryType}; use msg::compositor_msg::ScriptToCompositorMsg; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState}; @@ -91,7 +90,7 @@ use net_traits::CookieSource::NonHTTP; use net_traits::{AsyncResponseTarget, PendingAsyncLoad}; use num::ToPrimitive; use script_task::{MainThreadScriptMsg, Runnable}; -use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress}; +use script_traits::{ScriptMsg as ConstellationMsg, TouchEventType, TouchId, UntrustedNodeAddress}; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::boxed::FnBox; diff --git a/servo/components/script/dom/htmlbodyelement.rs b/servo/components/script/dom/htmlbodyelement.rs index f7605ed5aa3e..79c549fd55db 100644 --- a/servo/components/script/dom/htmlbodyelement.rs +++ b/servo/components/script/dom/htmlbodyelement.rs @@ -18,7 +18,7 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; +use script_traits::ScriptMsg as ConstellationMsg; use std::rc::Rc; use string_cache::Atom; use time; diff --git a/servo/components/script/dom/htmliframeelement.rs b/servo/components/script/dom/htmliframeelement.rs index 3798ab4f5390..7039340ead21 100644 --- a/servo/components/script/dom/htmliframeelement.rs +++ b/servo/components/script/dom/htmliframeelement.rs @@ -25,10 +25,10 @@ use dom::window::Window; use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue}; use js::jsval::{UndefinedValue, NullValue}; use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, IframeLoadInfo, MozBrowserEvent}; use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId}; use page::IterablePage; +use script_traits::ScriptMsg as ConstellationMsg; use std::ascii::AsciiExt; use std::cell::Cell; use string_cache::Atom; diff --git a/servo/components/script/dom/htmlinputelement.rs b/servo/components/script/dom/htmlinputelement.rs index cd640b83287a..6c3e9cdfb567 100644 --- a/servo/components/script/dom/htmlinputelement.rs +++ b/servo/components/script/dom/htmlinputelement.rs @@ -28,7 +28,7 @@ use dom::node::{document_from_node, window_from_node}; use dom::nodelist::NodeList; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; +use script_traits::ScriptMsg as ConstellationMsg; use selectors::states::*; use std::borrow::ToOwned; use std::cell::Cell; diff --git a/servo/components/script/dom/htmllinkelement.rs b/servo/components/script/dom/htmllinkelement.rs index 3ded045c8349..d302430d7565 100644 --- a/servo/components/script/dom/htmllinkelement.rs +++ b/servo/components/script/dom/htmllinkelement.rs @@ -24,10 +24,10 @@ use encoding::all::UTF_8; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use layout_interface::{LayoutChan, Msg}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, MozBrowserEvent}; use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata}; use network_listener::{NetworkListener, PreInvoke}; +use script_traits::ScriptMsg as ConstellationMsg; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::Cell; diff --git a/servo/components/script/dom/htmltextareaelement.rs b/servo/components/script/dom/htmltextareaelement.rs index 12d0a47a6c87..1c77d98f69df 100644 --- a/servo/components/script/dom/htmltextareaelement.rs +++ b/servo/components/script/dom/htmltextareaelement.rs @@ -25,9 +25,9 @@ use dom::node::{document_from_node, window_from_node}; use dom::nodelist::NodeList; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use script_task::ScriptTaskEventCategory::InputEvent; use script_task::{CommonScriptMsg, Runnable}; +use script_traits::ScriptMsg as ConstellationMsg; use selectors::states::*; use std::cell::Cell; use string_cache::Atom; diff --git a/servo/components/script/dom/webglrenderingcontext.rs b/servo/components/script/dom/webglrenderingcontext.rs index eecfeceee159..e9a8b922a484 100644 --- a/servo/components/script/dom/webglrenderingcontext.rs +++ b/servo/components/script/dom/webglrenderingcontext.rs @@ -31,10 +31,10 @@ use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{JSContext, JSObject, RootedValue}; use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView}; use js::jsval::{BooleanValue, Int32Value, JSVal, NullValue, UndefinedValue}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use net_traits::image::base::PixelFormat; use net_traits::image_cache_task::ImageResponse; use offscreen_gl_context::GLContextAttributes; +use script_traits::ScriptMsg as ConstellationMsg; use std::cell::Cell; use std::sync::mpsc::channel; use std::{ptr, slice}; diff --git a/servo/components/script/dom/window.rs b/servo/components/script/dom/window.rs index 41201082e7f0..fd471cc4d38c 100644 --- a/servo/components/script/dom/window.rs +++ b/servo/components/script/dom/window.rs @@ -43,7 +43,6 @@ use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleRe use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType}; use libc; use msg::compositor_msg::{LayerId, ScriptToCompositorMsg}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData}; use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use net_traits::ResourceTask; @@ -56,6 +55,7 @@ use reporter::CSSErrorReporter; use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64}; use script_task::{ScriptChan, ScriptPort, MainThreadScriptMsg, RunnableWrapper}; use script_task::{SendableMainThreadScriptChan, MainThreadScriptChan}; +use script_traits::ScriptMsg as ConstellationMsg; use script_traits::{MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSource}; use selectors::parser::PseudoElement; use std::ascii::AsciiExt; diff --git a/servo/components/script/dom/workerglobalscope.rs b/servo/components/script/dom/workerglobalscope.rs index bef4f3547a1e..7df9b312df57 100644 --- a/servo/components/script/dom/workerglobalscope.rs +++ b/servo/components/script/dom/workerglobalscope.rs @@ -20,11 +20,11 @@ use dom::workernavigator::WorkerNavigator; use ipc_channel::ipc::IpcSender; use js::jsapi::{HandleValue, JSAutoRequest, JSContext}; use js::rust::Runtime; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, PipelineId}; use net_traits::{ResourceTask, load_whole_resource}; use profile_traits::mem; use script_task::{CommonScriptMsg, ScriptChan, ScriptPort}; +use script_traits::ScriptMsg as ConstellationMsg; use script_traits::{MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSource}; use std::cell::Cell; use std::default::Default; diff --git a/servo/components/script/layout_interface.rs b/servo/components/script/layout_interface.rs index 4a78e23e23c5..a38385cebb30 100644 --- a/servo/components/script/layout_interface.rs +++ b/servo/components/script/layout_interface.rs @@ -14,13 +14,12 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::uintptr_t; use msg::compositor_msg::Epoch; use msg::compositor_msg::LayerId; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{WindowSizeData}; use net_traits::image_cache_task::ImageCacheTask; use profile_traits::mem::ReportsChan; -use script_traits::{ConstellationControlMsg, LayoutControlMsg}; -use script_traits::{OpaqueScriptLayoutChannel, UntrustedNodeAddress}; +use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; +use script_traits::{ScriptMsg as ConstellationMsg, UntrustedNodeAddress}; use selectors::parser::PseudoElement; use std::any::Any; use std::sync::Arc; diff --git a/servo/components/script/script_task.rs b/servo/components/script/script_task.rs index f0ea6bd13546..1dcf707a7358 100644 --- a/servo/components/script/script_task.rs +++ b/servo/components/script/script_task.rs @@ -62,7 +62,6 @@ use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLa use libc; use mem::heap_size_of_self_and_children; use msg::compositor_msg::{EventResult, LayerId, ScriptToCompositorMsg}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, LoadData}; use msg::constellation_msg::{MouseButton, MouseEventType, MozBrowserEvent, PipelineId}; use msg::constellation_msg::{PipelineNamespace}; @@ -81,8 +80,8 @@ use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{TouchEvent}; use script_traits::{CompositorEvent, ConstellationControlMsg, InitialScriptState, NewLayoutInfo}; -use script_traits::{OpaqueScriptLayoutChannel, ScriptState, ScriptTaskFactory}; -use script_traits::{TimerEvent, TimerEventRequest, TimerSource}; +use script_traits::{OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg, ScriptState}; +use script_traits::{ScriptTaskFactory, TimerEvent, TimerEventRequest, TimerSource}; use script_traits::{TouchEventType, TouchId}; use std::any::Any; use std::borrow::ToOwned; diff --git a/servo/components/script_traits/Cargo.toml b/servo/components/script_traits/Cargo.toml index 4181c32508cb..c0017f26bf88 100644 --- a/servo/components/script_traits/Cargo.toml +++ b/servo/components/script_traits/Cargo.toml @@ -7,18 +7,28 @@ authors = ["The Servo Project Developers"] name = "script_traits" path = "lib.rs" +[dependencies.canvas_traits] +path = "../canvas_traits" + [dependencies.msg] path = "../msg" [dependencies.net_traits] path = "../net_traits" +[dependencies.offscreen_gl_context] +git = "https://github.com/ecoal95/rust-offscreen-rendering-context" +features = ["texture_surface"] + [dependencies.plugins] path = "../plugins" [dependencies.profile_traits] path = "../profile_traits" +[dependencies.style_traits] +path = "../style_traits" + [dependencies.util] path = "../util" diff --git a/servo/components/script_traits/lib.rs b/servo/components/script_traits/lib.rs index ef86ee260853..09aeef327859 100644 --- a/servo/components/script_traits/lib.rs +++ b/servo/components/script_traits/lib.rs @@ -11,18 +11,23 @@ #![deny(missing_docs)] extern crate app_units; +extern crate canvas_traits; extern crate devtools_traits; extern crate euclid; extern crate ipc_channel; extern crate libc; extern crate msg; extern crate net_traits; +extern crate offscreen_gl_context; extern crate profile_traits; extern crate serde; +extern crate style_traits; extern crate time; extern crate url; extern crate util; +mod script_msg; + use app_units::Au; use devtools_traits::ScriptToDevtoolsControlMsg; use euclid::length::Length; @@ -31,7 +36,6 @@ use euclid::rect::Rect; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; use msg::compositor_msg::{Epoch, LayerId, ScriptToCompositorMsg}; -use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; use msg::constellation_msg::{MouseButton, MouseEventType}; @@ -45,6 +49,8 @@ use std::any::Any; use util::ipc::OptionalOpaqueIpcSender; use util::mem::HeapSizeOf; +pub use script_msg::ScriptMsg; + /// The address of a node. Layout sends these back. They must be validated via /// `from_untrusted_node_address` before they can be used, because we do not trust layout. #[derive(Copy, Clone, Debug)] @@ -249,7 +255,7 @@ pub struct InitialScriptState { /// A port on which messages sent by the constellation to script can be received. pub control_port: IpcReceiver, /// A channel on which messages can be sent to the constellation from script. - pub constellation_chan: ConstellationChan, + pub constellation_chan: ConstellationChan, /// A channel to schedule timer events. pub scheduler_chan: IpcSender, /// Information that script sends out when it panics. diff --git a/servo/components/script_traits/script_msg.rs b/servo/components/script_traits/script_msg.rs new file mode 100644 index 000000000000..7769dbe8597a --- /dev/null +++ b/servo/components/script_traits/script_msg.rs @@ -0,0 +1,69 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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 canvas_traits::CanvasMsg; +use euclid::point::Point2D; +use euclid::size::Size2D; +use ipc_channel::ipc::IpcSender; +use msg::constellation_msg::{AnimationState, IframeLoadInfo, NavigationDirection}; +use msg::constellation_msg::{Failure, MozBrowserEvent, PipelineId}; +use msg::constellation_msg::{LoadData, SubpageId}; +use msg::constellation_msg::{MouseButton, MouseEventType}; +use offscreen_gl_context::GLContextAttributes; +use style_traits::viewport::ViewportConstraints; +use url::Url; +use util::cursor::Cursor; + +/// Messages from the script to the constellation. +#[derive(Deserialize, Serialize)] +pub enum ScriptMsg { + /// Indicates whether this pipeline is currently running animations. + ChangeRunningAnimationsState(PipelineId, AnimationState), + /// Requests that a new 2D canvas thread be created. (This is done in the constellation because + /// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.) + CreateCanvasPaintTask(Size2D, IpcSender<(IpcSender, usize)>), + /// Requests that a new WebGL thread be created. (This is done in the constellation because + /// WebGL uses the GPU and we don't want to give untrusted content access to the GPU.) + CreateWebGLPaintTask(Size2D, + GLContextAttributes, + IpcSender, usize), String>>), + /// Dispatched after the DOM load event has fired on a document + /// Causes a `load` event to be dispatched to any enclosing frame context element + /// for the given pipeline. + DOMLoad(PipelineId), + /// Script task failure. + Failure(Failure), + /// Notifies the constellation that this frame has received focus. + Focus(PipelineId), + /// Re-send a mouse button event that was sent to the parent window. + ForwardMouseButtonEvent(PipelineId, MouseEventType, MouseButton, Point2D), + /// Re-send a mouse move event that was sent to the parent window. + ForwardMouseMoveEvent(PipelineId, Point2D), + /// Requests that the constellation retrieve the current contents of the clipboard + GetClipboardContents(IpcSender), + /// tag finished parsing + HeadParsed, + /// All pending loads are complete. + LoadComplete(PipelineId), + /// A new load has been requested. + LoadUrl(PipelineId, LoadData), + /// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode. + MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent), + /// HTMLIFrameElement Forward or Back navigation. + Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection), + /// Favicon detected + NewFavicon(Url), + /// Status message to be displayed in the chrome, eg. a link URL on mouseover. + NodeStatus(Option), + /// Notification that this iframe should be removed. + RemoveIFrame(PipelineId), + /// A load has been requested in an IFrame. + ScriptLoadedURLInIFrame(IframeLoadInfo), + /// Requests that the constellation set the contents of the clipboard + SetClipboardContents(String), + /// Requests that the constellation inform the compositor of the a cursor change. + SetCursor(Cursor), + /// Notifies the constellation that the viewport has been constrained in some manner + ViewportConstrained(PipelineId, ViewportConstraints), +} diff --git a/servo/components/servo/Cargo.lock b/servo/components/servo/Cargo.lock index 5180c6e167bf..ec0ea24c1b2f 100644 --- a/servo/components/servo/Cargo.lock +++ b/servo/components/servo/Cargo.lock @@ -1112,19 +1112,16 @@ dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)", - "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "style_traits 0.0.1", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -1551,16 +1548,19 @@ name = "script_traits" version = "0.0.1" dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "canvas_traits 0.0.1", "devtools_traits 0.0.1", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "profile_traits 0.0.1", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "style_traits 0.0.1", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", diff --git a/servo/ports/cef/Cargo.lock b/servo/ports/cef/Cargo.lock index 6c23c3fb4556..177aad203063 100644 --- a/servo/ports/cef/Cargo.lock +++ b/servo/ports/cef/Cargo.lock @@ -1072,19 +1072,16 @@ dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)", - "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "style_traits 0.0.1", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -1467,16 +1464,19 @@ name = "script_traits" version = "0.0.1" dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "canvas_traits 0.0.1", "devtools_traits 0.0.1", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "profile_traits 0.0.1", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "style_traits 0.0.1", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", diff --git a/servo/ports/gonk/Cargo.lock b/servo/ports/gonk/Cargo.lock index 9036b5d4773f..ce26c67f259a 100644 --- a/servo/ports/gonk/Cargo.lock +++ b/servo/ports/gonk/Cargo.lock @@ -1048,19 +1048,16 @@ dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "azure 0.2.1 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "canvas_traits 0.0.1", "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "layers 0.2.0 (git+https://github.com/servo/rust-layers)", - "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "style_traits 0.0.1", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -1443,16 +1440,19 @@ name = "script_traits" version = "0.0.1" dependencies = [ "app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "canvas_traits 0.0.1", "devtools_traits 0.0.1", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "plugins 0.0.1", "profile_traits 0.0.1", "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "style_traits 0.0.1", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1",