diff options
Diffstat (limited to 'components/script')
83 files changed, 336 insertions, 364 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs index 4de0a5ad396..89ef23f1d92 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -10,23 +10,22 @@ //! with CORSRequest being expanded into FetchRequest (etc) use hyper::client::Request; -use hyper::header::{AccessControlMaxAge, AccessControlAllowOrigin}; -use hyper::header::{AccessControlRequestHeaders, AccessControlAllowHeaders}; -use hyper::header::{AccessControlRequestMethod, AccessControlAllowMethods}; +use hyper::header::{AccessControlAllowHeaders, AccessControlRequestHeaders}; +use hyper::header::{AccessControlAllowMethods, AccessControlRequestMethod}; +use hyper::header::{AccessControlAllowOrigin, AccessControlMaxAge}; use hyper::header::{ContentType, Host}; -use hyper::header::{Headers, HeaderView}; +use hyper::header::{HeaderView, Headers}; use hyper::method::Method; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use hyper::status::StatusClass::Success; -use net_traits::{AsyncResponseListener, ResponseAction, Metadata}; +use net_traits::{AsyncResponseListener, Metadata, ResponseAction}; use network_listener::{NetworkListener, PreInvoke}; use script_task::ScriptChan; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::RefCell; use std::sync::{Arc, Mutex}; -use time; -use time::{now, Timespec}; +use time::{self, Timespec, now}; use unicase::UniCase; use url::{SchemeData, Url}; use util::mem::HeapSizeOf; diff --git a/components/script/devtools.rs b/components/script/devtools.rs index f1ccb2a069e..0e892f32e6a 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -2,13 +2,13 @@ * 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 devtools_traits::{CachedConsoleMessage, CachedConsoleMessageTypes, PAGE_ERROR, CONSOLE_API}; -use devtools_traits::{ConsoleAPI, PageError, ScriptToDevtoolsControlMsg, ComputedNodeLayout}; -use devtools_traits::{EvaluateJSReply, NodeInfo, Modification, TimelineMarker, TimelineMarkerType}; +use devtools_traits::{CONSOLE_API, CachedConsoleMessage, CachedConsoleMessageTypes, PAGE_ERROR}; +use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError, ScriptToDevtoolsControlMsg}; +use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker, TimelineMarkerType}; use dom::bindings::codegen::Bindings::DOMRectBinding::{DOMRectMethods}; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::ElementBinding::{ElementMethods}; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast}; use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::conversions::jsstring_to_str; use dom::bindings::global::GlobalRef; diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index fa0c070ceaf..65e875b538b 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -7,7 +7,7 @@ use msg::constellation_msg::{PipelineId}; use net_traits::AsyncResponseTarget; -use net_traits::{Metadata, load_whole_resource, ResourceTask, PendingAsyncLoad}; +use net_traits::{Metadata, PendingAsyncLoad, ResourceTask, load_whole_resource}; use script_task::MainThreadScriptMsg; use std::sync::Arc; use std::sync::mpsc::Sender; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index a96f3a72e09..70f315bcac3 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, MutNullableHeap}; -use dom::bindings::js::{Root, RootedReference, LayoutJS}; +use dom::bindings::js::{LayoutJS, Root, RootedReference}; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::element::{AttributeMutation, Element}; use dom::virtualmethods::vtable_for; diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 4a54db01875..88fafd1188a 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -4,17 +4,17 @@ //! Base classes to work with IDL callbacks. -use dom::bindings::error::{Fallible, Error}; +use dom::bindings::error::{Error, Fallible}; use dom::bindings::global::global_object_for_js_object; use dom::bindings::utils::Reflectable; use js::jsapi::GetGlobalForObjectCrossCompartment; +use js::jsapi::{Heap, MutableHandleObject, RootedObject, RootedValue}; +use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject}; use js::jsapi::{JSAutoCompartment}; -use js::jsapi::{JSContext, JSObject, JS_WrapObject, IsCallable}; +use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment}; use js::jsapi::{JS_BeginRequest, JS_EndRequest}; -use js::jsapi::{JS_EnterCompartment, JS_LeaveCompartment, JSCompartment}; use js::jsapi::{JS_GetProperty, JS_IsExceptionPending, JS_ReportPendingException}; -use js::jsapi::{JS_SaveFrameChain, JS_RestoreFrameChain}; -use js::jsapi::{RootedObject, RootedValue, MutableHandleObject, Heap}; +use js::jsapi::{JS_RestoreFrameChain, JS_SaveFrameChain}; use js::jsval::{JSVal, UndefinedValue}; use std::default::Default; use std::ffi::CString; diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 18fffa56b33..9ec04e358e5 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -6,7 +6,7 @@ use dom::bindings::trace::JSTraceable; use js::jsapi::{JSTracer}; -use std::cell::{BorrowState, RefCell, Ref, RefMut}; +use std::cell::{BorrowState, Ref, RefCell, RefMut}; use util::task_state; use util::task_state::SCRIPT; diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 2922e2250ae..eed41d6f926 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -38,7 +38,7 @@ use dom::bindings::error::throw_type_error; use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::str::{ByteString, USVString}; -use dom::bindings::utils::{Reflectable, Reflector, DOMClass}; +use dom::bindings::utils::{DOMClass, Reflectable, Reflector}; use js; use js::glue::{GetProxyPrivate, IsWrapper, RUST_JS_NumberValue}; use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_STRING, UnwrapObject}; @@ -47,20 +47,17 @@ use js::jsapi::{JSClass, JSContext, JSObject, JSString, MutableHandleValue}; use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetReservedSlot}; use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_NewStringCopyN}; use js::jsapi::{JS_NewUCStringCopyN, JS_StringHasLatin1Chars, JS_WrapValue}; -use js::jsval::JSVal; -use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue}; -use js::jsval::{UndefinedValue, NullValue, BooleanValue, Int32Value, UInt32Value}; -use js::rust::{ToUint16, ToNumber, ToBoolean, ToString}; -use js::rust::{ToUint32, ToInt32}; -use js::rust::{ToUint64, ToInt64}; +use js::jsval::{BooleanValue, Int32Value, NullValue, UInt32Value, UndefinedValue}; +use js::jsval::{JSVal, ObjectOrNullValue, ObjectValue, StringValue}; +use js::rust::{ToBoolean, ToNumber, ToString, ToUint16}; +use js::rust::{ToInt32, ToUint32}; +use js::rust::{ToInt64, ToUint64}; use libc; use num::Float; use num::traits::{Bounded, Zero}; use std::borrow::ToOwned; -use std::char; -use std::ptr; use std::rc::Rc; -use std::slice; +use std::{char, ptr, slice}; use util::str::DOMString; trait As<O>: Copy { diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 6fb338fd31d..9b2238e3ec0 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -7,17 +7,16 @@ use dom::bindings::codegen::PrototypeList::proto_id_to_name; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::global::GlobalRef; -use dom::domexception::{DOMException, DOMErrorName}; +use dom::domexception::{DOMErrorName, DOMException}; use js::jsapi::JSAutoCompartment; use js::jsapi::{JSContext, JSObject, RootedValue}; -use js::jsapi::{JS_IsExceptionPending, JS_SetPendingException, JS_ReportPendingException}; -use js::jsapi::{JS_ReportErrorNumber1, JSErrorFormatString, JSExnType}; -use js::jsapi::{JS_SaveFrameChain, JS_RestoreFrameChain}; +use js::jsapi::{JSErrorFormatString, JSExnType, JS_ReportErrorNumber1}; +use js::jsapi::{JS_IsExceptionPending, JS_ReportPendingException, JS_SetPendingException}; +use js::jsapi::{JS_RestoreFrameChain, JS_SaveFrameChain}; use js::jsval::UndefinedValue; use libc; use std::ffi::CString; -use std::mem; -use std::ptr; +use std::{mem, ptr}; use util::mem::HeapSizeOf; use util::str::DOMString; diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index a2602a2ed2e..ea170ab2463 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -17,11 +17,11 @@ use dom::workerglobalscope::WorkerGlobalScope; use ipc_channel::ipc::IpcSender; use js::jsapi::{GetGlobalForObjectCrossCompartment}; use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue}; -use js::{JSCLASS_IS_GLOBAL, JSCLASS_IS_DOMJSCLASS}; +use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId}; use net_traits::ResourceTask; use profile_traits::mem; -use script_task::{ScriptChan, ScriptPort, CommonScriptMsg, ScriptTask}; +use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask}; use url::Url; use util::mem::HeapSizeOf; diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 065604d6976..e39e5c1f412 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -26,9 +26,9 @@ use core::nonzero::NonZero; use dom::bindings::trace::JSTraceable; use dom::bindings::trace::trace_reflector; -use dom::bindings::utils::{Reflector, Reflectable}; +use dom::bindings::utils::{Reflectable, Reflector}; use dom::node::Node; -use js::jsapi::{JSObject, Heap, JSTracer}; +use js::jsapi::{Heap, JSObject, JSTracer}; use js::jsval::JSVal; use layout_interface::TrustedNodeAddress; use script_task::STACK_ROOTS; diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index d4236ba08f6..45742da0108 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -132,9 +132,6 @@ //! return `Err()` from the method with the appropriate [error value] //! (error/enum.Error.html). -#![allow(unsafe_code)] -#![deny(missing_docs, non_snake_case)] - pub mod callback; pub mod cell; pub mod conversions; diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 8ad7a819206..60c473db1d2 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -10,19 +10,18 @@ use dom::bindings::conversions::is_dom_proxy; use dom::bindings::utils::delete_property_by_id; use js::glue::GetProxyExtra; use js::glue::InvokeGetOwnPropertyDescriptor; -use js::glue::{SetProxyExtra, GetProxyHandler}; +use js::glue::{GetProxyHandler, SetProxyExtra}; use js::jsapi::GetObjectProto; -use js::jsapi::{Handle, HandleObject, HandleId, MutableHandle, RootedObject, ObjectOpResult}; -use js::jsapi::{JSContext, JSPropertyDescriptor, JSObject}; +use js::jsapi::{Handle, HandleId, HandleObject, MutableHandle, ObjectOpResult, RootedObject}; +use js::jsapi::{JSContext, JSObject, JSPropertyDescriptor}; +use js::jsapi::{JSErrNum, JS_StrictPropertyStub}; use js::jsapi::{JS_DefinePropertyById6, JS_NewObjectWithGivenProto}; use js::jsapi::{JS_GetPropertyDescriptorById}; -use js::jsapi::{JS_StrictPropertyStub, JSErrNum}; use js::jsval::ObjectValue; -use js::{JSPROP_GETTER, JSPROP_ENUMERATE, JSPROP_READONLY}; -use js::{JSTrue, JSFalse}; +use js::{JSFalse, JSTrue}; +use js::{JSPROP_ENUMERATE, JSPROP_GETTER, JSPROP_READONLY}; use libc; -use std::mem; -use std::ptr; +use std::{mem, ptr}; static JSPROXYSLOT_EXPANDO: u32 = 0; diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 755f8ec6076..ee8647be3ce 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -25,12 +25,12 @@ use core::nonzero::NonZero; use dom::bindings::js::Root; use dom::bindings::trace::trace_reflector; -use dom::bindings::utils::{Reflector, Reflectable}; +use dom::bindings::utils::{Reflectable, Reflector}; use js::jsapi::{JSContext, JSTracer}; use libc; -use script_task::{ScriptChan, CommonScriptMsg}; +use script_task::{CommonScriptMsg, ScriptChan}; use std::cell::RefCell; -use std::collections::hash_map::Entry::{Vacant, Occupied}; +use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_map::HashMap; use std::marker::PhantomData; use std::sync::{Arc, Mutex}; diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index 90a0ca25df6..663a17cd309 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -9,10 +9,9 @@ use dom::bindings::error::Error::DataClone; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use js::glue::JS_STRUCTURED_CLONE_VERSION; -use js::jsapi::JSContext; -use js::jsapi::JS_ReadStructuredClone; use js::jsapi::{HandleValue, MutableHandleValue}; -use js::jsapi::{JS_WriteStructuredClone, JS_ClearPendingException}; +use js::jsapi::{JSContext, JS_ReadStructuredClone}; +use js::jsapi::{JS_ClearPendingException, JS_WriteStructuredClone}; use libc::size_t; use std::ptr; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index de9d788c849..94d3ad97c93 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -31,7 +31,7 @@ use canvas_traits::WebGLError; use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle}; -use canvas_traits::{LineCapStyle, LineJoinStyle, CompositionOrBlending, RepetitionStyle}; +use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle}; use cssparser::RGBA; use dom::bindings::js::{JS, Root}; use dom::bindings::refcounted::Trusted; @@ -45,10 +45,10 @@ use hyper::header::Headers; use hyper::method::Method; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use js::jsapi::JS_CallUnbarrieredObjectTracer; -use js::jsapi::{JSObject, JSTracer, JSGCTraceKind, JS_CallValueTracer, JS_CallObjectTracer, GCTraceKindToAscii, Heap}; +use js::jsapi::{GCTraceKindToAscii, Heap, JSGCTraceKind, JSObject, JSTracer, JS_CallObjectTracer, JS_CallValueTracer}; use js::jsval::JSVal; use js::rust::Runtime; -use layout_interface::{LayoutRPC, LayoutChan}; +use layout_interface::{LayoutChan, LayoutRPC}; use libc; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WorkerId}; @@ -60,10 +60,10 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_task::ScriptChan; use script_traits::UntrustedNodeAddress; use selectors::parser::PseudoElement; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::boxed::FnBox; -use std::cell::{Cell, UnsafeCell, RefCell}; +use std::cell::{Cell, RefCell, UnsafeCell}; use std::collections::hash_state::HashState; use std::collections::{HashMap, HashSet}; use std::ffi::CString; diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 6d61b6013b1..9ebd676e90e 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -18,10 +18,10 @@ use dom::browsercontext; use dom::eventtarget::EventTargetTypeId; use dom::window; use js; -use js::glue::{CallJitMethodOp, CallJitGetterOp, CallJitSetterOp, IsWrapper}; +use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper}; +use js::glue::{GetCrossCompartmentWrapper, WrapperNew}; use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO, RUST_JSID_IS_INT}; use js::glue::{RUST_JSID_TO_INT, UnwrapObject}; -use js::glue::{WrapperNew, GetCrossCompartmentWrapper}; use js::jsapi::JSAutoCompartment; use js::jsapi::JS_DeletePropertyById1; use js::jsapi::JS_GetFunctionObject; @@ -30,28 +30,27 @@ use js::jsapi::JS_NewObjectWithUniqueType; use js::jsapi::JS_ObjectToOuterObject; use js::jsapi::PropertyDefinitionBehavior; use js::jsapi::{CallArgs, GetGlobalForObjectCrossCompartment, JSJitInfo}; +use js::jsapi::{CompartmentOptions, OnNewGlobalHookOption}; use js::jsapi::{DOMCallbacks, JSWrapObjectCallbacks}; -use js::jsapi::{HandleObject, HandleId, HandleValue, MutableHandleValue}; -use js::jsapi::{JSContext, JSObject, JSClass, JSTracer}; +use js::jsapi::{HandleId, HandleObject, HandleValue, MutableHandleValue}; +use js::jsapi::{Heap, MutableHandleObject, ObjectOpResult, RootedObject, RootedValue}; +use js::jsapi::{JSClass, JSContext, JSObject, JSTracer}; use js::jsapi::{JSFunctionSpec, JSPropertySpec}; -use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewFunction, JSTraceOp}; +use js::jsapi::{JSTraceOp, JS_AlreadyHasOwnProperty, JS_NewFunction}; +use js::jsapi::{JSVersion, JS_FireOnNewGlobalObject}; use js::jsapi::{JS_DefineFunctions, JS_DefineProperty, JS_DefineProperty1}; use js::jsapi::{JS_DefineProperties, JS_ForwardGetPropertyTo}; -use js::jsapi::{JS_FireOnNewGlobalObject, JSVersion}; use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype}; use js::jsapi::{JS_GetProperty, JS_HasProperty, JS_SetProperty}; +use js::jsapi::{JS_GetPrototype, JS_HasPropertyById}; use js::jsapi::{JS_GetReservedSlot, JS_SetReservedSlot}; -use js::jsapi::{JS_HasPropertyById, JS_GetPrototype}; -use js::jsapi::{JS_NewGlobalObject, JS_InitStandardClasses}; -use js::jsapi::{ObjectOpResult, RootedObject, RootedValue, Heap, MutableHandleObject}; -use js::jsapi::{OnNewGlobalHookOption, CompartmentOptions}; +use js::jsapi::{JS_InitStandardClasses, JS_NewGlobalObject}; use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue}; use js::jsval::{PrivateValue, UInt32Value, UndefinedValue}; use js::rust::{GCMethods, ToString}; +use js::{JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE, JS_CALLEE}; use js::{JSPROP_PERMANENT, JSPROP_READONLY}; -use js::{JS_CALLEE, JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE}; -use libc; -use libc::c_uint; +use libc::{self, c_uint}; use std::cell::UnsafeCell; use std::cmp::PartialEq; use std::default::Default; diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 154cb6f43c4..8161d9b278c 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -6,14 +6,14 @@ use dom::bindings::codegen::Bindings::BlobBinding; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::InheritTypes::FileDerived; use dom::bindings::error::Fallible; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::Root; use dom::bindings::utils::{Reflector, reflect_dom_object}; use num::ToPrimitive; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::{Cell}; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::sync::mpsc::Sender; use util::str::DOMString; diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs index 668dd8cd961..3209231d196 100644 --- a/components/script/dom/browsercontext.rs +++ b/components/script/dom/browsercontext.rs @@ -5,22 +5,22 @@ use dom::bindings::conversions::native_from_handleobject; use dom::bindings::conversions::{ToJSValConvertible}; use dom::bindings::js::{JS, Root}; -use dom::bindings::proxyhandler::{get_property_descriptor, fill_property_descriptor}; +use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::utils::get_array_index_from_id; use dom::bindings::utils::{Reflectable, WindowProxyHandler}; use dom::document::Document; use dom::element::Element; use dom::window::Window; +use js::glue::{CreateWrapperProxyHandler, ProxyTraps, WrapperNew}; use js::glue::{GetProxyPrivate}; -use js::glue::{WrapperNew, CreateWrapperProxyHandler, ProxyTraps}; -use js::jsapi::{HandleObject, HandleId, MutableHandle, MutableHandleValue}; -use js::jsapi::{JSAutoRequest, JSAutoCompartment}; -use js::jsapi::{JSContext, JSObject, JSPropertyDescriptor, JSErrNum}; +use js::jsapi::{Handle, HandleValue, Heap, JS_ForwardSetPropertyTo, ObjectOpResult, RootedObject, RootedValue}; +use js::jsapi::{HandleId, HandleObject, MutableHandle, MutableHandleValue}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest}; +use js::jsapi::{JSContext, JSErrNum, JSObject, JSPropertyDescriptor}; use js::jsapi::{JS_AlreadyHasOwnPropertyById, JS_ForwardGetPropertyTo}; -use js::jsapi::{JS_ForwardSetPropertyTo, ObjectOpResult, RootedObject, RootedValue, Handle, HandleValue, Heap}; -use js::jsapi::{JS_GetPropertyDescriptorById, JS_DefinePropertyById6}; +use js::jsapi::{JS_DefinePropertyById6, JS_GetPropertyDescriptorById}; use js::jsval::{ObjectValue, UndefinedValue}; -use js::{JSTrue, JSFalse}; +use js::{JSFalse, JSTrue}; use std::default::Default; use std::ptr; diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index 25293e526f0..7457c06a30d 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -2,7 +2,7 @@ * 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::{FillOrStrokeStyle, SurfaceStyle, RepetitionStyle}; +use canvas_traits::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Bindings::CanvasPatternBinding; use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 337dd3a619e..748f3746c6e 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -3,9 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas::canvas_paint_task::RectToi32; -use canvas_traits::{CanvasMsg, Canvas2dMsg, CanvasCommonMsg}; +use canvas_traits::{Canvas2dMsg, CanvasCommonMsg, CanvasMsg}; +use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle}; use canvas_traits::{FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle, RepetitionStyle}; -use canvas_traits::{LineCapStyle, LineJoinStyle, CompositionOrBlending}; use cssparser::Color as CSSColor; use cssparser::{Parser, RGBA}; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; @@ -17,7 +17,7 @@ use dom::bindings::codegen::UnionTypes::HTMLImageElementOrHTMLCanvasElementOrCan use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; use dom::bindings::error::Error::{IndexSize, InvalidState, Syntax}; use dom::bindings::error::Fallible; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::{JS, LayoutJS, Root}; use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; @@ -27,7 +27,7 @@ use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::utils as canvas_utils; use dom::htmlimageelement::HTMLImageElement; use dom::imagedata::ImageData; -use dom::node::{window_from_node, NodeDamage}; +use dom::node::{NodeDamage, window_from_node}; use euclid::matrix2d::Matrix2D; use euclid::point::Point2D; use euclid::rect::Rect; @@ -39,10 +39,9 @@ use net_traits::image_cache_task::ImageResponse; use num::{Float, ToPrimitive}; use std::borrow::ToOwned; use std::cell::RefCell; -use std::cmp; -use std::fmt; use std::str::FromStr; use std::sync::mpsc::channel; +use std::{cmp, fmt}; use url::Url; use util::str::DOMString; use util::vec::byte_swap; diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index db2d576dcd9..2983ca1ea51 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::codegen::InheritTypes::{CharacterDataDerived, ElementCast}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::Error::IndexSize; -use dom::bindings::error::{Fallible, ErrorResult}; +use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::js::{LayoutJS, Root}; use dom::document::Document; use dom::element::Element; diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index b4e077b0494..9d0f4d5bafd 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -10,7 +10,7 @@ use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::utils::reflect_dom_object; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; use script_task::ScriptChan; use util::str::DOMString; diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index faa3c507e5f..8845ecd5b22 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -5,7 +5,7 @@ use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg}; use dom::bindings::codegen::Bindings::ConsoleBinding; use dom::bindings::codegen::Bindings::ConsoleBinding::ConsoleMethods; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::Root; use dom::bindings::utils::{Reflector, reflect_dom_object}; use util::str::DOMString; diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index 52d2141b3be..cd5338a1868 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -10,10 +10,9 @@ use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::utils::{Reflector, reflect_dom_object}; use js::jsapi::{JSContext, JSObject}; -use js::jsapi::{JS_GetObjectAsArrayBufferView, JS_GetArrayBufferViewType, Type}; -use rand::{Rng, OsRng}; -use std::ptr; -use std::slice; +use js::jsapi::{JS_GetArrayBufferViewType, JS_GetObjectAsArrayBufferView, Type}; +use rand::{OsRng, Rng}; +use std::{ptr, slice}; no_jsmanaged_fields!(OsRng); diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index ef44d298269..e2bf6fd771b 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -3,13 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{self, CSSStyleDeclarationMethods}; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; use dom::bindings::utils::{Reflector, reflect_dom_object}; -use dom::element::{StylePriority, Element}; -use dom::node::{window_from_node, document_from_node, NodeDamage}; +use dom::element::{Element, StylePriority}; +use dom::node::{NodeDamage, document_from_node, window_from_node}; use dom::window::Window; use selectors::parser::PseudoElement; use std::ascii::AsciiExt; diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index a0bd520bb1e..e1e1613baae 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -5,13 +5,13 @@ use dom::bindings::codegen::Bindings::CustomEventBinding; use dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; -use dom::bindings::codegen::InheritTypes::{EventCast, CustomEventDerived}; +use dom::bindings::codegen::InheritTypes::{CustomEventDerived, EventCast}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{Root, MutHeapJSVal}; +use dom::bindings::js::{MutHeapJSVal, Root}; use dom::bindings::utils::reflect_dom_object; use dom::event::{Event, EventTypeId}; -use js::jsapi::{JSContext, HandleValue}; +use js::jsapi::{HandleValue, JSContext}; use js::jsval::JSVal; use util::str::DOMString; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index ba0bb767408..c619f64f293 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -12,33 +12,33 @@ use dom::bindings::codegen::InheritTypes::DedicatedWorkerGlobalScopeDerived; use dom::bindings::codegen::InheritTypes::{EventTargetCast, WorkerGlobalScopeCast}; use dom::bindings::error::ErrorResult; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{RootCollection, Root}; +use dom::bindings::js::{Root, RootCollection}; use dom::bindings::refcounted::LiveDOMReferences; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::utils::Reflectable; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::messageevent::MessageEvent; -use dom::worker::{TrustedWorkerAddress, WorkerMessageHandler, SimpleWorkerErrorHandler}; +use dom::worker::{SimpleWorkerErrorHandler, TrustedWorkerAddress, WorkerMessageHandler}; use dom::workerglobalscope::WorkerGlobalScope; -use dom::workerglobalscope::{WorkerGlobalScopeTypeId, WorkerGlobalScopeInit}; +use dom::workerglobalscope::{WorkerGlobalScopeInit, WorkerGlobalScopeTypeId}; use ipc_channel::ipc::IpcReceiver; use ipc_channel::router::ROUTER; -use js::jsapi::{JSAutoRequest, JSAutoCompartment}; -use js::jsapi::{JSContext, RootedValue, HandleValue}; +use js::jsapi::{HandleValue, JSContext, RootedValue}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest}; use js::jsval::UndefinedValue; use js::rust::Runtime; use msg::constellation_msg::PipelineId; use net_traits::load_whole_resource; use rand::random; use script_task::ScriptTaskEventCategory::WorkerEvent; -use script_task::{ScriptTask, ScriptChan, TimerSource, ScriptPort, StackRootTLS, CommonScriptMsg}; +use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask, StackRootTLS, TimerSource}; use std::mem::replace; use std::rc::Rc; -use std::sync::mpsc::{Sender, Receiver, channel, Select, RecvError}; +use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel}; use url::Url; use util::task::spawn_named; use util::task_state; -use util::task_state::{SCRIPT, IN_WORKER}; +use util::task_state::{IN_WORKER, SCRIPT}; /// Messages used to control the worker event loops pub enum WorkerScriptMsg { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 123a4d8fe85..70849da483f 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -18,24 +18,24 @@ use dom::bindings::codegen::InheritTypes::ElementDerived; use dom::bindings::codegen::InheritTypes::HTMLBaseElementCast; use dom::bindings::codegen::InheritTypes::{DocumentDerived, EventCast, HTMLBodyElementCast}; use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLHeadElementCast, HTMLIFrameElementCast}; use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLAnchorElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLAnchorElementDerived, HTMLAppletElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLAreaElementDerived, HTMLEmbedElementDerived}; -use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLHeadElementCast, ElementCast, HTMLIFrameElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived, HTMLTitleElementDerived}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::Error::HierarchyRequest; -use dom::bindings::error::Error::{NotSupported, InvalidCharacter, Security}; +use dom::bindings::error::Error::{InvalidCharacter, NotSupported, Security}; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::global::GlobalRef; use dom::bindings::js::RootedReference; -use dom::bindings::js::{JS, Root, LayoutJS, MutNullableHeap}; +use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::trace::RootedVec; use dom::bindings::utils::XMLName::InvalidXMLName; -use dom::bindings::utils::{reflect_dom_object, Reflectable}; -use dom::bindings::utils::{xml_name_type, validate_and_extract}; +use dom::bindings::utils::{Reflectable, reflect_dom_object}; +use dom::bindings::utils::{validate_and_extract, xml_name_type}; use dom::comment::Comment; use dom::customevent::CustomEvent; use dom::documentfragment::DocumentFragment; @@ -46,7 +46,7 @@ use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlbaseelement::HTMLBaseElement; -use dom::htmlcollection::{HTMLCollection, CollectionFilter}; +use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::htmlheadelement::HTMLHeadElement; use dom::htmlhtmlelement::HTMLHtmlElement; @@ -56,7 +56,7 @@ use dom::keyboardevent::KeyboardEvent; use dom::location::Location; use dom::messageevent::MessageEvent; use dom::mouseevent::MouseEvent; -use dom::node::{self, Node, NodeTypeId, CloneChildrenFlag, NodeDamage, window_from_node}; +use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, NodeTypeId, window_from_node}; use dom::nodeiterator::NodeIterator; use dom::nodelist::NodeList; use dom::processinginstruction::ProcessingInstruction; @@ -65,9 +65,9 @@ use dom::servohtmlparser::ServoHTMLParser; use dom::text::Text; use dom::treewalker::TreeWalker; use dom::uievent::UIEvent; -use dom::window::{Window, ReflowReason}; +use dom::window::{ReflowReason, Window}; use euclid::point::Point2D; -use html5ever::tree_builder::{QuirksMode, NoQuirks, LimitedQuirks, Quirks}; +use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks, QuirksMode}; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use layout_interface::{HitTestResponse, MouseOverResponse}; @@ -76,18 +76,18 @@ use layout_interface::{ReflowGoal, ReflowQueryType}; use msg::compositor_msg::ScriptToCompositorMsg; use msg::constellation_msg::AnimationState; use msg::constellation_msg::Msg as ConstellationMsg; -use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyState, KeyModifiers, MozBrowserEvent, SubpageId}; -use msg::constellation_msg::{SUPER, ALT, SHIFT, CONTROL}; -use net_traits::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl}; +use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; +use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyModifiers, KeyState, MozBrowserEvent, SubpageId}; +use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::CookieSource::NonHTTP; -use net_traits::{Metadata, PendingAsyncLoad, AsyncResponseTarget}; +use net_traits::{AsyncResponseTarget, Metadata, PendingAsyncLoad}; use num::ToPrimitive; use script_task::Runnable; use script_traits::{MouseButton, UntrustedNodeAddress}; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::boxed::FnBox; -use std::cell::{Cell, Ref, RefMut, RefCell}; +use std::cell::{Cell, Ref, RefCell, RefMut}; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::default::Default; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 268e8f35603..2337d2a363b 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -22,7 +22,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentDerived, E use dom::bindings::codegen::InheritTypes::{ElementDerived, EventTargetCast, HTMLAnchorElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLBodyElementCast, HTMLFontElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLInputElementCast}; -use dom::bindings::codegen::InheritTypes::{HTMLTableElementCast, HTMLTableCellElementCast}; +use dom::bindings::codegen::InheritTypes::{HTMLTableCellElementCast, HTMLTableElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementCast, HTMLTableSectionElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLTemplateElementCast, HTMLTextAreaElementCast}; use dom::bindings::codegen::InheritTypes::{NodeCast, TextCast}; @@ -33,7 +33,7 @@ use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::{Root, RootedReference}; use dom::bindings::utils::XMLName::InvalidXMLName; -use dom::bindings::utils::{namespace_from_domstring, xml_name_type, validate_and_extract}; +use dom::bindings::utils::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::create::create_element; use dom::document::{Document, LayoutDocumentHelpers}; use dom::domrect::DOMRect; @@ -48,16 +48,16 @@ use dom::htmltableelement::HTMLTableElement; use dom::htmltextareaelement::RawLayoutHTMLTextAreaElementHelpers; use dom::namednodemap::NamedNodeMap; use dom::node::{CLICK_IN_PROGRESS, LayoutNodeHelpers, Node, NodeTypeId, SEQUENTIALLY_FOCUSABLE}; -use dom::node::{document_from_node, NodeDamage}; +use dom::node::{NodeDamage, document_from_node}; use dom::node::{window_from_node}; use dom::nodelist::NodeList; use dom::virtualmethods::{VirtualMethods, vtable_for}; use html5ever::serialize; use html5ever::serialize::SerializeOpts; use html5ever::serialize::TraversalScope; -use html5ever::serialize::TraversalScope::{IncludeNode, ChildrenOnly}; -use html5ever::tree_builder::{NoQuirks, LimitedQuirks, Quirks}; -use selectors::matching::{matches, DeclarationBlock}; +use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; +use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks}; +use selectors::matching::{DeclarationBlock, matches}; use selectors::parser::parse_author_origin_selector_list_from_str; use selectors::parser::{AttrSelector, NamespaceConstraint}; use smallvec::VecLike; @@ -71,7 +71,7 @@ use string_cache::{Atom, Namespace, QualName}; use style::legacy::{UnsignedIntegerAttribute, from_declaration}; use style::properties::DeclaredValue; use style::properties::longhands::{self, background_image, border_spacing, font_family}; -use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute}; +use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute}; use style::values::CSSFloat; use style::values::specified::{self, CSSColor, CSSRGBA}; use url::UrlParser; diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index 4ba68e3e334..040f85d1934 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -6,14 +6,14 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::ErrorEventBinding; use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; -use dom::bindings::codegen::InheritTypes::{EventCast, ErrorEventDerived}; +use dom::bindings::codegen::InheritTypes::{ErrorEventDerived, EventCast}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{Root, MutHeapJSVal}; +use dom::bindings::js::{MutHeapJSVal, Root}; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::reflect_dom_object; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; -use js::jsapi::{JSContext, HandleValue}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; +use js::jsapi::{HandleValue, JSContext}; use js::jsval::JSVal; use std::borrow::ToOwned; use std::cell::Cell; diff --git a/components/script/dom/eventdispatcher.rs b/components/script/dom/eventdispatcher.rs index 254b4edb9de..64e8b57d2e2 100644 --- a/components/script/dom/eventdispatcher.rs +++ b/components/script/dom/eventdispatcher.rs @@ -10,7 +10,7 @@ use dom::bindings::global::{GlobalRoot, global_object_for_reflector}; use dom::bindings::js::{JS, Root, RootedReference}; use dom::bindings::trace::RootedVec; use dom::event::{Event, EventPhase}; -use dom::eventtarget::{EventTarget, ListenerPhase, EventListenerType}; +use dom::eventtarget::{EventListenerType, EventTarget, ListenerPhase}; use dom::node::Node; use dom::virtualmethods::vtable_for; use dom::window::Window; diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 145ff83abbf..0a7f8a151de 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -19,8 +19,8 @@ use dom::workerglobalscope::WorkerGlobalScopeTypeId; use dom::xmlhttprequesteventtarget::XMLHttpRequestEventTargetTypeId; use fnv::FnvHasher; use js::jsapi::{CompileFunction, JS_GetFunctionObject}; +use js::jsapi::{HandleObject, JSContext, RootedFunction}; use js::jsapi::{JSAutoCompartment, JSAutoRequest}; -use js::jsapi::{JSContext, RootedFunction, HandleObject}; use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper}; use libc::{c_char, size_t}; use std::borrow::ToOwned; @@ -29,9 +29,8 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_state::DefaultState; use std::default::Default; use std::ffi::CString; -use std::intrinsics; -use std::ptr; use std::rc::Rc; +use std::{intrinsics, ptr}; use url::Url; use util::mem::HeapSizeOf; use util::str::DOMString; diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 5de6f4dd5f9..2169edebb03 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -8,22 +8,22 @@ use dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConsta use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast}; use dom::bindings::error::Error::InvalidState; use dom::bindings::error::{ErrorResult, Fallible}; -use dom::bindings::global::{GlobalRef, GlobalField}; -use dom::bindings::js::{Root, JS, MutNullableHeap}; +use dom::bindings::global::{GlobalField, GlobalRef}; +use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::refcounted::Trusted; -use dom::bindings::utils::{reflect_dom_object, Reflectable}; +use dom::bindings::utils::{Reflectable, reflect_dom_object}; use dom::blob::Blob; -use dom::domexception::{DOMException, DOMErrorName}; -use dom::event::{EventCancelable, EventBubbles}; +use dom::domexception::{DOMErrorName, DOMException}; +use dom::event::{EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; use dom::progressevent::ProgressEvent; use encoding::all::UTF_8; use encoding::label::encoding_from_whatwg_label; -use encoding::types::{EncodingRef, DecoderTrap}; -use hyper::mime::{Mime, Attr}; -use rustc_serialize::base64::{Config, ToBase64, CharacterSet, Newline}; +use encoding::types::{DecoderTrap, EncodingRef}; +use hyper::mime::{Attr, Mime}; +use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use script_task::ScriptTaskEventCategory::FileRead; -use script_task::{ScriptChan, Runnable, ScriptPort, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable, ScriptChan, ScriptPort}; use std::cell::{Cell, RefCell}; use std::sync::mpsc; use std::sync::mpsc::Receiver; diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index d5dca833e17..d1de7a4cabd 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::InheritTypes::FileCast; use dom::bindings::codegen::UnionTypes::FileOrString; use dom::bindings::codegen::UnionTypes::FileOrString::{eFile, eString}; use dom::bindings::error::{Fallible}; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::{JS, Root}; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::blob::Blob; diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 7b069f93f5a..28f77b706e9 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -16,7 +16,7 @@ use dom::document::Document; use dom::element::{AttributeMutation, ElementTypeId}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; -use dom::node::{Node, NodeTypeId, window_from_node, document_from_node}; +use dom::node::{Node, NodeTypeId, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as ConstellationMsg; diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index ccbc409666b..075df00bf91 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -6,7 +6,7 @@ use dom::activation::Activatable; use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; -use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLButtonElementCast, NodeCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLButtonElementCast, HTMLElementCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLButtonElementDerived, HTMLFieldSetElementDerived}; use dom::bindings::js::Root; use dom::document::Document; @@ -14,7 +14,7 @@ use dom::element::{AttributeMutation, Element, ElementTypeId}; use dom::event::Event; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; -use dom::htmlformelement::{FormSubmitter, FormControl}; +use dom::htmlformelement::{FormControl, FormSubmitter}; use dom::htmlformelement::{SubmittedFrom}; use dom::node::{Node, NodeTypeId, document_from_node, window_from_node}; use dom::validitystate::ValidityState; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 908baa2e5aa..3c254ffa330 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::InheritTypes::HTMLCanvasElementDerived; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRenderingContext; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, HeapGCValue, Root}; +use dom::bindings::js::{HeapGCValue, JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::utils::{Reflectable}; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::document::Document; @@ -20,10 +20,10 @@ use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; use dom::virtualmethods::VirtualMethods; -use dom::webglrenderingcontext::{WebGLRenderingContext, LayoutCanvasWebGLRenderingContextHelpers}; +use dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext}; use euclid::size::Size2D; use ipc_channel::ipc::IpcSender; -use js::jsapi::{JSContext, HandleValue}; +use js::jsapi::{HandleValue, JSContext}; use offscreen_gl_context::GLContextAttributes; use std::cell::Cell; use std::default::Default; diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 40bc1f5c97a..f9a6ba38350 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; use dom::bindings::trace::JSTraceable; -use dom::bindings::utils::{namespace_from_domstring, Reflector, reflect_dom_object}; +use dom::bindings::utils::{Reflector, namespace_from_domstring, reflect_dom_object}; use dom::element::Element; use dom::node::{Node, TreeIterator}; use dom::window::Window; diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index 93659612405..867b36d02cc 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -11,7 +11,7 @@ use dom::document::Document; use dom::element::Element; use dom::element::ElementTypeId; use dom::eventtarget::{EventTarget, EventTargetTypeId}; -use dom::htmlcollection::{HTMLCollection, CollectionFilter}; +use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; use util::str::DOMString; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 7256c201af5..ba44495e508 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -11,12 +11,12 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFrameSetElementDerived}; use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLInputElementCast, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLElementDerived, HTMLBodyElementDerived, HTMLHtmlElementDerived}; +use dom::bindings::codegen::InheritTypes::{HTMLBodyElementDerived, HTMLElementDerived, HTMLHtmlElementDerived}; use dom::bindings::error::Error::Syntax; use dom::bindings::error::ErrorResult; use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::utils::Reflectable; -use dom::cssstyledeclaration::{CSSStyleDeclaration, CSSModificationAccess}; +use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration}; use dom::document::Document; use dom::domstringmap::DOMStringMap; use dom::element::{AttributeMutation, Element, ElementTypeId}; @@ -24,7 +24,7 @@ use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlinputelement::HTMLInputElement; use dom::htmlmediaelement::HTMLMediaElementTypeId; use dom::htmltablecellelement::HTMLTableCellElementTypeId; -use dom::node::{Node, NodeTypeId, document_from_node, window_from_node, SEQUENTIALLY_FOCUSABLE}; +use dom::node::{Node, NodeTypeId, SEQUENTIALLY_FOCUSABLE, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::FocusType; use std::borrow::ToOwned; diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index f4a54f253d7..deea3fa75d2 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -11,7 +11,7 @@ use dom::bindings::js::{Root, RootedReference}; use dom::document::Document; use dom::element::{AttributeMutation, Element, ElementTypeId}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; -use dom::htmlcollection::{HTMLCollection, CollectionFilter}; +use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; use dom::validitystate::ValidityState; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 5cdc1ce1be7..3d779c321ab 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -31,7 +31,7 @@ use hyper::header::ContentType; use hyper::method::Method; use hyper::mime; use msg::constellation_msg::LoadData; -use script_task::{ScriptChan, MainThreadScriptMsg}; +use script_task::{MainThreadScriptMsg, ScriptChan}; use std::borrow::ToOwned; use std::cell::Cell; use string_cache::Atom; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 546fb79b47f..a5d2941e2ce 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::InheritTypes::HTMLIFrameElementDerived; +use dom::bindings::codegen::InheritTypes::{ElementCast, EventCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast}; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventCast}; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::Error::NotSupported; use dom::bindings::error::{ErrorResult, Fallible}; @@ -17,18 +17,18 @@ use dom::bindings::js::{Root}; use dom::bindings::utils::Reflectable; use dom::customevent::CustomEvent; use dom::document::Document; -use dom::element::{AttributeMutation, ElementTypeId, self}; +use dom::element::{self, AttributeMutation, ElementTypeId}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; use dom::urlhelper::UrlHelper; use dom::virtualmethods::VirtualMethods; use dom::window::Window; -use js::jsapi::{RootedValue, JSAutoRequest, JSAutoCompartment}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue}; use js::jsval::UndefinedValue; use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; use msg::constellation_msg::Msg as ConstellationMsg; -use msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan, MozBrowserEvent, NavigationDirection}; +use msg::constellation_msg::{ConstellationChan, MozBrowserEvent, NavigationDirection, PipelineId, SubpageId}; use page::IterablePage; use std::ascii::AsciiExt; use std::borrow::ToOwned; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index a305b9ee91a..3a4377b5481 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -8,8 +8,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; +use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLImageElementDerived}; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{LayoutJS, Root}; @@ -19,14 +19,14 @@ use dom::element::{AttributeMutation, ElementTypeId}; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; -use dom::node::{document_from_node, Node, NodeTypeId, NodeDamage, window_from_node}; +use dom::node::{Node, NodeDamage, NodeTypeId, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use net_traits::image::base::Image; use net_traits::image_cache_task::{ImageResponder, ImageResponse}; use script_task::ScriptTaskEventCategory::UpdateReplacedElement; -use script_task::{Runnable, ScriptChan, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable, ScriptChan}; use std::borrow::ToOwned; use std::sync::Arc; use string_cache::Atom; diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 766e3e7e0d5..0de98f19d49 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods; use dom::bindings::codegen::InheritTypes::KeyboardEventCast; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLInputElementCast, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLInputElementDerived, HTMLFieldSetElementDerived, EventTargetCast}; +use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLFieldSetElementDerived, HTMLInputElementDerived}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, LayoutJS, Root, RootedReference}; use dom::document::Document; @@ -20,8 +20,8 @@ use dom::element::{AttributeMutation, Element, ElementTypeId, RawLayoutElementHe use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; -use dom::htmlformelement::{FormSubmitter, FormControl, HTMLFormElement}; -use dom::htmlformelement::{SubmittedFrom, ResetFrom}; +use dom::htmlformelement::{FormControl, FormSubmitter, HTMLFormElement}; +use dom::htmlformelement::{ResetFrom, SubmittedFrom}; use dom::keyboardevent::KeyboardEvent; use dom::node::{Node, NodeDamage, NodeTypeId}; use dom::node::{document_from_node, window_from_node}; @@ -30,7 +30,7 @@ use msg::constellation_msg::ConstellationChan; use std::borrow::ToOwned; use std::cell::Cell; use string_cache::Atom; -use textinput::KeyReaction::{TriggerDefaultAction, DispatchInput, Nothing, RedrawSelection}; +use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction}; use textinput::Lines::Single; use textinput::{TextInput, TextPoint}; use util::str::DOMString; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 907b70af3e3..3188f5c48fe 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -17,7 +17,7 @@ use dom::bindings::refcounted::Trusted; use dom::document::Document; use dom::domtokenlist::DOMTokenList; use dom::element::{AttributeMutation, Element, ElementTypeId}; -use dom::event::{EventBubbles, EventCancelable, Event}; +use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{Node, NodeTypeId, window_from_node}; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 5dae52c2b47..cba43a2724f 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElemen use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::InheritTypes::EventTargetCast; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived, HTMLScriptElementCast}; +use dom::bindings::codegen::InheritTypes::{HTMLScriptElementCast, HTMLScriptElementDerived}; use dom::bindings::global::GlobalRef; use dom::bindings::js::RootedReference; use dom::bindings::js::{JS, Root}; @@ -29,18 +29,18 @@ use dom::virtualmethods::VirtualMethods; use dom::window::ScriptHelpers; use encoding::all::UTF_8; use encoding::label::encoding_from_whatwg_label; -use encoding::types::{Encoding, EncodingRef, DecoderTrap}; +use encoding::types::{DecoderTrap, Encoding, EncodingRef}; use html5ever::tree_builder::NextParserState; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::RootedValue; use js::jsval::UndefinedValue; -use net_traits::{Metadata, AsyncResponseListener, AsyncResponseTarget}; +use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata}; use network_listener::{NetworkListener, PreInvoke}; use script_task::ScriptTaskEventCategory::ScriptEvent; -use script_task::{ScriptChan, Runnable, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable, ScriptChan}; use std::ascii::AsciiExt; -use std::cell::{RefCell, Cell}; +use std::cell::{Cell, RefCell}; use std::mem; use std::sync::{Arc, Mutex}; use url::{Url, UrlParser}; diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index c4a503cc404..4e28f61c92e 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -6,7 +6,7 @@ use dom::attr::{Attr, AttrValue}; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLSelectElementDerived, HTMLFieldSetElementDerived}; +use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, HTMLSelectElementDerived}; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; use dom::bindings::js::Root; diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 4234d71b86f..f6739975402 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::InheritTypes::KeyboardEventCast; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementDerived, HTMLFieldSetElementDerived}; +use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, HTMLTextAreaElementDerived}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::refcounted::Trusted; @@ -26,11 +26,11 @@ use dom::node::{NodeTypeId, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; use script_task::ScriptTaskEventCategory::InputEvent; -use script_task::{Runnable, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable}; use std::borrow::ToOwned; use std::cell::Cell; use string_cache::Atom; -use textinput::{TextInput, Lines, KeyReaction}; +use textinput::{KeyReaction, Lines, TextInput}; use util::str::DOMString; #[dom_struct] diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 18c6f25ff8e..7f2b561e85f 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -8,8 +8,8 @@ use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::utils::{Reflector, reflect_dom_object}; use euclid::size::Size2D; -use js::jsapi::{JSContext, JSObject, Heap}; -use js::jsapi::{JS_NewUint8ClampedArray, JS_GetUint8ClampedArrayData}; +use js::jsapi::{Heap, JSContext, JSObject}; +use js::jsapi::{JS_GetUint8ClampedArrayData, JS_NewUint8ClampedArray}; use libc::uint8_t; use std::default::Default; use std::ptr; diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 8aca9b33ae8..3b317a3fcfb 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -3,9 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::KeyboardEventBinding; -use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventMethods, KeyboardEventConstants}; +use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventConstants, KeyboardEventMethods}; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; -use dom::bindings::codegen::InheritTypes::{EventCast, UIEventCast, KeyboardEventDerived}; +use dom::bindings::codegen::InheritTypes::{EventCast, KeyboardEventDerived, UIEventCast}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{Root, RootedReference}; @@ -14,10 +14,10 @@ use dom::event::{Event, EventTypeId}; use dom::uievent::{UIEvent, UIEventTypeId}; use dom::window::Window; use msg::constellation_msg; +use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers}; -use msg::constellation_msg::{SHIFT, CONTROL, ALT, SUPER}; use std::borrow::ToOwned; -use std::cell::{RefCell, Cell}; +use std::cell::{Cell, RefCell}; use util::str::DOMString; no_jsmanaged_fields!(Key); diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 895ebfcf1a9..d141c649aec 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -12,7 +12,7 @@ use dom::bindings::js::Root; use dom::bindings::utils::reflect_dom_object; use dom::event::{Event, EventTypeId}; use dom::eventtarget::EventTarget; -use js::jsapi::{JSContext, Heap, HandleValue}; +use js::jsapi::{HandleValue, Heap, JSContext}; use js::jsval::JSVal; use std::borrow::ToOwned; use std::default::Default; diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 77c7766c8eb..ec5ed78773b 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -185,14 +185,16 @@ #[macro_use] pub mod macros; -pub mod bindings; - pub mod types { include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs")); } pub mod activation; pub mod attr; +mod create; +#[allow(unsafe_code)] +#[deny(missing_docs, non_snake_case)] +pub mod bindings; pub mod blob; pub mod browsercontext; pub mod canvasgradient; @@ -202,7 +204,6 @@ pub mod characterdata; pub mod closeevent; pub mod comment; pub mod console; -mod create; pub mod crypto; pub mod css; pub mod cssstyledeclaration; @@ -319,6 +320,8 @@ pub mod screen; pub mod servohtmlparser; pub mod storage; pub mod storageevent; +pub mod testbinding; +pub mod testbindingproxy; pub mod text; pub mod textdecoder; pub mod textencoder; @@ -350,6 +353,3 @@ pub mod workernavigator; pub mod xmlhttprequest; pub mod xmlhttprequesteventtarget; pub mod xmlhttprequestupload; - -pub mod testbinding; -pub mod testbindingproxy; diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index 6b98dede144..5e75d11ea9d 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -5,12 +5,12 @@ use dom::bindings::codegen::Bindings::MouseEventBinding; use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; -use dom::bindings::codegen::InheritTypes::{EventCast, UIEventCast, MouseEventDerived}; +use dom::bindings::codegen::InheritTypes::{EventCast, MouseEventDerived, UIEventCast}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::utils::reflect_dom_object; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; use dom::eventtarget::EventTarget; use dom::uievent::{UIEvent, UIEventTypeId}; use dom::window::Window; diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 485cccf6ab5..078ddcc0d84 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; -use dom::bindings::utils::{namespace_from_domstring, Reflector, reflect_dom_object}; +use dom::bindings::utils::{Reflector, namespace_from_domstring, reflect_dom_object}; use dom::element::Element; use dom::window::Window; use string_cache::Atom; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index a63b0c2959e..a80763d1dde 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -18,13 +18,13 @@ use dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods}; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods; use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentCast, DocumentDerived, DocumentTypeCast}; -use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast, ElementDerived, EventTargetCast}; -use dom::bindings::codegen::InheritTypes::{HTMLLegendElementDerived, HTMLFieldSetElementDerived}; +use dom::bindings::codegen::InheritTypes::{ElementCast, ElementDerived, EventTargetCast, NodeCast}; +use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, HTMLLegendElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLOptGroupElementDerived, NodeBase, NodeDerived}; use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, TextCast, TextDerived}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::conversions; -use dom::bindings::error::Error::{NotFound, HierarchyRequest, Syntax}; +use dom::bindings::error::Error::{HierarchyRequest, NotFound, Syntax}; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; @@ -32,10 +32,10 @@ use dom::bindings::js::RootedReference; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::trace::JSTraceable; use dom::bindings::trace::RootedVec; -use dom::bindings::utils::{namespace_from_domstring, Reflectable, reflect_dom_object}; +use dom::bindings::utils::{Reflectable, namespace_from_domstring, reflect_dom_object}; use dom::characterdata::{CharacterData, CharacterDataTypeId}; use dom::comment::Comment; -use dom::document::{Document, IsHTMLDocument, DocumentSource}; +use dom::document::{Document, DocumentSource, IsHTMLDocument}; use dom::documentfragment::DocumentFragment; use dom::documenttype::DocumentType; use dom::element::{Element, ElementCreator, ElementTypeId}; @@ -49,15 +49,14 @@ use dom::window::Window; use euclid::rect::Rect; use js::jsapi::{JSContext, JSObject, JSRuntime}; use layout_interface::{LayoutChan, Msg}; -use libc; -use libc::{uintptr_t, c_void}; +use libc::{self, c_void, uintptr_t}; use parse::html::parse_html_fragment; use script_traits::UntrustedNodeAddress; use selectors::matching::matches; use selectors::parser::Selector; use selectors::parser::parse_author_origin_selector_list_from_str; use std::borrow::ToOwned; -use std::cell::{Cell, RefCell, Ref, RefMut}; +use std::cell::{Cell, Ref, RefCell, RefMut}; use std::default::Default; use std::iter::{FilterMap, Peekable}; use std::mem; diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index b715330edae..05e0343df24 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -10,7 +10,7 @@ use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::utils::reflect_dom_object; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; use util::str::DOMString; #[dom_struct] diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs index b5eaa321473..fd854768347 100644 --- a/components/script/dom/servohtmlparser.rs +++ b/components/script/dom/servohtmlparser.rs @@ -15,22 +15,22 @@ use dom::bindings::refcounted::Trusted; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::document::Document; -use dom::node::{window_from_node, Node}; +use dom::node::{Node, window_from_node}; use dom::text::Text; use dom::window::Window; use encoding::all::UTF_8; -use encoding::types::{Encoding, DecoderTrap}; +use encoding::types::{DecoderTrap, Encoding}; use html5ever::tokenizer; use html5ever::tree_builder; use html5ever::tree_builder::{NodeOrText, TreeBuilder, TreeBuilderOpts}; use hyper::header::ContentType; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use js::jsapi::JSTracer; use msg::constellation_msg::{PipelineId, SubpageId}; -use net_traits::{Metadata, AsyncResponseListener}; +use net_traits::{AsyncResponseListener, Metadata}; use network_listener::PreInvoke; use parse::Parser; -use script_task::{ScriptTask, ScriptChan}; +use script_task::{ScriptChan, ScriptTask}; use std::cell::{Cell, RefCell}; use std::default::Default; use url::Url; diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 564eba1bc6a..5c64bf7fe8b 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::StorageBinding; use dom::bindings::codegen::Bindings::StorageBinding::StorageMethods; use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast}; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::{Root, RootedReference}; use dom::bindings::refcounted::Trusted; use dom::bindings::utils::{Reflector, reflect_dom_object}; @@ -15,7 +15,7 @@ use dom::urlhelper::UrlHelper; use ipc_channel::ipc; use net_traits::storage_task::{StorageTask, StorageTaskMsg, StorageType}; use page::IterablePage; -use script_task::{ScriptTask, MainThreadRunnable, MainThreadScriptMsg}; +use script_task::{MainThreadRunnable, MainThreadScriptMsg, ScriptTask}; use std::borrow::ToOwned; use std::sync::mpsc::channel; use url::Url; diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index db5b8a0f608..60168971bf4 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -10,7 +10,7 @@ use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::utils::{reflect_dom_object}; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; use dom::storage::Storage; use util::str::DOMString; diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 93285b1ea35..7c2038eab3b 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -20,7 +20,7 @@ use dom::bindings::num::Finite; use dom::bindings::str::{ByteString, USVString}; use dom::bindings::utils::Reflector; use dom::blob::Blob; -use js::jsapi::{JSContext, JSObject, HandleValue}; +use js::jsapi::{HandleValue, JSContext, JSObject}; use js::jsval::{JSVal, NullValue}; use std::borrow::ToOwned; use std::ptr; diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index cecb84a73ac..c09fcd25614 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -12,12 +12,11 @@ use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{Reflector, reflect_dom_object}; use encoding::Encoding; use encoding::label::encoding_from_whatwg_label; -use encoding::types::{EncodingRef, DecoderTrap}; +use encoding::types::{DecoderTrap, EncodingRef}; use js::jsapi::JS_GetObjectAsArrayBufferView; use js::jsapi::{JSContext, JSObject}; use std::borrow::ToOwned; -use std::ptr; -use std::slice; +use std::{ptr, slice}; use util::str::DOMString; #[dom_struct] diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index 8e0e5daa55e..17d5e0aeb60 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -12,9 +12,9 @@ use dom::bindings::str::USVString; use dom::bindings::utils::{Reflector, reflect_dom_object}; use encoding::label::encoding_from_whatwg_label; use encoding::types::EncodingRef; -use encoding::{Encoding, EncoderTrap}; +use encoding::{EncoderTrap, Encoding}; use js::jsapi::{JSContext, JSObject}; -use js::jsapi::{JS_NewUint8Array, JS_GetUint8ArrayData}; +use js::jsapi::{JS_GetUint8ArrayData, JS_NewUint8Array}; use libc::uint8_t; use std::borrow::ToOwned; use std::ptr; diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index 28434e0a9f8..599d8a936a3 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -11,7 +11,7 @@ use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::js::{JS, MutNullableHeap, RootedReference}; use dom::bindings::utils::reflect_dom_object; -use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use dom::event::{Event, EventBubbles, EventCancelable, EventTypeId}; use dom::window::Window; use std::cell::Cell; use std::default::Default; diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs index 61d81890fdf..8d6916c0551 100644 --- a/components/script/dom/urlhelper.rs +++ b/components/script/dom/urlhelper.rs @@ -6,7 +6,7 @@ use dom::bindings::str::USVString; use std::borrow::ToOwned; use std::fmt::Write; use url::urlutils::{UrlUtils, UrlUtilsWrapper}; -use url::{Url, UrlParser, SchemeData}; +use url::{SchemeData, Url, UrlParser}; #[derive(HeapSizeOf)] pub struct UrlHelper; diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 37fa56da04b..6ddfe4f5278 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::URLSearchParamsBinding; use dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchParamsMethods; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams; -use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eURLSearchParams, eString}; +use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 231a16017c0..37dfc3d7904 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl -use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLError}; +use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLError, WebGLResult}; use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::global::GlobalRef; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index da77c58a565..93398ffee56 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -3,20 +3,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::WebGLError::*; -use canvas_traits::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg, WebGLError}; -use canvas_traits::{WebGLShaderParameter, WebGLFramebufferBindingRequest}; +use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasWebGLMsg, WebGLError}; +use canvas_traits::{WebGLFramebufferBindingRequest, WebGLShaderParameter}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{WebGLRenderingContextMethods}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes}; use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement; use dom::bindings::conversions::ToJSValConvertible; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::{JS, LayoutJS, Root}; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::utils as canvas_utils; -use dom::node::{window_from_node, NodeDamage}; +use dom::node::{NodeDamage, window_from_node}; use dom::webglbuffer::WebGLBuffer; use dom::webglframebuffer::WebGLFramebuffer; use dom::webglprogram::WebGLProgram; @@ -28,16 +28,14 @@ use euclid::size::Size2D; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{JSContext, JSObject, RootedValue}; use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView}; -use js::jsval::{JSVal, UndefinedValue, NullValue, Int32Value, BooleanValue}; +use js::jsval::{BooleanValue, Int32Value, JSVal, NullValue, UndefinedValue}; use msg::constellation_msg::Msg as ConstellationMsg; use net_traits::image::base::PixelFormat; use net_traits::image_cache_task::ImageResponse; use offscreen_gl_context::GLContextAttributes; use std::cell::Cell; -use std::mem; -use std::ptr; -use std::slice; use std::sync::mpsc::channel; +use std::{mem, ptr, slice}; use util::str::DOMString; use util::vec::byte_swap; diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index fcaf3578b02..e33b27d3839 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -4,7 +4,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use angle::hl::{BuiltInResources, Output, ShaderValidator}; -use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLError, WebGLShaderParameter}; +use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLError, WebGLResult, WebGLShaderParameter}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLShaderBinding; use dom::bindings::global::GlobalRef; @@ -12,9 +12,8 @@ use dom::bindings::js::Root; use dom::bindings::utils::reflect_dom_object; use dom::webglobject::WebGLObject; use ipc_channel::ipc::{self, IpcSender}; -use std::cell::Cell; -use std::cell::RefCell; -use std::sync::{Once, ONCE_INIT}; +use std::cell::{Cell, RefCell}; +use std::sync::{ONCE_INIT, Once}; #[derive(Clone, Copy, PartialEq, Debug, JSTraceable, HeapSizeOf)] pub enum ShaderCompilationStatus { diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 4dc3d84c536..304ea11e05a 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -16,28 +16,26 @@ use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::str::USVString; use dom::bindings::trace::JSTraceable; -use dom::bindings::utils::{reflect_dom_object, Reflectable}; +use dom::bindings::utils::{Reflectable, reflect_dom_object}; use dom::blob::Blob; use dom::closeevent::CloseEvent; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; use dom::messageevent::MessageEvent; use hyper::header::Host; -use js::jsapi::{JS_NewArrayBuffer, JS_GetArrayBufferData}; -use js::jsapi::{RootedValue, JSAutoRequest, JSAutoCompartment}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue}; +use js::jsapi::{JS_GetArrayBufferData, JS_NewArrayBuffer}; use js::jsval::UndefinedValue; -use libc::{uint8_t, uint32_t}; +use libc::{uint32_t, uint8_t}; use net_traits::hosts::replace_hosts; use script_task::ScriptTaskEventCategory::WebSocketEvent; -use script_task::{Runnable, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable}; use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; use std::ptr; use std::sync::{Arc, Mutex}; use util::str::DOMString; use util::task::spawn_named; -use websocket::Client; -use websocket::Message; use websocket::client::receiver::Receiver; use websocket::client::request::Url; use websocket::client::sender::Sender; @@ -47,6 +45,7 @@ use websocket::stream::WebSocketStream; use websocket::ws::receiver::Receiver as WSReceiver; use websocket::ws::sender::Sender as Sender_Object; use websocket::ws::util::url::parse_url; +use websocket::{Client, Message}; #[derive(JSTraceable, PartialEq, Copy, Clone, Debug, HeapSizeOf)] enum WebSocketRequestState { diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 583f3b68780..e787368ef61 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -6,17 +6,17 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarker use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; -use dom::bindings::codegen::Bindings::EventHandlerBinding::{OnErrorEventHandlerNonNull, EventHandlerNonNull}; +use dom::bindings::codegen::Bindings::EventHandlerBinding::{EventHandlerNonNull, OnErrorEventHandlerNonNull}; use dom::bindings::codegen::Bindings::FunctionBinding::Function; -use dom::bindings::codegen::Bindings::WindowBinding::{ScrollToOptions, ScrollBehavior}; -use dom::bindings::codegen::Bindings::WindowBinding::{self, WindowMethods, FrameRequestCallback}; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, WindowDerived}; +use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; +use dom::bindings::codegen::Bindings::WindowBinding::{self, FrameRequestCallback, WindowMethods}; +use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, NodeCast, WindowDerived}; use dom::bindings::error::Error::InvalidCharacter; -use dom::bindings::error::{report_pending_exception, Fallible}; +use dom::bindings::error::{Fallible, report_pending_exception}; use dom::bindings::global::GlobalRef; use dom::bindings::global::global_object_for_js_object; use dom::bindings::js::RootedReference; -use dom::bindings::js::{JS, Root, MutNullableHeap}; +use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::num::Finite; use dom::bindings::utils::{GlobalStaticData, Reflectable, WindowProxyHandler}; use dom::browsercontext::BrowsingContext; @@ -28,22 +28,22 @@ use dom::element::Element; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::location::Location; use dom::navigator::Navigator; -use dom::node::{window_from_node, TrustedNodeAddress, from_untrusted_node_address}; +use dom::node::{TrustedNodeAddress, from_untrusted_node_address, window_from_node}; use dom::performance::Performance; use dom::screen::Screen; use dom::storage::Storage; use euclid::{Point2D, Rect, Size2D}; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{Evaluate2, MutableHandleValue}; -use js::jsapi::{JSContext, HandleValue}; -use js::jsapi::{JS_GC, JS_GetRuntime, JSAutoCompartment, JSAutoRequest}; +use js::jsapi::{HandleValue, JSContext}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_GC, JS_GetRuntime}; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow}; -use layout_interface::{ReflowGoal, ReflowQueryType, LayoutRPC, LayoutChan, Reflow, Msg}; +use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType}; use libc; -use msg::compositor_msg::{ScriptToCompositorMsg, LayerId}; -use msg::constellation_msg::{LoadData, PipelineId, SubpageId, ConstellationChan, WindowSizeData, WorkerId}; +use msg::compositor_msg::{LayerId, ScriptToCompositorMsg}; +use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData, WorkerId}; use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use net_traits::ResourceTask; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask}; @@ -51,9 +51,9 @@ use net_traits::storage_task::{StorageTask, StorageType}; use num::traits::ToPrimitive; use page::Page; use profile_traits::mem; -use rustc_serialize::base64::{FromBase64, ToBase64, STANDARD}; -use script_task::{SendableMainThreadScriptChan, MainThreadScriptChan}; -use script_task::{TimerSource, ScriptChan, ScriptPort, MainThreadScriptMsg}; +use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64}; +use script_task::{MainThreadScriptChan, SendableMainThreadScriptChan}; +use script_task::{MainThreadScriptMsg, ScriptChan, ScriptPort, TimerSource}; use script_traits::ConstellationControlMsg; use selectors::parser::PseudoElement; use std::ascii::AsciiExt; @@ -62,15 +62,15 @@ use std::cell::{Cell, Ref, RefCell}; use std::collections::HashSet; use std::default::Default; use std::ffi::CString; -use std::io::{stdout, stderr, Write}; +use std::io::{Write, stderr, stdout}; use std::mem as std_mem; use std::rc::Rc; use std::sync::Arc; -use std::sync::mpsc::TryRecvError::{Empty, Disconnected}; -use std::sync::mpsc::{channel, Receiver, Sender}; +use std::sync::mpsc::TryRecvError::{Disconnected, Empty}; +use std::sync::mpsc::{Receiver, Sender, channel}; use string_cache::Atom; use time; -use timers::{IsInterval, TimerId, TimerManager, TimerCallback}; +use timers::{IsInterval, TimerCallback, TimerId, TimerManager}; use url::Url; use util::geometry::{self, Au, MAX_RECT}; use util::str::{DOMString, HTML_SPACE_CHARACTERS}; diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index efbde8eee1a..5a6d264f714 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMethods; use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast}; use dom::bindings::error::Error::Syntax; -use dom::bindings::error::{Fallible, ErrorResult}; -use dom::bindings::global::{GlobalRef, GlobalField}; +use dom::bindings::error::{ErrorResult, Fallible}; +use dom::bindings::global::{GlobalField, GlobalRef}; use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::structuredclone::StructuredCloneData; @@ -22,12 +22,12 @@ use dom::eventtarget::EventTarget; use dom::messageevent::MessageEvent; use dom::workerglobalscope::WorkerGlobalScopeInit; use ipc_channel::ipc; -use js::jsapi::{JSAutoRequest, JSAutoCompartment}; -use js::jsapi::{JSContext, HandleValue, RootedValue}; +use js::jsapi::{HandleValue, JSContext, RootedValue}; +use js::jsapi::{JSAutoCompartment, JSAutoRequest}; use js::jsval::UndefinedValue; -use script_task::{ScriptChan, Runnable}; +use script_task::{Runnable, ScriptChan}; use std::borrow::ToOwned; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use url::UrlParser; use util::str::DOMString; diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 3d5d459d4e2..881a6ef3c2f 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -2,14 +2,14 @@ * 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 devtools_traits::{ScriptToDevtoolsControlMsg, DevtoolScriptControlMsg}; +use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg}; use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use dom::bindings::codegen::InheritTypes::DedicatedWorkerGlobalScopeCast; -use dom::bindings::error::Error::{Syntax, Network, JSFailed}; +use dom::bindings::error::Error::{JSFailed, Network, Syntax}; use dom::bindings::error::{ErrorResult, Fallible, report_pending_exception}; use dom::bindings::global::GlobalRef; -use dom::bindings::js::{JS, Root, MutNullableHeap}; +use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::utils::Reflectable; use dom::console::Console; use dom::crypto::Crypto; @@ -18,17 +18,17 @@ use dom::window::{base64_atob, base64_btoa}; use dom::workerlocation::WorkerLocation; use dom::workernavigator::WorkerNavigator; use ipc_channel::ipc::IpcSender; -use js::jsapi::{JSContext, HandleValue, JSAutoRequest}; +use js::jsapi::{HandleValue, JSAutoRequest, JSContext}; use js::rust::Runtime; use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId}; -use net_traits::{load_whole_resource, ResourceTask}; +use net_traits::{ResourceTask, load_whole_resource}; use profile_traits::mem; -use script_task::{CommonScriptMsg, ScriptChan, TimerSource, ScriptPort}; +use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, TimerSource}; use std::cell::Cell; use std::default::Default; use std::rc::Rc; use std::sync::mpsc::Receiver; -use timers::{IsInterval, TimerId, TimerManager, TimerCallback}; +use timers::{IsInterval, TimerCallback, TimerId, TimerManager}; use url::{Url, UrlParser}; use util::str::DOMString; diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 7fa69f701a5..ccff93ad5be 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -3,19 +3,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cors::CORSResponse; -use cors::{allow_cross_origin_request, CORSRequest, RequestMode, AsyncCORSResponseListener}; +use cors::{AsyncCORSResponseListener, CORSRequest, RequestMode, allow_cross_origin_request}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestMethods; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestResponseType; -use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestResponseType::{_empty, Json, Text}; +use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestResponseType::{Json, Text, _empty}; use dom::bindings::codegen::InheritTypes::{EventCast, EventTargetCast, XMLHttpRequestDerived}; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams}; use dom::bindings::conversions::ToJSValConvertible; -use dom::bindings::error::Error::{InvalidState, InvalidAccess}; -use dom::bindings::error::Error::{Network, Syntax, Security, Abort, Timeout}; +use dom::bindings::error::Error::{Abort, Network, Security, Syntax, Timeout}; +use dom::bindings::error::Error::{InvalidAccess, InvalidState}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::global::{GlobalField, GlobalRef, GlobalRoot}; use dom::bindings::js::Root; @@ -32,7 +32,7 @@ use dom::xmlhttprequesteventtarget::XMLHttpRequestEventTargetTypeId; use dom::xmlhttprequestupload::XMLHttpRequestUpload; use encoding::all::UTF_8; use encoding::label::encoding_from_whatwg_label; -use encoding::types::{DecoderTrap, Encoding, EncodingRef, EncoderTrap}; +use encoding::types::{DecoderTrap, EncoderTrap, Encoding, EncodingRef}; use hyper::header::Headers; use hyper::header::{Accept, ContentLength, ContentType, qitem}; use hyper::http::RawStatus; @@ -41,20 +41,20 @@ use hyper::mime::{self, Mime}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::JS_ClearPendingException; -use js::jsapi::{JS_ParseJSON, JSContext, RootedValue}; +use js::jsapi::{JSContext, JS_ParseJSON, RootedValue}; use js::jsval::{JSVal, NullValue, UndefinedValue}; use net_traits::ControlMsg::Load; use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata}; -use net_traits::{ResourceTask, ResourceCORSData, LoadData, LoadConsumer}; +use net_traits::{LoadConsumer, LoadData, ResourceCORSData, ResourceTask}; use network_listener::{NetworkListener, PreInvoke}; use script_task::ScriptTaskEventCategory::XhrEvent; -use script_task::{ScriptChan, Runnable, ScriptPort, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable, ScriptChan, ScriptPort}; use std::ascii::AsciiExt; use std::borrow::ToOwned; -use std::cell::{RefCell, Cell}; +use std::cell::{Cell, RefCell}; use std::default::Default; -use std::sync::mpsc::{channel, Sender, TryRecvError}; -use std::sync::{Mutex, Arc}; +use std::sync::mpsc::{Sender, TryRecvError, channel}; +use std::sync::{Arc, Mutex}; use std::thread::sleep_ms; use time; use url::{Url, UrlParser}; diff --git a/components/script/horribly_inefficient_timers.rs b/components/script/horribly_inefficient_timers.rs index 6f3774d3dca..2e1ca0f12c3 100644 --- a/components/script/horribly_inefficient_timers.rs +++ b/components/script/horribly_inefficient_timers.rs @@ -5,8 +5,8 @@ /// A quick hack to work around the removal of [`std::old_io::timer::Timer`]( /// http://doc.rust-lang.org/1.0.0-beta/std/old_io/timer/struct.Timer.html ) -use std::sync::mpsc::{channel, Receiver}; -use std::thread::{spawn, sleep_ms}; +use std::sync::mpsc::{Receiver, channel}; +use std::thread::{sleep_ms, spawn}; pub fn oneshot(duration_ms: u32) -> Receiver<()> { let (tx, rx) = channel(); diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index 22f2f808f04..9a461a4b1b0 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -22,14 +22,13 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg}; use script_traits::{OpaqueScriptLayoutChannel, StylesheetLoadResponder, UntrustedNodeAddress}; use selectors::parser::PseudoElement; use std::any::Any; -use std::sync::mpsc::{channel, Receiver, Sender}; +use std::sync::mpsc::{Receiver, Sender, channel}; use string_cache::Atom; use style::animation::PropertyAnimation; use style::media_queries::MediaQueryList; use style::stylesheets::Stylesheet; use url::Url; use util::geometry::Au; - pub use dom::node::TrustedNodeAddress; /// Asynchronous messages that script can send to layout. @@ -250,4 +249,3 @@ pub struct NewLayoutTaskInfo { pub paint_chan: Box<Any + Send>, pub layout_shutdown_chan: Sender<()>, } - diff --git a/components/script/lib.rs b/components/script/lib.rs index 3a7c70032cc..1380502957e 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -36,16 +36,25 @@ #![plugin(plugins)] #[macro_use] +extern crate bitflags; +#[macro_use] extern crate log; - -#[macro_use] extern crate bitflags; +#[macro_use] +extern crate profile_traits; +#[macro_use] +extern crate style; +#[macro_use] +extern crate util; +extern crate angle; +extern crate canvas; +extern crate canvas_traits; extern crate core; -extern crate devtools_traits; extern crate cssparser; -extern crate euclid; -extern crate html5ever; +extern crate devtools_traits; extern crate encoding; +extern crate euclid; extern crate fnv; +extern crate html5ever; extern crate hyper; extern crate ipc_channel; extern crate js; @@ -53,46 +62,35 @@ extern crate libc; extern crate msg; extern crate net_traits; extern crate num; +extern crate offscreen_gl_context; +extern crate rand; extern crate rustc_serialize; extern crate rustc_unicode; -extern crate serde; -extern crate time; -extern crate canvas; -extern crate canvas_traits; -extern crate rand; -#[macro_use] -extern crate profile_traits; extern crate script_traits; extern crate selectors; +extern crate serde; extern crate smallvec; -#[macro_use] -extern crate util; -extern crate websocket; -#[macro_use] -extern crate style; +extern crate string_cache; +extern crate tendril; +extern crate time; extern crate unicase; extern crate url; extern crate uuid; -extern crate string_cache; -extern crate offscreen_gl_context; -extern crate angle; -extern crate tendril; +extern crate websocket; +pub mod clipboard_provider; pub mod cors; +mod devtools; pub mod document_loader; - #[macro_use] pub mod dom; - -pub mod parse; - -pub mod clipboard_provider; -mod devtools; mod horribly_inefficient_timers; pub mod layout_interface; mod mem; mod network_listener; pub mod page; +pub mod parse; +#[allow(unsafe_code)] pub mod script_task; pub mod textinput; mod timers; diff --git a/components/script/network_listener.rs b/components/script/network_listener.rs index ec5abe2d5a5..cc242173241 100644 --- a/components/script/network_listener.rs +++ b/components/script/network_listener.rs @@ -4,7 +4,7 @@ use net_traits::{AsyncResponseListener, ResponseAction}; use script_task::ScriptTaskEventCategory::NetworkEvent; -use script_task::{ScriptChan, Runnable, CommonScriptMsg}; +use script_task::{CommonScriptMsg, Runnable, ScriptChan}; use std::sync::{Arc, Mutex}; /// An off-thread sink for async network event runnables. All such events are forwarded to diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs index 6bdd6d5bde0..3972fba7a3d 100644 --- a/components/script/parse/html.rs +++ b/components/script/parse/html.rs @@ -24,12 +24,12 @@ use dom::htmlscriptelement::HTMLScriptElement; use dom::node::{Node, NodeTypeId}; use dom::node::{document_from_node, window_from_node}; use dom::servohtmlparser; -use dom::servohtmlparser::{ServoHTMLParser, FragmentContext}; +use dom::servohtmlparser::{FragmentContext, ServoHTMLParser}; use encoding::types::Encoding; use html5ever::Attribute; use html5ever::serialize::TraversalScope; -use html5ever::serialize::TraversalScope::{IncludeNode, ChildrenOnly}; -use html5ever::serialize::{Serializable, Serializer, AttrRef}; +use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; +use html5ever::serialize::{AttrRef, Serializable, Serializer}; use html5ever::tree_builder::{NextParserState, NodeOrText, QuirksMode, TreeSink}; use msg::constellation_msg::PipelineId; use parse::Parser; diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 7c7292c2abc..d8ac155b3b9 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -17,50 +17,48 @@ //! a page runs its course and the script task returns to processing events in the main event //! loop. -#![allow(unsafe_code)] - use devtools; use devtools_traits::ScriptToDevtoolsControlMsg; -use devtools_traits::{DevtoolsPageInfo, DevtoolScriptControlMsg}; -use document_loader::{LoadType, DocumentLoader, NotifierData}; +use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; +use document_loader::{DocumentLoader, LoadType, NotifierData}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; -use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, NodeCast, EventCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, EventCast, EventTargetCast, NodeCast}; use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::conversions::StringificationBehavior; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, RootCollection, trace_roots}; -use dom::bindings::js::{RootCollectionPtr, Root, RootedReference}; +use dom::bindings::js::{Root, RootCollectionPtr, RootedReference}; use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference, trace_refcounted_objects}; -use dom::bindings::trace::{JSTraceable, trace_traceables, RootedVec}; -use dom::bindings::utils::{WRAP_CALLBACKS, DOM_CALLBACKS}; -use dom::document::{Document, IsHTMLDocument, DocumentProgressHandler}; +use dom::bindings::trace::{JSTraceable, RootedVec, trace_traceables}; +use dom::bindings::utils::{DOM_CALLBACKS, WRAP_CALLBACKS}; +use dom::document::{Document, DocumentProgressHandler, IsHTMLDocument}; use dom::document::{DocumentProgressTask, DocumentSource, MouseEventType}; use dom::element::Element; use dom::event::{EventBubbles, EventCancelable}; use dom::node::{Node, NodeDamage, window_from_node}; -use dom::servohtmlparser::{ServoHTMLParser, ParserContext}; +use dom::servohtmlparser::{ParserContext, ServoHTMLParser}; use dom::uievent::UIEvent; -use dom::window::{Window, ScriptHelpers, ReflowReason}; +use dom::window::{ReflowReason, ScriptHelpers, Window}; use dom::worker::TrustedWorkerAddress; use euclid::Rect; use euclid::point::Point2D; use hyper::header::{ContentType, HttpDate}; -use hyper::header::{LastModified, Headers}; +use hyper::header::{Headers, LastModified}; use hyper::method::Method; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use js::glue::CollectServoSizes; +use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject, RootedValue, SetDOMProxyInformation}; +use js::jsapi::{DisableIncrementalGC, JS_AddExtraGCRootsTracer, JS_SetWrapObjectCallbacks}; +use js::jsapi::{GCDescription, GCProgress, JSGCInvocationKind, SetGCSliceCallback}; +use js::jsapi::{JSAutoRequest, JSGCStatus, JS_GetRuntime, JS_SetGCCallback, SetDOMCallbacks}; use js::jsapi::{JSContext, JSRuntime, JSTracer}; -use js::jsapi::{JSGCInvocationKind, GCDescription, SetGCSliceCallback, GCProgress}; -use js::jsapi::{JS_GetRuntime, JS_SetGCCallback, JSGCStatus, JSAutoRequest, SetDOMCallbacks}; -use js::jsapi::{JS_SetWrapObjectCallbacks, JS_AddExtraGCRootsTracer, DisableIncrementalGC}; -use js::jsapi::{SetDOMProxyInformation, DOMProxyShadowsResult, HandleObject, HandleId, RootedValue}; use js::jsval::UndefinedValue; use js::rust::Runtime; use layout_interface::{ReflowQueryType}; -use layout_interface::{self, NewLayoutTaskInfo, ScriptLayoutChan, LayoutChan, ReflowGoal}; +use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLayoutChan}; use libc; use mem::heap_size_of_eventtarget; use msg::compositor_msg::{LayerId, ScriptToCompositorMsg}; @@ -70,17 +68,17 @@ use msg::constellation_msg::{MozBrowserEvent, PipelineExitType, PipelineId}; use msg::constellation_msg::{SubpageId, WindowSizeData, WorkerId}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::LoadData as NetLoadData; -use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageCacheResult}; +use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask}; use net_traits::storage_task::StorageTask; -use net_traits::{AsyncResponseTarget, ResourceTask, LoadConsumer, ControlMsg, Metadata}; +use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, Metadata, ResourceTask}; use network_listener::NetworkListener; -use page::{Page, IterablePage, Frame}; +use page::{Frame, IterablePage, Page}; use parse::html::{ParseContext, parse_html}; -use profile_traits::mem::{self, Report, ReportKind, ReportsChan, OpaqueSender}; +use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan}; use profile_traits::time::{self, ProfilerCategory, profile}; +use script_traits::CompositorEvent::{ClickEvent, ResizeEvent}; +use script_traits::CompositorEvent::{KeyEvent, MouseMoveEvent}; use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent}; -use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent}; -use script_traits::CompositorEvent::{ResizeEvent, ClickEvent}; use script_traits::{CompositorEvent, ConstellationControlMsg}; use script_traits::{InitialScriptState, MouseButton, NewLayoutInfo}; use script_traits::{OpaqueScriptLayoutChannel, ScriptState, ScriptTaskFactory}; @@ -88,16 +86,16 @@ use std::any::Any; use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; use std::collections::HashSet; -use std::io::{stdout, Write}; +use std::io::{Write, stdout}; use std::mem as std_mem; use std::option::Option; use std::ptr; use std::rc::Rc; use std::result::Result; -use std::sync::mpsc::{channel, Sender, Receiver, Select}; +use std::sync::mpsc::{Receiver, Select, Sender, channel}; use std::sync::{Arc, Mutex}; use string_cache::Atom; -use time::{now, Tm}; +use time::{Tm, now}; use timers::TimerId; use url::{Url, UrlParser}; use util::opts; diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 39fce074558..627ecf29a5f 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -6,15 +6,14 @@ use clipboard_provider::ClipboardProvider; use dom::keyboardevent::{KeyboardEvent, key_value}; +use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers}; -use msg::constellation_msg::{SHIFT, CONTROL, ALT, SUPER}; use std::borrow::ToOwned; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::default::Default; use util::mem::HeapSizeOf; use util::str::DOMString; - #[derive(Copy, Clone, PartialEq)] pub enum Selection { Selected, diff --git a/components/script/timers.rs b/components/script/timers.rs index 979f03396ee..97aa20a3fa7 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -9,9 +9,9 @@ use dom::bindings::global::global_object_for_js_object; use dom::bindings::utils::Reflectable; use dom::window::ScriptHelpers; use horribly_inefficient_timers; -use js::jsapi::{RootedValue, HandleValue, Heap}; +use js::jsapi::{HandleValue, Heap, RootedValue}; use js::jsval::{JSVal, UndefinedValue}; -use script_task::{ScriptChan, TimerSource, CommonScriptMsg}; +use script_task::{CommonScriptMsg, ScriptChan, TimerSource}; use std::borrow::ToOwned; use std::cell::Cell; use std::cmp; @@ -20,12 +20,11 @@ use std::default::Default; use std::hash::{Hash, Hasher}; use std::rc::Rc; use std::sync::mpsc::Select; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use util::mem::HeapSizeOf; use util::str::DOMString; use util::task::spawn_named; - #[derive(JSTraceable, PartialEq, Eq, Copy, Clone, HeapSizeOf)] pub struct TimerId(i32); diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index c7a834bade7..79f0f502ae2 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLIFrameElementCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementCast, NodeCast}; use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::conversions::StringificationBehavior; use dom::bindings::js::Root; @@ -15,10 +15,10 @@ use dom::node::Node; use dom::window::ScriptHelpers; use ipc_channel::ipc::IpcSender; use js::jsapi::JSContext; -use js::jsapi::{RootedValue, HandleValue}; +use js::jsapi::{HandleValue, RootedValue}; use js::jsval::UndefinedValue; use msg::constellation_msg::{PipelineId, SubpageId}; -use msg::webdriver_msg::{WebDriverJSValue, WebDriverJSError, WebDriverJSResult, WebDriverFrameId}; +use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue}; use page::Page; use script_task::get_page; use std::rc::Rc; |