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 gfx_traits;
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
#[macro_use]
extern crate heapsize_derive;
extern crate hyper;
extern crate hyper_serde;
extern crate ipc_channel;
@ -252,7 +253,7 @@ pub enum ConstellationControlMsg {
/// Report an error from a CSS parser for the given pipeline
ReportCSSError(PipelineId, String, usize, usize, String),
/// Reload the given page.
Reload(PipelineId)
Reload(PipelineId),
}
impl fmt::Debug for ConstellationControlMsg {
@ -284,7 +285,7 @@ impl fmt::Debug for ConstellationControlMsg {
DispatchStorageEvent(..) => "DispatchStorageEvent",
FramedContentChanged(..) => "FramedContentChanged",
ReportCSSError(..) => "ReportCSSError",
Reload(..) => "Reload"
Reload(..) => "Reload",
};
write!(formatter, "ConstellationMsg::{}", variant)
}
@ -384,10 +385,7 @@ pub enum TouchpadPressurePhase {
/// Requests a TimerEvent-Message be sent after the given duration.
#[derive(Deserialize, Serialize)]
pub struct TimerEventRequest(pub IpcSender<TimerEvent>,
pub TimerSource,
pub TimerEventId,
pub MsDuration);
pub struct TimerEventRequest(pub IpcSender<TimerEvent>, pub TimerSource, pub TimerEventId, pub MsDuration);
/// Notifies the script thread to fire due timers.
/// `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 Message;
/// Create a `ScriptThread`.
fn create(state: InitialScriptState,
load_data: LoadData)
-> (Sender<Self::Message>, Receiver<Self::Message>);
fn create(state: InitialScriptState, load_data: LoadData) -> (Sender<Self::Message>, Receiver<Self::Message>);
}
/// Whether the sandbox attribute is present for an iframe element
@ -490,7 +486,7 @@ pub enum IFrameSandboxState {
/// Sandbox attribute is present
IFrameSandboxed,
/// Sandbox attribute is not present
IFrameUnsandboxed
IFrameUnsandboxed,
}
/// Specifies the information required to load an iframe.
@ -744,5 +740,5 @@ pub struct WorkerScriptLoadOrigin {
/// the referrer policy which is used
pub referrer_policy: Option<ReferrerPolicy>,
/// 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(String),
/// warning, with a reason
Warn(String)
Warn(String),
}
/// Messages from the script to the constellation.
@ -148,7 +148,7 @@ pub enum ScriptMsg {
/// Enter or exit fullscreen
SetFullscreenState(bool),
/// Requests that the compositor shut down.
Exit
Exit,
}
/// Entities required to spawn service workers
@ -175,7 +175,7 @@ pub struct SWManagerSenders {
/// sender for communicating with constellation
pub swmanager_sender: IpcSender<SWManagerMsg>,
/// sender for communicating with resource thread
pub resource_sender: IpcSender<CoreResourceMsg>
pub resource_sender: IpcSender<CoreResourceMsg>,
}
/// Messages sent to Service Worker Manager thread
@ -195,6 +195,5 @@ pub enum ServiceWorkerMsg {
#[derive(Deserialize, Serialize)]
pub enum SWManagerMsg {
/// Provide the constellation with a means of communicating with the Service Worker Manager
OwnSender(IpcSender<ServiceWorkerMsg>)
OwnSender(IpcSender<ServiceWorkerMsg>),
}

View file

@ -35,13 +35,13 @@ pub enum WebDriverScriptCommand {
GetUrl(IpcSender<ServoUrl>),
IsEnabled(String, IpcSender<Result<bool, ()>>),
IsSelected(String, IpcSender<Result<bool, ()>>),
GetTitle(IpcSender<String>)
GetTitle(IpcSender<String>),
}
#[derive(Deserialize, Serialize)]
pub enum WebDriverCookieError {
InvalidDomain,
UnableToSetCookie
UnableToSetCookie,
}
#[derive(Deserialize, Serialize)]
@ -50,8 +50,7 @@ pub enum WebDriverJSValue {
Null,
Boolean(bool),
Number(f64),
String(String),
// TODO: Object and WebElement
String(String), // TODO: Object and WebElement
}
#[derive(Deserialize, Serialize)]
@ -60,7 +59,7 @@ pub enum WebDriverJSError {
UnknownType,
/// Occurs when handler received an event message for a layout channel that is not
/// associated with the current script thread
BrowsingContextNotFound
BrowsingContextNotFound,
}
pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
@ -69,7 +68,7 @@ pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
pub enum WebDriverFrameId {
Short(u16),
Element(String),
Parent
Parent,
}
impl ToJson for WebDriverJSValue {
@ -79,7 +78,7 @@ impl ToJson for WebDriverJSValue {
WebDriverJSValue::Null => Json::Null,
WebDriverJSValue::Boolean(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)]
pub enum LoadStatus {
LoadComplete,
LoadTimeout
LoadTimeout,
}