Rustfmt script_traits.

This commit is contained in:
Ms2ger 2017-01-03 14:07:14 +01:00
parent bf643f5356
commit 2dde348b12
3 changed files with 20 additions and 26 deletions

View file

@ -18,7 +18,8 @@ extern crate devtools_traits;
extern crate euclid; extern crate euclid;
extern crate gfx_traits; extern crate gfx_traits;
extern crate heapsize; extern crate heapsize;
#[macro_use] extern crate heapsize_derive; #[macro_use]
extern crate heapsize_derive;
extern crate hyper; extern crate hyper;
extern crate hyper_serde; extern crate hyper_serde;
extern crate ipc_channel; extern crate ipc_channel;
@ -252,7 +253,7 @@ pub enum ConstellationControlMsg {
/// Report an error from a CSS parser for the given pipeline /// Report an error from a CSS parser for the given pipeline
ReportCSSError(PipelineId, String, usize, usize, String), ReportCSSError(PipelineId, String, usize, usize, String),
/// Reload the given page. /// Reload the given page.
Reload(PipelineId) Reload(PipelineId),
} }
impl fmt::Debug for ConstellationControlMsg { impl fmt::Debug for ConstellationControlMsg {
@ -284,7 +285,7 @@ impl fmt::Debug for ConstellationControlMsg {
DispatchStorageEvent(..) => "DispatchStorageEvent", DispatchStorageEvent(..) => "DispatchStorageEvent",
FramedContentChanged(..) => "FramedContentChanged", FramedContentChanged(..) => "FramedContentChanged",
ReportCSSError(..) => "ReportCSSError", ReportCSSError(..) => "ReportCSSError",
Reload(..) => "Reload" Reload(..) => "Reload",
}; };
write!(formatter, "ConstellationMsg::{}", variant) write!(formatter, "ConstellationMsg::{}", variant)
} }
@ -384,10 +385,7 @@ pub enum TouchpadPressurePhase {
/// Requests a TimerEvent-Message be sent after the given duration. /// Requests a TimerEvent-Message be sent after the given duration.
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct TimerEventRequest(pub IpcSender<TimerEvent>, pub struct TimerEventRequest(pub IpcSender<TimerEvent>, pub TimerSource, pub TimerEventId, pub MsDuration);
pub TimerSource,
pub TimerEventId,
pub MsDuration);
/// Notifies the script thread to fire due timers. /// Notifies the script thread to fire due timers.
/// `TimerSource` must be `FromWindow` when dispatched to `ScriptThread` and /// `TimerSource` must be `FromWindow` when dispatched to `ScriptThread` and
@ -479,9 +477,7 @@ pub trait ScriptThreadFactory {
/// Type of message sent from script to layout. /// Type of message sent from script to layout.
type Message; type Message;
/// Create a `ScriptThread`. /// Create a `ScriptThread`.
fn create(state: InitialScriptState, fn create(state: InitialScriptState, load_data: LoadData) -> (Sender<Self::Message>, Receiver<Self::Message>);
load_data: LoadData)
-> (Sender<Self::Message>, Receiver<Self::Message>);
} }
/// Whether the sandbox attribute is present for an iframe element /// Whether the sandbox attribute is present for an iframe element
@ -490,7 +486,7 @@ pub enum IFrameSandboxState {
/// Sandbox attribute is present /// Sandbox attribute is present
IFrameSandboxed, IFrameSandboxed,
/// Sandbox attribute is not present /// Sandbox attribute is not present
IFrameUnsandboxed IFrameUnsandboxed,
} }
/// Specifies the information required to load an iframe. /// Specifies the information required to load an iframe.
@ -744,5 +740,5 @@ pub struct WorkerScriptLoadOrigin {
/// the referrer policy which is used /// the referrer policy which is used
pub referrer_policy: Option<ReferrerPolicy>, pub referrer_policy: Option<ReferrerPolicy>,
/// the pipeline id of the entity requesting the load /// the pipeline id of the entity requesting the load
pub pipeline_id: Option<PipelineId> pub pipeline_id: Option<PipelineId>,
} }

View file

