diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index d92c5f1b82e..6c087690b5f 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -28,7 +28,8 @@ extern crate msg; extern crate net_traits; extern crate profile_traits; extern crate rustc_serialize; -#[macro_use] extern crate serde; +#[macro_use] +extern crate serde; extern crate servo_atoms; extern crate servo_channel; extern crate servo_url; @@ -135,12 +136,16 @@ pub struct LoadData { /// The creator pipeline id if this is an about:blank load. pub creator_pipeline_id: Option, /// The method. - #[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] + #[serde( + deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize" + )] pub method: Method, /// The headers. - #[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] + #[serde( + deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize" + )] pub headers: Headers, /// The data. pub data: Option>, @@ -159,16 +164,17 @@ pub enum JsEvalResult { /// 12.11 NoContent, /// The js evaluation had a string result. - Ok(Vec) + Ok(Vec), } impl LoadData { /// Create a new `LoadData` object. - pub fn new(url: ServoUrl, - creator_pipeline_id: Option, - referrer_policy: Option, - referrer_url: Option) - -> LoadData { + pub fn new( + url: ServoUrl, + creator_pipeline_id: Option, + referrer_policy: Option, + referrer_url: Option, + ) -> LoadData { LoadData { url: url, creator_pipeline_id: creator_pipeline_id, @@ -294,7 +300,12 @@ pub enum ConstellationControlMsg { PostMessage(PipelineId, Option, Vec), /// Updates the current pipeline ID of a given iframe. /// First PipelineId is for the parent, second is the new PipelineId for the frame. - UpdatePipelineId(PipelineId, BrowsingContextId, PipelineId, UpdatePipelineIdReason), + UpdatePipelineId( + PipelineId, + BrowsingContextId, + PipelineId, + UpdatePipelineIdReason, + ), /// Updates the history state and url of a given pipeline. UpdateHistoryState(PipelineId, Option, ServoUrl), /// Removes inaccesible history states. @@ -322,7 +333,14 @@ pub enum ConstellationControlMsg { }, /// Cause a `storage` event to be dispatched at the appropriate window. /// The strings are key, old value and new value. - DispatchStorageEvent(PipelineId, StorageType, ServoUrl, Option, Option, Option), + DispatchStorageEvent( + PipelineId, + StorageType, + ServoUrl, + Option, + Option, + Option, + ), /// Report an error from a CSS parser for the given pipeline ReportCSSError(PipelineId, String, u32, u32, String), /// Reload the given page. @@ -447,19 +465,29 @@ pub enum CompositorEvent { MouseButton, Point2D, Option, - Option> + Option>, ), /// The mouse was moved over a point (or was moved out of the recognizable region). MouseMoveEvent(Option>, Option), /// A touch event was generated with a touch ID and location. - TouchEvent(TouchEventType, TouchId, Point2D, Option), + TouchEvent( + TouchEventType, + TouchId, + Point2D, + Option, + ), /// A key was pressed. KeyEvent(Option, Key, KeyState, KeyModifiers), } /// Requests a TimerEvent-Message be sent after the given duration. #[derive(Deserialize, Serialize)] -pub struct TimerEventRequest(pub IpcSender, pub TimerSource, pub TimerEventId, pub MsDuration); +pub struct TimerEventRequest( + pub IpcSender, + pub TimerSource, + pub TimerEventId, + pub MsDuration, +); /// Type of messages that can be sent to the timer scheduler. #[derive(Deserialize, Serialize)] @@ -568,8 +596,10 @@ pub trait ScriptThreadFactory { /// Type of message sent from script to layout. type Message; /// Create a `ScriptThread`. - fn create(state: InitialScriptState, load_data: LoadData) - -> (Sender, Receiver); + fn create( + state: InitialScriptState, + load_data: LoadData, + ) -> (Sender, Receiver); } /// Whether the sandbox attribute is present for an iframe element @@ -678,7 +708,11 @@ pub enum WebDriverCommandMsg { /// Act as if keys were pressed in the browsing context with the given ID. SendKeys(BrowsingContextId, Vec<(Key, KeyModifiers, KeyState)>), /// Set the window size. - SetWindowSize(TopLevelBrowsingContextId, DeviceUintSize, IpcSender), + SetWindowSize( + TopLevelBrowsingContextId, + DeviceUintSize, + IpcSender, + ), /// Take a screenshot of the window. TakeScreenshot(TopLevelBrowsingContextId, IpcSender>), } @@ -706,7 +740,11 @@ pub enum ConstellationMsg { /// Request to traverse the joint session history of the provided browsing context. TraverseHistory(TopLevelBrowsingContextId, TraversalDirection), /// Inform the constellation of a window being resized. - WindowSize(Option, WindowSizeData, WindowSizeType), + WindowSize( + Option, + WindowSizeData, + WindowSizeType, + ), /// Requests that the constellation instruct layout to begin a new tick of the animation. TickAnimation(PipelineId, AnimationTickType), /// Dispatch a webdriver command @@ -808,17 +846,20 @@ pub enum PaintWorkletError { /// Execute paint code in the worklet thread pool. pub trait Painter: SpeculativePainter { /// - fn draw_a_paint_image(&self, - size: TypedSize2D, - zoom: TypedScale, - properties: Vec<(Atom, String)>, - arguments: Vec) - -> Result; + fn draw_a_paint_image( + &self, + size: TypedSize2D, + zoom: TypedScale, + properties: Vec<(Atom, String)>, + arguments: Vec, + ) -> Result; } impl fmt::Debug for Painter { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - fmt.debug_tuple("Painter").field(&format_args!("..")).finish() + fmt.debug_tuple("Painter") + .field(&format_args!("..")) + .finish() } } diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 6dba5c00509..ca8c5463aa8 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -92,7 +92,13 @@ pub enum ScriptMsg { InitiateNavigateRequest(RequestInit, /* cancellation_chan */ IpcReceiver<()>), /// Broadcast a storage event to every same-origin pipeline. /// The strings are key, old value and new value. - BroadcastStorageEvent(StorageType, ServoUrl, Option, Option, Option), + BroadcastStorageEvent( + StorageType, + ServoUrl, + Option, + Option, + Option, + ), /// Indicates whether this pipeline is currently running animations. ChangeRunningAnimationsState(AnimationState), /// Requests that a new 2D canvas thread be created. (This is done in the constellation because @@ -107,9 +113,16 @@ pub enum ScriptMsg { /// Get the parent info for a given pipeline. GetParentInfo(PipelineId, IpcSender>), /// Get the top-level browsing context info for a given browsing context. - GetTopForBrowsingContext(BrowsingContextId, IpcSender>), + GetTopForBrowsingContext( + BrowsingContextId, + IpcSender>, + ), /// Get the nth child browsing context ID for a given browsing context, sorted in tree order. - GetChildBrowsingContextId(BrowsingContextId, usize, IpcSender>), + GetChildBrowsingContextId( + BrowsingContextId, + usize, + IpcSender>, + ), /// All pending loads are complete, and the `load` event for this pipeline /// has been dispatched. LoadComplete, @@ -142,7 +155,10 @@ pub enum ScriptMsg { /// A load of the initial `about:blank` has been completed in an IFrame. ScriptNewIFrame(IFrameLoadInfo, IpcSender), /// Script has opened a new auxiliary browsing context. - ScriptNewAuxiliary(AuxiliaryBrowsingContextLoadInfo, IpcSender), + ScriptNewAuxiliary( + AuxiliaryBrowsingContextLoadInfo, + IpcSender, + ), /// Requests that the constellation set the contents of the clipboard SetClipboardContents(String), /// Mark a new document as active diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs index e53e6e77ae3..b24aeca5198 100644 --- a/components/script_traits/webdriver_msg.rs +++ b/components/script_traits/webdriver_msg.rs @@ -14,10 +14,14 @@ use servo_url::ServoUrl; #[derive(Deserialize, Serialize)] pub enum WebDriverScriptCommand { - AddCookie(#[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] - Cookie<'static>, - IpcSender>), + AddCookie( + #[serde( + deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize" + )] + Cookie<'static>, + IpcSender>, + ), ExecuteScript(String, IpcSender), ExecuteAsyncScript(String, IpcSender), FindElementCSS(String, IpcSender, ()>>),