@ -57,7 +57,7 @@ pub enum LogEntry {
/// Error, with a reason /// Error, with a reason
Error(String), Error(String),
/// warning, with a reason /// warning, with a reason
Warn(String) Warn(String),
} }
/// Messages from the script to the constellation. /// Messages from the script to the constellation.
@ -148,7 +148,7 @@ pub enum ScriptMsg {
/// Enter or exit fullscreen /// Enter or exit fullscreen
SetFullscreenState(bool), SetFullscreenState(bool),
/// Requests that the compositor shut down. /// Requests that the compositor shut down.
Exit Exit,
} }
/// Entities required to spawn service workers /// Entities required to spawn service workers
@ -175,7 +175,7 @@ pub struct SWManagerSenders {
/// sender for communicating with constellation /// sender for communicating with constellation
pub swmanager_sender: IpcSender<SWManagerMsg>, pub swmanager_sender: IpcSender<SWManagerMsg>,
/// sender for communicating with resource thread /// sender for communicating with resource thread
pub resource_sender: IpcSender<CoreResourceMsg> pub resource_sender: IpcSender<CoreResourceMsg>,
} }
/// Messages sent to Service Worker Manager thread /// Messages sent to Service Worker Manager thread
@ -195,6 +195,5 @@ pub enum ServiceWorkerMsg {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum SWManagerMsg { pub enum SWManagerMsg {
/// Provide the constellation with a means of communicating with the Service Worker Manager /// Provide the constellation with a means of communicating with the Service Worker Manager
OwnSender(IpcSender<ServiceWorkerMsg>) OwnSender(IpcSender<ServiceWorkerMsg>),
} }

View file

@ -15,7 +15,7 @@ use servo_url::ServoUrl;
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum WebDriverScriptCommand { pub enum WebDriverScriptCommand {
AddCookie(#[serde(deserialize_with = "::hyper_serde::deserialize", AddCookie(#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")] serialize_with = "::hyper_serde::serialize")]
Cookie, Cookie,
IpcSender<Result<(), WebDriverCookieError>>), IpcSender<Result<(), WebDriverCookieError>>),
ExecuteScript(String, IpcSender<WebDriverJSResult>), ExecuteScript(String, IpcSender<WebDriverJSResult>),
@ -35,13 +35,13 @@ pub enum WebDriverScriptCommand {
GetUrl(IpcSender<ServoUrl>), GetUrl(IpcSender<ServoUrl>),
IsEnabled(String, IpcSender<Result<bool, ()>>), IsEnabled(String, IpcSender<Result<bool, ()>>),
IsSelected(String, IpcSender<Result<bool, ()>>), IsSelected(String, IpcSender<Result<bool, ()>>),
GetTitle(IpcSender<String>) GetTitle(IpcSender<String>),
} }
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum WebDriverCookieError { pub enum WebDriverCookieError {
InvalidDomain, InvalidDomain,
UnableToSetCookie UnableToSetCookie,
} }
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
@ -50,8 +50,7 @@ pub enum WebDriverJSValue {
Null, Null,
Boolean(bool), Boolean(bool),
Number(f64), Number(f64),
String(String), String(String), // TODO: Object and WebElement
// TODO: Object and WebElement
} }
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
@ -60,7 +59,7 @@ pub enum WebDriverJSError {
UnknownType, UnknownType,
/// Occurs when handler received an event message for a layout channel that is not /// Occurs when handler received an event message for a layout channel that is not
/// associated with the current script thread /// associated with the current script thread
BrowsingContextNotFound BrowsingContextNotFound,
} }
pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>; pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
@ -69,7 +68,7 @@ pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
pub enum WebDriverFrameId { pub enum WebDriverFrameId {
Short(u16), Short(u16),
Element(String), Element(String),
Parent Parent,
} }
impl ToJson for WebDriverJSValue { impl ToJson for WebDriverJSValue {
@ -79,7 +78,7 @@ impl ToJson for WebDriverJSValue {
WebDriverJSValue::Null => Json::Null, WebDriverJSValue::Null => Json::Null,
WebDriverJSValue::Boolean(ref x) => x.to_json(), WebDriverJSValue::Boolean(ref x) => x.to_json(),
WebDriverJSValue::Number(ref x) => x.to_json(), WebDriverJSValue::Number(ref x) => x.to_json(),
WebDriverJSValue::String(ref x) => x.to_json() WebDriverJSValue::String(ref x) => x.to_json(),
} }
} }
} }
@ -87,5 +86,5 @@ impl ToJson for WebDriverJSValue {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum LoadStatus { pub enum LoadStatus {
LoadComplete, LoadComplete,
LoadTimeout LoadTimeout,
} }