diff options
194 files changed, 775 insertions, 841 deletions
diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 1fec7e75165..9342b7fa60d 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -13,10 +13,12 @@ git = "https://github.com/servo/rust-azure" [dependencies.layers] git = "https://github.com/servo/rust-layers" - [dependencies.canvas_traits] path = "../canvas_traits" +[dependencies.plugins] +path = "../plugins" + [dependencies.util] path = "../util" @@ -39,4 +41,3 @@ log = "0.3" num = "0.1.24" gleam = "0.1" euclid = "0.2" - diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index cf179fc9600..5d39c26fbf8 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -2,10 +2,10 @@ * 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 azure::azure::{AzFloat, AzColor}; -use azure::azure_hl::{ColorPattern, PathBuilder, DrawSurfaceOptions, Filter}; -use azure::azure_hl::{DrawTarget, SurfaceFormat, BackendType, StrokeOptions, DrawOptions, Pattern}; -use azure::azure_hl::{JoinStyle, CapStyle, CompositionOp, AntialiasMode}; +use azure::azure::{AzColor, AzFloat}; +use azure::azure_hl::{AntialiasMode, CapStyle, CompositionOp, JoinStyle}; +use azure::azure_hl::{BackendType, DrawOptions, DrawTarget, Pattern, StrokeOptions, SurfaceFormat}; +use azure::azure_hl::{ColorPattern, DrawSurfaceOptions, Filter, PathBuilder}; use canvas_traits::*; use euclid::matrix2d::Matrix2D; use euclid::point::Point2D; @@ -19,7 +19,7 @@ use layers::platform::surface::NativeSurface; use num::ToPrimitive; use std::borrow::ToOwned; use std::mem; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use util::opts; use util::task::spawn_named; use util::vec::byte_swap; diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 443c9b901f8..4ab241072e4 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -6,22 +6,23 @@ #![feature(nonzero)] #![feature(slice_bytes)] #![feature(vec_push_all)] +#![feature(plugin)] +#![plugin(plugins)] -extern crate core; -extern crate canvas_traits; +#[macro_use] +extern crate log; extern crate azure; +extern crate canvas_traits; +extern crate core; extern crate cssparser; extern crate euclid; extern crate gfx_traits; -extern crate ipc_channel; -extern crate util; extern crate gleam; -extern crate num; +extern crate ipc_channel; extern crate layers; +extern crate num; extern crate offscreen_gl_context; - -#[macro_use] -extern crate log; +extern crate util; pub mod canvas_paint_task; pub mod webgl_paint_task; diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index b10e31a01e0..28fabacf72e 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg, FromLayoutMsg, FromPaintMsg}; -use canvas_traits::{WebGLShaderParameter, WebGLFramebufferBindingRequest}; +use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasWebGLMsg, FromLayoutMsg, FromPaintMsg}; +use canvas_traits::{WebGLFramebufferBindingRequest, WebGLShaderParameter}; use core::nonzero::NonZero; use euclid::size::Size2D; use gleam::gl; @@ -11,10 +11,10 @@ use gleam::gl::types::{GLsizei}; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use ipc_channel::router::ROUTER; use layers::platform::surface::NativeSurface; -use offscreen_gl_context::{GLContext, GLContextAttributes, ColorAttachmentType}; +use offscreen_gl_context::{ColorAttachmentType, GLContext, GLContextAttributes}; use std::borrow::ToOwned; use std::slice::bytes::copy_memory; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use util::task::spawn_named; use util::vec::byte_swap; diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index 00cde267e83..1e1e54794e8 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -10,10 +10,10 @@ #![feature(plugin)] #![plugin(serde_macros, plugins)] -extern crate core; extern crate azure; -extern crate euclid; +extern crate core; extern crate cssparser; +extern crate euclid; extern crate gfx_traits; extern crate ipc_channel; extern crate layers; @@ -21,11 +21,11 @@ extern crate offscreen_gl_context; extern crate serde; extern crate util; -use azure::azure::{AzFloat, AzColor}; -use azure::azure_hl::{DrawTarget, Pattern, ColorPattern}; -use azure::azure_hl::{GradientStop, LinearGradientPattern, RadialGradientPattern, ExtendMode}; -use azure::azure_hl::{JoinStyle, CapStyle, CompositionOp}; -use azure::azure_hl::{SurfacePattern, SurfaceFormat}; +use azure::azure::{AzColor, AzFloat}; +use azure::azure_hl::{CapStyle, CompositionOp, JoinStyle}; +use azure::azure_hl::{ColorPattern, DrawTarget, Pattern}; +use azure::azure_hl::{ExtendMode, GradientStop, LinearGradientPattern, RadialGradientPattern}; +use azure::azure_hl::{SurfaceFormat, SurfacePattern}; use core::nonzero::NonZero; use cssparser::RGBA; use euclid::matrix2d::Matrix2D; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index d4d26777266..1d9392e873c 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -10,7 +10,7 @@ use euclid::point::TypedPoint2D; use euclid::rect::TypedRect; use euclid::scale_factor::ScaleFactor; use euclid::size::TypedSize2D; -use euclid::{Size2D, Point2D, Rect, Matrix4}; +use euclid::{Matrix4, Point2D, Rect, Size2D}; use gfx::paint_task::{ChromeToPaintMsg, PaintRequest}; use gfx_traits::color; use gleam::gl; @@ -33,7 +33,7 @@ use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{PipelineId, WindowSizeData}; use pipeline::CompositionPipeline; use png; -use profile_traits::mem::{self, Reporter, ReporterRequest, ReportKind}; +use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::{ConstellationControlMsg, LayoutControlMsg}; use scrolling::ScrollingTimerProxy; diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index b32f403c971..7026a0a7035 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -4,29 +4,28 @@ //! Communication with the compositor task. -pub use windowing; -pub use constellation::SendableFrameTree; - use compositor; -use euclid::{Size2D, Point2D, Rect}; +use euclid::{Point2D, Rect, Size2D}; use headless; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use layers::layers::{BufferRequest, LayerBufferSet}; use layers::platform::surface::{NativeDisplay, NativeSurface}; -use msg::compositor_msg::{Epoch, LayerId, LayerProperties, FrameTreeId}; +use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerProperties}; use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg}; use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId}; -use msg::constellation_msg::{Key, KeyState, KeyModifiers}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use png; use profile_traits::mem; use profile_traits::time; -use std::fmt::{Error, Formatter, Debug}; +use std::fmt::{Debug, Error, Formatter}; use std::rc::Rc; -use std::sync::mpsc::{channel, Sender, Receiver}; +use std::sync::mpsc::{Receiver, Sender, channel}; use style_traits::viewport::ViewportConstraints; use url::Url; use util::cursor::Cursor; use windowing::{WindowEvent, WindowMethods}; +pub use constellation::SendableFrameTree; +pub use windowing; /// Sends messages to the compositor. This is a trait supplied by the port because the method used /// to communicate with the compositor may have to kick OS event loops awake, communicate cross- diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 07dd9052b68..a9797225454 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -29,7 +29,7 @@ use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::{FrameId, PipelineExitType, PipelineId}; use msg::constellation_msg::{IFrameSandboxState, MozBrowserEvent, NavigationDirection}; -use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{SubpageId, WindowSizeData}; use msg::constellation_msg::{self, ConstellationChan, Failure}; use msg::webdriver_msg; @@ -37,7 +37,7 @@ use net_traits::image_cache_task::ImageCacheTask; use net_traits::storage_task::{StorageTask, StorageTaskMsg}; use net_traits::{self, ResourceTask}; use offscreen_gl_context::GLContextAttributes; -use pipeline::{Pipeline, CompositionPipeline, InitialPipelineState}; +use pipeline::{CompositionPipeline, InitialPipelineState, Pipeline}; use profile_traits::mem; use profile_traits::time; use script_traits::{CompositorEvent, ConstellationControlMsg, LayoutControlMsg}; diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs index 17bc07698da..050cd32d9e8 100644 --- a/components/compositing/headless.rs +++ b/components/compositing/headless.rs @@ -5,7 +5,7 @@ use compositor_task::{CompositorEventListener, CompositorReceiver}; use compositor_task::{InitialCompositorState, Msg}; use euclid::scale_factor::ScaleFactor; -use euclid::{Size2D, Point2D}; +use euclid::{Point2D, Size2D}; use msg::constellation_msg::AnimationState; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, WindowSizeData}; diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 5d00e8fc3bc..d92cb219286 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -13,50 +13,47 @@ #[macro_use] extern crate log; - +#[macro_use] +extern crate profile_traits; +#[macro_use] +extern crate util; extern crate azure; extern crate canvas; extern crate canvas_traits; +extern crate clipboard; + +#[cfg(target_os = "macos")] +extern crate core_graphics; +#[cfg(target_os = "macos")] +extern crate core_text; + extern crate devtools_traits; extern crate euclid; extern crate gfx; +extern crate gfx_traits; +extern crate gleam; extern crate ipc_channel; extern crate layers; extern crate layout_traits; +extern crate msg; +extern crate net_traits; +extern crate num; extern crate offscreen_gl_context; extern crate png; extern crate script_traits; -extern crate msg; -extern crate num; -#[macro_use] -extern crate profile_traits; -extern crate net_traits; -extern crate gfx_traits; extern crate style_traits; -#[macro_use] -extern crate util; -extern crate gleam; -extern crate clipboard; - extern crate time; extern crate url; -#[cfg(target_os = "macos")] -extern crate core_graphics; -#[cfg(target_os = "macos")] -extern crate core_text; - pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask}; pub use constellation::Constellation; -pub mod compositor_task; - mod compositor; mod compositor_layer; mod headless; mod scrolling; mod surface_map; - -pub mod pipeline; +pub mod compositor_task; pub mod constellation; +pub mod pipeline; pub mod windowing; diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index 557c8725138..8e07e220da8 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -12,9 +12,9 @@ use gfx::paint_task::{ChromeToPaintMsg, LayoutToPaintMsg, PaintTask}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use layers::geometry::DevicePixel; -use layout_traits::{LayoutTaskFactory, LayoutControlChan}; +use layout_traits::{LayoutControlChan, LayoutTaskFactory}; use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId}; -use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType, MozBrowserEvent}; +use msg::constellation_msg::{LoadData, MozBrowserEvent, PipelineExitType, WindowSizeData}; use net_traits::ResourceTask; use net_traits::image_cache_task::ImageCacheTask; use net_traits::storage_task::StorageTask; @@ -389,4 +389,3 @@ impl PipelineContent { } } - diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index a5afcb999ca..ae986327c7c 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -8,13 +8,13 @@ use compositor_task::{CompositorProxy, CompositorReceiver}; use euclid::point::TypedPoint2D; use euclid::scale_factor::ScaleFactor; use euclid::size::TypedSize2D; -use euclid::{Size2D, Point2D}; +use euclid::{Point2D, Size2D}; use layers::geometry::DevicePixel; use layers::platform::surface::NativeDisplay; -use msg::constellation_msg::{Key, KeyState, KeyModifiers}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use net_traits::net_error_list::NetError; use script_traits::MouseButton; -use std::fmt::{Error, Formatter, Debug}; +use std::fmt::{Debug, Error, Formatter}; use std::rc::Rc; use url::Url; use util::cursor::Cursor; diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index ae054ebf52c..0b0c068d81f 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -7,12 +7,12 @@ //! Mediates interaction between the remote web console and equivalent functionality (object //! inspection, JS evaluation, autocompletion) in Servo. -use actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use actors::object::ObjectActor; use devtools_traits::CachedConsoleMessage; -use devtools_traits::EvaluateJSReply::{NullValue, VoidValue, NumberValue}; -use devtools_traits::EvaluateJSReply::{StringValue, BooleanValue, ActorValue}; -use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg, PAGE_ERROR, CONSOLE_API}; +use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue}; +use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue}; +use devtools_traits::{CONSOLE_API, CachedConsoleMessageTypes, DevtoolScriptControlMsg, PAGE_ERROR}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; use protocol::JsonPacketStream; diff --git a/components/devtools/actors/framerate.rs b/components/devtools/actors/framerate.rs index 325572d1d91..361220691a2 100644 --- a/components/devtools/actors/framerate.rs +++ b/components/devtools/actors/framerate.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use actors::timeline::HighResolutionStamp; use devtools_traits::DevtoolScriptControlMsg; use ipc_channel::ipc::IpcSender; diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index b319e4ac703..71f56522bcc 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -5,10 +5,10 @@ //! Liberally derived from the [Firefox JS implementation] //! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). -use actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; +use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, GetRootNode}; use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute}; -use devtools_traits::DevtoolScriptControlMsg::{GetRootNode, GetDocumentElement, GetChildren}; -use devtools_traits::{DevtoolScriptControlMsg, NodeInfo, ComputedNodeLayout}; +use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; use protocol::JsonPacketStream; diff --git a/components/devtools/actors/memory.rs b/components/devtools/actors/memory.rs index daf5b4908f1..647b60f1130 100644 --- a/components/devtools/actors/memory.rs +++ b/components/devtools/actors/memory.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use rustc_serialize::json; use std::net::TcpStream; diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs index 559f716abb3..cd0ccc7cbf5 100644 --- a/components/devtools/actors/network_event.rs +++ b/components/devtools/actors/network_event.rs @@ -8,7 +8,7 @@ extern crate hyper; -use actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use hyper::header::Headers; use hyper::http::RawStatus; use hyper::method::Method; diff --git a/components/devtools/actors/object.rs b/components/devtools/actors/object.rs index d77fbd396b3..85b1cb58b4a 100644 --- a/components/devtools/actors/object.rs +++ b/components/devtools/actors/object.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use rustc_serialize::json; use std::net::TcpStream; diff --git a/components/devtools/actors/performance.rs b/components/devtools/actors/performance.rs index e2c2d26ed78..c994a88c113 100644 --- a/components/devtools/actors/performance.rs +++ b/components/devtools/actors/performance.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use protocol::JsonPacketStream; use rustc_serialize::json; use std::net::TcpStream; diff --git a/components/devtools/actors/profiler.rs b/components/devtools/actors/profiler.rs index 938b98b28be..c2c4c9b07df 100644 --- a/components/devtools/actors/profiler.rs +++ b/components/devtools/actors/profiler.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use rustc_serialize::json; use std::net::TcpStream; diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs index b5334daa313..5b83a56476a 100644 --- a/components/devtools/actors/root.rs +++ b/components/devtools/actors/root.rs @@ -7,7 +7,7 @@ /// Connection point for all new remote devtools interactions, providing lists of know actors /// that perform more specific actions (tabs, addons, browser chrome, etc.) -use actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use actors::tab::{TabActor, TabActorMsg}; use protocol::JsonPacketStream; use rustc_serialize::json; diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index 3567127c05d..90a03688f12 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -7,7 +7,7 @@ //! Connection point for remote devtools that wish to investigate a particular tab's contents. //! Supports dynamic attaching and detaching which control notifications of navigation, etc. -use actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use actors::console::ConsoleActor; use devtools_traits::DevtoolScriptControlMsg::WantsLiveNotifications; use protocol::JsonPacketStream; diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 17bf03807f1..d55f380c68a 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -2,16 +2,16 @@ * 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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use actors::framerate::FramerateActor; use actors::memory::{MemoryActor, TimelineMemoryReply}; use devtools_traits::DevtoolScriptControlMsg; -use devtools_traits::DevtoolScriptControlMsg::{SetTimelineMarkers, DropTimelineMarkers}; +use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers}; use devtools_traits::{PreciseTime, TimelineMarker, TimelineMarkerType}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::PipelineId; use protocol::JsonPacketStream; -use rustc_serialize::{json, Encoder, Encodable}; +use rustc_serialize::{Encodable, Encoder, json}; use std::cell::RefCell; use std::net::TcpStream; use std::sync::mpsc::channel; diff --git a/components/devtools/actors/worker.rs b/components/devtools/actors/worker.rs index 1b94e987b1a..2be2719eefc 100644 --- a/components/devtools/actors/worker.rs +++ b/components/devtools/actors/worker.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 actor::{Actor, ActorRegistry, ActorMessageStatus}; +use actor::{Actor, ActorMessageStatus, ActorRegistry}; use msg::constellation_msg::WorkerId; use rustc_serialize::json; use std::net::TcpStream; diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index d33a82638cb..3b89e5193f3 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -21,22 +21,21 @@ #[macro_use] extern crate log; - extern crate devtools_traits; -extern crate rustc_serialize; +extern crate hyper; extern crate ipc_channel; -extern crate serde; extern crate msg; +extern crate rustc_serialize; +extern crate serde; extern crate time; -extern crate util; -extern crate hyper; extern crate url; +extern crate util; use actor::{Actor, ActorRegistry}; use actors::console::ConsoleActor; use actors::framerate::FramerateActor; use actors::inspector::InspectorActor; -use actors::network_event::{NetworkEventActor, EventActor, ResponseStartMsg}; +use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg}; use actors::performance::PerformanceActor; use actors::profiler::ProfilerActor; use actors::root::RootActor; @@ -44,7 +43,7 @@ use actors::tab::TabActor; use actors::timeline::TimelineActor; use actors::worker::WorkerActor; use devtools_traits::{ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolsControlMsg}; -use devtools_traits::{DevtoolsPageInfo, DevtoolScriptControlMsg, LogLevel, NetworkEvent}; +use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo, LogLevel, NetworkEvent}; use devtools_traits::{ScriptToDevtoolsControlMsg}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{PipelineId, WorkerId}; @@ -54,8 +53,8 @@ use std::cell::RefCell; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::error::Error; -use std::net::{TcpListener, TcpStream, Shutdown}; -use std::sync::mpsc::{channel, Receiver, Sender, RecvError}; +use std::net::{Shutdown, TcpListener, TcpStream}; +use std::sync::mpsc::{Receiver, RecvError, Sender, channel}; use std::sync::{Arc, Mutex}; use time::precise_time_ns; use util::task::spawn_named; diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs index 5a5d0e19ff0..8a338f98091 100644 --- a/components/devtools/protocol.rs +++ b/components/devtools/protocol.rs @@ -8,7 +8,7 @@ use rustc_serialize::json::Json; use rustc_serialize::json::ParserError::{IoError, SyntaxError}; -use rustc_serialize::{json, Encodable}; +use rustc_serialize::{Encodable, json}; use std::error::Error; use std::io::{Read, Write}; use std::net::TcpStream; diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs index 61ab9148144..b5f956efef5 100644 --- a/components/devtools_traits/lib.rs +++ b/components/devtools_traits/lib.rs @@ -17,15 +17,14 @@ #[macro_use] extern crate bitflags; - +extern crate hyper; extern crate ipc_channel; extern crate msg; extern crate rustc_serialize; extern crate serde; +extern crate time; extern crate url; -extern crate hyper; extern crate util; -extern crate time; use hyper::header::Headers; use hyper::http::RawStatus; diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index dc62e8a1fa2..f4267c6fbc2 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -14,14 +14,12 @@ //! They are therefore not exactly analogous to constructs like Skia pictures, which consist of //! low-level drawing primitives. -#![deny(unsafe_code)] - use azure::azure::AzFloat; use azure::azure_hl::Color; use display_list::optimizer::DisplayListOptimizer; use euclid::approxeq::ApproxEq; use euclid::num::Zero; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D, Matrix4}; +use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D}; use gfx_traits::color; use libc::uintptr_t; use msg::compositor_msg::{LayerId, LayerKind, ScrollPolicy}; diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 8716533d77c..e275970d700 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -16,7 +16,7 @@ use std::sync::Arc; use style::computed_values::{font_stretch, font_variant, font_weight}; use style::properties::style_structs::Font as FontStyle; use text::Shaper; -use text::glyph::{GlyphStore, GlyphId}; +use text::glyph::{GlyphId, GlyphStore}; use text::shaping::ShaperMethods; use util::cache::HashCache; use util::geometry::Au; diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs index 656171c41f3..08e0b636c36 100644 --- a/components/gfx/font_cache_task.rs +++ b/components/gfx/font_cache_task.rs @@ -13,7 +13,7 @@ use platform::font_template::FontTemplateData; use std::borrow::ToOwned; use std::collections::HashMap; use std::sync::Arc; -use std::sync::mpsc::{Sender, Receiver, channel}; +use std::sync::mpsc::{Receiver, Sender, channel}; use string_cache::Atom; use style::font_face::Source; use util::str::LowercaseString; diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index e6672cba942..52f1143cf2d 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -2,16 +2,15 @@ * 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/. */ -#![feature(alloc)] -#![feature(box_syntax)] - // For simd (currently x86_64/aarch64) #![cfg_attr(any(target_arch = "x86_64", target_arch = "aarch64"), feature(convert))] +#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))] +#![feature(alloc)] +#![feature(box_syntax)] #![feature(custom_attribute)] #![feature(custom_derive)] #![feature(hashmap_hasher)] -#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))] #![feature(mpsc_select)] #![feature(plugin)] #![feature(str_char)] @@ -22,66 +21,71 @@ #![plugin(serde_macros)] #[macro_use] +extern crate bitflags; +#[macro_use] +extern crate lazy_static; +#[macro_use] extern crate log; -extern crate serde; - +#[macro_use] +extern crate profile_traits; +#[macro_use] +extern crate util; extern crate alloc; extern crate azure; -#[macro_use] extern crate bitflags; -extern crate fnv; +extern crate canvas_traits; + +// Mac OS-specific library dependencies +#[cfg(target_os = "macos")] extern crate core_foundation; +#[cfg(target_os = "macos")] extern crate core_graphics; +#[cfg(target_os = "macos")] extern crate core_text; + extern crate euclid; +extern crate fnv; + +// Linux and Android-specific library dependencies +#[cfg(any(target_os = "linux", target_os = "android"))] +extern crate fontconfig; +#[cfg(any(target_os = "linux", target_os = "android"))] +extern crate freetype; + +extern crate gfx_traits; + +// Eventually we would like the shaper to be pluggable, as many operating systems have their own +// shapers. For now, however, this is a hard dependency. +extern crate harfbuzz; + extern crate ipc_channel; -#[macro_use] -extern crate lazy_static; extern crate layers; extern crate libc; -#[macro_use] -extern crate profile_traits; -extern crate script_traits; -extern crate rustc_serialize; -extern crate net_traits; -#[macro_use] -extern crate util; extern crate msg; +extern crate net_traits; extern crate rand; +extern crate rustc_serialize; +extern crate script_traits; +extern crate serde; #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] extern crate simd; +extern crate skia; extern crate smallvec; extern crate string_cache; extern crate style; -extern crate skia; extern crate time; extern crate url; -extern crate gfx_traits; -extern crate canvas_traits; - -// Eventually we would like the shaper to be pluggable, as many operating systems have their own -// shapers. For now, however, this is a hard dependency. -extern crate harfbuzz; - -// Linux and Android-specific library dependencies -#[cfg(any(target_os = "linux", target_os = "android"))] -extern crate fontconfig; - -#[cfg(any(target_os = "linux", target_os = "android"))] -extern crate freetype; - -// Mac OS-specific library dependencies -#[cfg(target_os = "macos")] extern crate core_foundation; -#[cfg(target_os = "macos")] extern crate core_graphics; -#[cfg(target_os = "macos")] extern crate core_text; pub use paint_context::PaintContext; +// Misc. +mod filters; + // Private painting modules mod paint_context; +#[deny(unsafe_code)] #[path = "display_list/mod.rs"] pub mod display_list; -pub mod paint_task; // Fonts pub mod font; @@ -89,8 +93,7 @@ pub mod font_cache_task; pub mod font_context; pub mod font_template; -// Misc. -mod filters; +pub mod paint_task; // Platform-specific implementations. #[path = "platform/mod.rs"] diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index ff60e90a1af..32a0aa42a0d 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -6,14 +6,14 @@ use azure::azure::AzIntSize; use azure::azure_hl::{AntialiasMode, Color, ColorPattern, CompositionOp}; +use azure::azure_hl::{CapStyle, JoinStyle}; use azure::azure_hl::{DrawOptions, DrawSurfaceOptions, DrawTarget, ExtendMode, FilterType}; +use azure::azure_hl::{Filter, FilterNode, GaussianBlurInput, GradientStop, LinearGradientPattern}; use azure::azure_hl::{GaussianBlurAttribute, StrokeOptions, SurfaceFormat}; -use azure::azure_hl::{GaussianBlurInput, GradientStop, Filter, FilterNode, LinearGradientPattern}; -use azure::azure_hl::{JoinStyle, CapStyle}; -use azure::azure_hl::{Pattern, PatternRef, Path, PathBuilder, SurfacePattern}; +use azure::azure_hl::{Path, PathBuilder, Pattern, PatternRef, SurfacePattern}; use azure::scaled_font::ScaledFont; +use azure::{AzDrawTargetFillGlyphs, struct__AzGlyphBuffer, struct__AzPoint}; use azure::{AzFloat, struct__AzDrawOptions, struct__AzGlyph}; -use azure::{struct__AzGlyphBuffer, struct__AzPoint, AzDrawTargetFillGlyphs}; use display_list::TextOrientation::{SidewaysLeft, SidewaysRight, Upright}; use display_list::{BLUR_INFLATION_FACTOR, BorderRadii, BoxShadowClipMode, ClippingRegion}; use display_list::{TextDisplayItem}; @@ -29,10 +29,8 @@ use libc::types::common::c99::uint32_t; use msg::compositor_msg::LayerKind; use net_traits::image::base::{Image, PixelFormat}; use std::default::Default; -use std::f32; -use std::mem; -use std::ptr; use std::sync::Arc; +use std::{f32, mem, ptr}; use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode}; use text::TextRun; use text::glyph::CharIndex; diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 563bbe04a0e..b729d311e4e 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -5,7 +5,7 @@ //! The task that handles all painting. use azure::AzFloat; -use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType}; +use azure::azure_hl::{BackendType, Color, DrawTarget, SurfaceFormat}; use canvas_traits::CanvasMsg; use display_list::{self, StackingContext}; use euclid::Matrix4; diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index e08a93afce5..3bce3f06c50 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -7,24 +7,23 @@ extern crate freetype; use font::{FontHandleMethods, FontMetrics, FontTableMethods}; use font::{FontTableTag, FractionalPixel}; use freetype::freetype::{FTErrorMethods, FT_F26Dot6, FT_Face, FT_FaceRec}; +use freetype::freetype::{FT_Done_Face, FT_New_Memory_Face}; use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name}; use freetype::freetype::{FT_Get_Kerning, FT_Get_Sfnt_Table, FT_Load_Sfnt_Table}; use freetype::freetype::{FT_GlyphSlot, FT_Library, FT_Long, FT_ULong}; -use freetype::freetype::{FT_KERNING_DEFAULT, FT_STYLE_FLAG_ITALIC, FT_STYLE_FLAG_BOLD}; +use freetype::freetype::{FT_KERNING_DEFAULT, FT_STYLE_FLAG_BOLD, FT_STYLE_FLAG_ITALIC}; use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size}; -use freetype::freetype::{FT_New_Memory_Face, FT_Done_Face}; -use freetype::freetype::{FT_SizeRec, FT_UInt, FT_Size_Metrics, struct_FT_Vector_}; +use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, struct_FT_Vector_}; use freetype::freetype::{ft_sfnt_os2}; use freetype::tt_os2::TT_OS2; use libc::c_char; use platform::font_context::FontContextHandle; use platform::font_template::FontTemplateData; -use std::mem; -use std::ptr; use std::sync::Arc; +use std::{mem, ptr}; use style::computed_values::{font_stretch, font_weight}; use text::glyph::GlyphId; -use text::util::{float_to_fixed, fixed_to_float}; +use text::util::{fixed_to_float, float_to_fixed}; use util::geometry::Au; use util::str::c_str_to_string; diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs index 85e1b936294..bbf5355efd9 100644 --- a/components/gfx/platform/freetype/font_context.rs +++ b/components/gfx/platform/freetype/font_context.rs @@ -10,7 +10,7 @@ use freetype::freetype::FT_Library; use freetype::freetype::FT_Memory; use freetype::freetype::FT_New_Library; use freetype::freetype::struct_FT_MemoryRec_; -use libc::{c_void, c_long}; +use libc::{c_long, c_void}; use std::ptr; use std::rc::Rc; use util::mem::{HeapSizeOf, heap_size_of}; diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index 5e3b76b9271..e41f7c9fe26 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -4,17 +4,17 @@ #![allow(non_snake_case)] -extern crate freetype; extern crate fontconfig; +extern crate freetype; use fontconfig::fontconfig::{FcChar8, FcResultMatch, FcSetSystem}; use fontconfig::fontconfig::{FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute}; use fontconfig::fontconfig::{FcDefaultSubstitute, FcFontMatch, FcNameParse, FcPatternGetString}; +use fontconfig::fontconfig::{FcFontSetDestroy, FcMatchPattern, FcPatternCreate, FcPatternDestroy}; +use fontconfig::fontconfig::{FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString}; use fontconfig::fontconfig::{FcObjectSetAdd, FcPatternGetInteger}; -use fontconfig::fontconfig::{FcPatternAddString, FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy}; -use fontconfig::fontconfig::{FcPatternDestroy, FcFontSetDestroy, FcMatchPattern, FcPatternCreate}; use libc; -use libc::{c_int, c_char}; +use libc::{c_char, c_int}; use std::borrow::ToOwned; use std::ffi::CString; use std::ptr; diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index f293ff4f3d3..71b42fe2c9e 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -6,12 +6,10 @@ use euclid::point::Point2D; #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] use simd::u32x4; use std::cmp::{Ordering, PartialOrd}; -use std::fmt; -use std::mem; -use std::u16; use std::vec::Vec; +use std::{fmt, mem, u16}; use util::geometry::Au; -use util::range::{self, Range, RangeIndex, EachIndex}; +use util::range::{self, EachIndex, Range, RangeIndex}; use util::vec::*; /// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing glyph data compactly. diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 4334530664c..488d126afd7 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -7,16 +7,17 @@ extern crate harfbuzz; use euclid::Point2D; use font::{DISABLE_KERNING_SHAPING_FLAG, Font, FontHandleMethods, FontTableMethods, FontTableTag}; use font::{IGNORE_LIGATURES_SHAPING_FLAG, RTL_FLAG, ShapingOptions}; -use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, HB_DIRECTION_RTL}; +use harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; use harfbuzz::{RUST_hb_blob_create, RUST_hb_face_create_for_tables}; use harfbuzz::{RUST_hb_buffer_add_utf8}; +use harfbuzz::{RUST_hb_buffer_create, RUST_hb_font_destroy}; use harfbuzz::{RUST_hb_buffer_destroy}; +use harfbuzz::{RUST_hb_buffer_get_glyph_infos, RUST_hb_shape}; use harfbuzz::{RUST_hb_buffer_get_glyph_positions}; use harfbuzz::{RUST_hb_buffer_get_length}; use harfbuzz::{RUST_hb_buffer_set_direction}; use harfbuzz::{RUST_hb_face_destroy}; use harfbuzz::{RUST_hb_font_create}; -use harfbuzz::{RUST_hb_font_destroy, RUST_hb_buffer_create}; use harfbuzz::{RUST_hb_font_funcs_create}; use harfbuzz::{RUST_hb_font_funcs_set_glyph_func}; use harfbuzz::{RUST_hb_font_funcs_set_glyph_h_advance_func}; @@ -24,23 +25,20 @@ use harfbuzz::{RUST_hb_font_funcs_set_glyph_h_kerning_func}; use harfbuzz::{RUST_hb_font_set_funcs}; use harfbuzz::{RUST_hb_font_set_ppem}; use harfbuzz::{RUST_hb_font_set_scale}; -use harfbuzz::{RUST_hb_shape, RUST_hb_buffer_get_glyph_infos}; use harfbuzz::{hb_blob_t}; use harfbuzz::{hb_bool_t}; +use harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t}; use harfbuzz::{hb_face_t, hb_font_t}; use harfbuzz::{hb_feature_t}; -use harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t}; use harfbuzz::{hb_glyph_info_t}; use harfbuzz::{hb_glyph_position_t}; use harfbuzz::{hb_position_t, hb_tag_t}; -use libc::{c_uint, c_int, c_void, c_char}; +use libc::{c_char, c_int, c_uint, c_void}; use platform::font::FontTable; -use std::char; -use std::cmp; -use std::ptr; -use text::glyph::{CharIndex, GlyphStore, GlyphId, GlyphData}; +use std::{char, cmp, ptr}; +use text::glyph::{CharIndex, GlyphData, GlyphId, GlyphStore}; use text::shaping::ShaperMethods; -use text::util::{float_to_fixed, fixed_to_float, is_bidi_control}; +use text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; use util::geometry::Au; use util::range::Range; diff --git a/components/layout/block.rs b/components/layout/block.rs index 19bd4fcac3d..1083c174979 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -40,7 +40,7 @@ use flow::{IS_ABSOLUTELY_POSITIONED}; use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, MutableFlowUtils, OpaqueFlow}; use flow::{LAYERS_NEEDED_FOR_DESCENDANTS, NEEDS_LAYER}; use flow::{PostorderFlowTraversal, PreorderFlowTraversal, mut_base}; -use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, ForceNonfloatedFlag, FlowClass, Flow}; +use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag}; use flow_ref; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER}; use fragment::{SpecificFragmentInfo}; @@ -48,15 +48,15 @@ use gfx::display_list::{ClippingRegion, DisplayList}; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; use layout_debug; use layout_task::DISPLAY_PORT_SIZE_FACTOR; +use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none}; use model::{IntrinsicISizes, MarginCollapseInfo}; -use model::{MaybeAuto, CollapsibleMargins, specified, specified_or_none}; use msg::compositor_msg::{LayerId, LayerType}; -use rustc_serialize::{Encoder, Encodable}; +use rustc_serialize::{Encodable, Encoder}; use std::cmp::{max, min}; use std::fmt; use std::sync::Arc; use style::computed_values::{border_collapse, box_sizing, display, float, overflow_x, overflow_y}; -use style::computed_values::{transform, transform_style, position, text_align}; +use style::computed_values::{position, text_align, transform, transform_style}; use style::properties::ComputedValues; use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone}; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; @@ -3029,4 +3029,3 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced { MaybeAuto::Specified(fragment.content_inline_size()) } } - diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 28a7ec7c2e1..b7eb8a4ef84 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -19,7 +19,7 @@ use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataWrapper}; use flex::FlexFlow; use floats::FloatKind; use flow::{MutableFlowUtils, MutableOwnedFlowUtils}; -use flow::{self, AbsoluteDescendants, Flow, ImmutableFlowUtils, IS_ABSOLUTELY_POSITIONED}; +use flow::{self, AbsoluteDescendants, Flow, IS_ABSOLUTELY_POSITIONED, ImmutableFlowUtils}; use flow_ref::{self, FlowRef}; use fragment::{CanvasFragmentInfo, ImageFragmentInfo, InlineAbsoluteFragmentInfo}; use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo}; diff --git a/components/layout/context.rs b/components/layout/context.rs index 5497fab803c..78eb676e02f 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -25,7 +25,7 @@ use std::collections::HashMap; use std::collections::hash_state::DefaultState; use std::rc::Rc; use std::sync::Arc; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use style::selector_matching::Stylist; use url::Url; use util::geometry::Au; @@ -216,4 +216,3 @@ impl<'a> LayoutContext<'a> { } } } - diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 388a64ea645..a1685b0747f 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -26,8 +26,8 @@ use std::sync::Arc; use std::sync::mpsc::Sender; use string_cache::{Atom, Namespace}; use style::node::TElementAttributes; -use style::properties::{ComputedValues, cascade, PropertyDeclaration}; -use style::selector_matching::{Stylist, DeclarationBlock}; +use style::properties::{ComputedValues, PropertyDeclaration, cascade}; +use style::selector_matching::{DeclarationBlock, Stylist}; use util::arc_ptr_eq; use util::cache::{LRUCache, SimpleHashCache}; use util::opts; diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 4b5f0e8052b..4bc788c0ce7 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -15,7 +15,7 @@ use block::BlockFlow; use canvas_traits::{CanvasMsg, FromLayoutMsg}; use context::LayoutContext; use euclid::Matrix4; -use euclid::{Point2D, Point3D, Rect, Size2D, SideOffsets2D}; +use euclid::{Point2D, Point3D, Rect, SideOffsets2D, Size2D}; use flex::FlexFlow; use flow::{self, BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED}; use flow_ref; @@ -23,7 +23,7 @@ use fragment::{CoordinateSystem, Fragment, HAS_LAYER, IframeFragmentInfo, ImageF use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo}; use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem}; use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion}; -use gfx::display_list::{DisplayItem, DisplayList, DisplayItemMetadata}; +use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList}; use gfx::display_list::{GradientDisplayItem}; use gfx::display_list::{GradientStop, ImageDisplayItem, LineDisplayItem}; use gfx::display_list::{OpaqueNode, SolidColorDisplayItem}; @@ -35,21 +35,20 @@ use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT}; use ipc_channel::ipc::{self, IpcSharedMemory}; use list_item::ListItemFlow; use model::{self, MaybeAuto, ToGfxMatrix}; -use msg::compositor_msg::{ScrollPolicy, LayerId}; +use msg::compositor_msg::{LayerId, ScrollPolicy}; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as ConstellationMsg; use net_traits::image::base::{Image, PixelFormat}; use net_traits::image_cache_task::UsePlaceholder; -use std::cmp; use std::default::Default; -use std::f32; use std::sync::Arc; use std::sync::mpsc::channel; +use std::{cmp, f32}; use style::computed_values::filter::Filter; use style::computed_values::{background_attachment, background_clip, background_origin}; use style::computed_values::{background_repeat, background_size}; use style::computed_values::{border_style, image_rendering, overflow_x, position}; -use style::computed_values::{visibility, transform, transform_style}; +use style::computed_values::{transform, transform_style, visibility}; use style::properties::style_structs::Border; use style::properties::{self, ComputedValues}; use style::values::RGBA; @@ -2102,4 +2101,3 @@ pub enum StackingContextCreationMode { OuterScrollWrapper, InnerScrollWrapper, } - diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 3c14fab304c..8a7d601646b 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -41,14 +41,12 @@ use msg::compositor_msg::{LayerId, LayerType}; use msg::constellation_msg::ConstellationChan; use multicol::MulticolFlow; use parallel::FlowParallelInfo; -use rustc_serialize::{Encoder, Encodable}; -use std::fmt; +use rustc_serialize::{Encodable, Encoder}; use std::iter::Zip; -use std::mem; -use std::raw; use std::slice::IterMut; use std::sync::Arc; use std::sync::atomic::Ordering; +use std::{fmt, mem, raw}; use style::computed_values::{clear, display, empty_cells, float, position, text_align}; use style::properties::{self, ComputedValues}; use style::values::computed::LengthOrPercentageOrAuto; diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index 8f16fc0fa3d..7b66de47419 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -4,7 +4,7 @@ use flow::Flow; use flow_ref::{self, FlowRef}; -use std::collections::{linked_list, LinkedList}; +use std::collections::{LinkedList, linked_list}; // This needs to be reworked now that we have dynamically-sized types in Rust. // Until then, it's just a wrapper around LinkedList. diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index f4a95e64108..5981f13b7ab 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -10,8 +10,7 @@ use canvas_traits::CanvasMsg; use context::LayoutContext; use euclid::{Point2D, Rect, Size2D}; use floats::ClearType; -use flow; -use flow::Flow; +use flow::{self, Flow}; use flow_ref::{self, FlowRef}; use gfx; use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode}; @@ -45,7 +44,7 @@ use text::TextRunScanner; use url::Url; use util; use util::geometry::{Au, ZERO_POINT}; -use util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode}; +use util::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; use util::range::*; use util::str::{is_whitespace, slice_chars}; use wrapper::{PseudoElementType, ThreadSafeLayoutNode}; @@ -2550,4 +2549,3 @@ bitflags! { const HAS_LAYER = 0x01, } } - diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 5a907bb6ac7..2d43e596bce 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -15,7 +15,7 @@ use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTe use gfx::display_list::OpaqueNode; use incremental::{self, RESOLVE_GENERATED_CONTENT}; use smallvec::SmallVec; -use std::collections::{LinkedList, HashMap}; +use std::collections::{HashMap, LinkedList}; use std::sync::Arc; use style::computed_values::content::ContentItem; use style::computed_values::{display, list_style_type}; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index b91cfd790bc..cdcc46e2ad9 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -9,8 +9,8 @@ use context::LayoutContext; use display_list_builder::{FragmentDisplayListBuilding, InlineFlowDisplayListBuilding}; use euclid::{Point2D, Rect, Size2D}; use floats::{FloatKind, Floats, PlacementInfo}; -use flow::{MutableFlowUtils, EarlyAbsolutePositionInfo, OpaqueFlow}; -use flow::{self, BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, IS_ABSOLUTELY_POSITIONED}; +use flow::{EarlyAbsolutePositionInfo, MutableFlowUtils, OpaqueFlow}; +use flow::{self, BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, IS_ABSOLUTELY_POSITIONED}; use flow_ref; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use gfx::display_list::OpaqueNode; @@ -21,10 +21,8 @@ use layout_debug; use model::IntrinsicISizesContribution; use std::cmp::max; use std::collections::VecDeque; -use std::fmt; -use std::isize; -use std::mem; use std::sync::Arc; +use std::{fmt, isize, mem}; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{text_overflow, vertical_align, white_space}; use style::properties::ComputedValues; diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 24d20442457..9175b7aec89 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -5,8 +5,6 @@ //! Supports writing a trace file created during each layout scope //! that can be viewed by an external tool to make layout debugging easier. -#![macro_use] - use flow; use flow_ref::FlowRef; use rustc_serialize::json; @@ -14,7 +12,7 @@ use std::borrow::ToOwned; use std::cell::RefCell; use std::fs::File; use std::io::Write; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None)); diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 2bf311647c0..17bd99b0749 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -37,11 +37,11 @@ use ipc_channel::router::ROUTER; use layout_debug; use layout_traits::LayoutTaskFactory; use log; -use msg::compositor_msg::{Epoch, ScrollPolicy, LayerId}; +use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy}; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType, PipelineId}; -use net_traits::image_cache_task::{ImageCacheTask, ImageCacheResult, ImageCacheChan}; -use net_traits::{load_bytes_iter, PendingAsyncLoad}; +use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask}; +use net_traits::{PendingAsyncLoad, load_bytes_iter}; use opaque_node::OpaqueNodeMethods; use parallel::{self, WorkQueueData}; use profile_traits::mem::{self, Report, ReportKind, ReportsChan}; @@ -54,7 +54,7 @@ use script::dom::bindings::js::LayoutJS; use script::dom::node::{LayoutData, Node}; use script::layout_interface::Animation; use script::layout_interface::{LayoutChan, LayoutRPC, OffsetParentResponse}; -use script::layout_interface::{NewLayoutTaskInfo, Msg, Reflow, ReflowGoal, ReflowQueryType}; +use script::layout_interface::{Msg, NewLayoutTaskInfo, Reflow, ReflowGoal, ReflowQueryType}; use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress}; use script_traits::StylesheetLoadResponder; use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; @@ -67,15 +67,15 @@ use std::collections::HashMap; use std::collections::hash_state::DefaultState; use std::mem::transmute; use std::ops::{Deref, DerefMut}; -use std::sync::mpsc::{channel, Sender, Receiver, Select}; +use std::sync::mpsc::{Receiver, Select, Sender, channel}; use std::sync::{Arc, Mutex, MutexGuard}; use string_cache::Atom; use style::computed_values::{self, filter, mix_blend_mode}; -use style::media_queries::{MediaType, MediaQueryList, Device}; +use style::media_queries::{Device, MediaQueryList, MediaType}; use style::properties::longhands::{display, position}; use style::properties::style_structs; use style::selector_matching::Stylist; -use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt}; +use style::stylesheets::{CSSRuleIteratorExt, Origin, Stylesheet}; use url::Url; use util::geometry::{Au, MAX_RECT, ZERO_POINT}; use util::ipc::OptionalIpcSender; diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 3e86d18c960..e1b14673489 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -19,34 +19,30 @@ #![plugin(plugins)] #[macro_use] +extern crate bitflags; +#[macro_use] extern crate log; - #[macro_use] -extern crate bitflags; - +extern crate profile_traits; #[macro_use] #[no_link] extern crate plugins as servo_plugins; -extern crate net_traits; -#[macro_use] -extern crate profile_traits; - #[macro_use] extern crate util; - extern crate azure; extern crate canvas_traits; extern crate clock_ticks; extern crate cssparser; extern crate encoding; -extern crate fnv; extern crate euclid; +extern crate fnv; extern crate gfx; extern crate gfx_traits; extern crate ipc_channel; extern crate layout_traits; extern crate libc; extern crate msg; +extern crate net_traits; extern crate rustc_serialize; extern crate script; extern crate script_traits; @@ -59,7 +55,7 @@ extern crate style; extern crate unicode_bidi; extern crate url; -// Listed first because of macro definitions +#[macro_use] pub mod layout_debug; pub mod animation; diff --git a/components/layout/model.rs b/components/layout/model.rs index 3be66aec4fc..c7c690f84bf 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -13,7 +13,7 @@ use std::fmt; use style::computed_values::transform::ComputedMatrix; use style::properties::ComputedValues; use style::values::computed::{BorderRadiusSize, LengthOrPercentageOrAuto}; -use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage}; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone}; use util::geometry::Au; use util::logical_geometry::LogicalMargin; diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 5198dbdf0fe..6f761152df5 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -10,7 +10,7 @@ use block::BlockFlow; use context::LayoutContext; use euclid::{Point2D, Rect}; use floats::FloatKind; -use flow::{FlowClass, Flow, OpaqueFlow}; +use flow::{Flow, FlowClass, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use std::fmt; use std::sync::Arc; diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 8b63159bec8..5b9a33e3a5f 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -9,21 +9,20 @@ #![allow(unsafe_code)] use context::{LayoutContext, SharedLayoutContext}; -use flow; -use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; +use flow::{self, Flow, MutableFlowUtils, PostorderFlowTraversal, PreorderFlowTraversal}; use flow_ref::{self, FlowRef}; use profile_traits::time::{self, ProfilerMetadata, profile}; use std::mem; use std::sync::atomic::{AtomicIsize, Ordering}; use traversal::PostorderNodeMutTraversal; -use traversal::{BubbleISizes, AssignISizes, AssignBSizesAndStoreOverflow}; -use traversal::{ComputeAbsolutePositions, BuildDisplayList}; -use traversal::{PreorderDomTraversal, PostorderDomTraversal}; -use traversal::{RecalcStyleForNode, ConstructFlows}; +use traversal::{AssignBSizesAndStoreOverflow, AssignISizes, BubbleISizes}; +use traversal::{BuildDisplayList, ComputeAbsolutePositions}; +use traversal::{ConstructFlows, RecalcStyleForNode}; +use traversal::{PostorderDomTraversal, PreorderDomTraversal}; use util::opts; use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy}; use wrapper::UnsafeLayoutNode; -use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode}; +use wrapper::{LayoutNode, layout_node_from_unsafe_layout_node, layout_node_to_unsafe_layout_node}; const CHUNK_SIZE: usize = 64; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 7cb3f28a89d..a7c874971dd 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -13,9 +13,9 @@ use fragment::FragmentBorderBoxIterator; use generated_content::ResolveGeneratedContent; use traversal::PostorderNodeMutTraversal; use traversal::{AssignBSizesAndStoreOverflow, AssignISizes}; -use traversal::{BubbleISizes, RecalcStyleForNode, ConstructFlows}; -use traversal::{ComputeAbsolutePositions, BuildDisplayList}; -use traversal::{PreorderDomTraversal, PostorderDomTraversal}; +use traversal::{BubbleISizes, ConstructFlows, RecalcStyleForNode}; +use traversal::{BuildDisplayList, ComputeAbsolutePositions}; +use traversal::{PostorderDomTraversal, PreorderDomTraversal}; use util::geometry::{Au, ZERO_POINT}; use util::opts; use wrapper::LayoutNode; diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 646a4498568..4e9157bc61e 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -9,7 +9,7 @@ use block::BlockFlow; use context::LayoutContext; use euclid::{Point2D, Rect}; -use flow::{FlowClass, Flow, OpaqueFlow}; +use flow::{Flow, FlowClass, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use std::fmt; use std::sync::Arc; diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index 987ee717417..4cbb41e4c39 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -8,7 +8,7 @@ use context::LayoutContext; use euclid::{Point2D, Rect}; -use flow::{BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, OpaqueFlow}; +use flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use layout_debug; use std::cmp::max; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 4824d89aea6..54b47030eb6 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -11,13 +11,13 @@ use context::LayoutContext; use cssparser::{Color, RGBA}; use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use euclid::{Point2D, Rect}; -use flow::{self, EarlyAbsolutePositionInfo, FlowClass, Flow, ImmutableFlowUtils, OpaqueFlow}; +use flow::{self, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow}; use flow_list::MutFlowListIterator; use fragment::{Fragment, FragmentBorderBoxIterator}; use gfx::display_list::DisplayList; use layout_debug; use model::MaybeAuto; -use rustc_serialize::{Encoder, Encodable}; +use rustc_serialize::{Encodable, Encoder}; use std::cmp::max; use std::fmt; use std::iter::{Enumerate, IntoIterator, Peekable}; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 29497e28ad6..812041cef4a 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -9,10 +9,10 @@ use block::{BlockFlow, ISizeAndMarginsComputer}; use context::LayoutContext; use euclid::{Point2D, Rect}; -use flow::{FlowClass, Flow, OpaqueFlow}; +use flow::{Flow, FlowClass, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use layout_debug; -use rustc_serialize::{Encoder, Encodable}; +use rustc_serialize::{Encodable, Encoder}; use std::fmt; use std::iter::{IntoIterator, Iterator, Peekable}; use std::sync::Arc; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index a3c08a07e1a..81b92d5794f 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -13,12 +13,12 @@ #![deny(unsafe_code)] -use block::{BlockFlow, FloatNonReplaced, AbsoluteNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput}; +use block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput}; use block::{ISizeConstraintSolution, MarginsMayCollapseFlag}; use context::LayoutContext; use euclid::{Point2D, Rect}; use floats::FloatKind; -use flow::{FlowClass, Flow, ImmutableFlowUtils}; +use flow::{Flow, FlowClass, ImmutableFlowUtils}; use flow::{IMPACTED_BY_LEFT_FLOATS, IMPACTED_BY_RIGHT_FLOATS, INLINE_POSITION_IS_STATIC, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use model::MaybeAuto; @@ -860,4 +860,3 @@ impl ISizeAndMarginsComputer for AbsoluteTable { } } - diff --git a/components/layout/text.rs b/components/layout/text.rs index e90a1d639df..a85fac27e0e 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -6,7 +6,7 @@ #![deny(unsafe_code)] -use fragment::{Fragment, SpecificFragmentInfo, ScannedTextFragmentInfo, UnscannedTextFragmentInfo}; +use fragment::{Fragment, ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG}; use gfx::font::{RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::font_context::FontContext; @@ -599,4 +599,3 @@ struct ScannedTextRun { run: Arc<TextRun>, insertion_point: Option<CharIndex>, } - diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 33cd978ae37..43199d7a05d 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -7,7 +7,7 @@ use construct::FlowConstructor; use context::LayoutContext; use css::matching::{ApplicableDeclarations, MatchMethods, StyleSharingResult}; -use flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; +use flow::{MutableFlowUtils, PostorderFlowTraversal, PreorderFlowTraversal}; use flow::{self, Flow}; use incremental::{self, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; use script::layout_interface::ReflowGoal; @@ -16,8 +16,8 @@ use std::cell::RefCell; use std::mem; use util::opts; use util::tid::tid; +use wrapper::{LayoutNode, layout_node_to_unsafe_layout_node}; use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; -use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode}; /// Every time we do another layout, the old bloom filters are invalid. This is /// detected by ticking a generation number every layout. diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index e39724f5000..678ebd63582 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -41,7 +41,7 @@ use msg::constellation_msg::{PipelineId, SubpageId}; use opaque_node::OpaqueNodeMethods; use script::dom::attr::AttrValue; use script::dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast}; -use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLCanvasElementCast}; +use script::dom::bindings::codegen::InheritTypes::{HTMLCanvasElementCast, HTMLIFrameElementCast}; use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementCast, HTMLInputElementCast}; use script::dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementCast, NodeCast, TextCast}; use script::dom::bindings::js::LayoutJS; @@ -53,12 +53,12 @@ use script::dom::htmlelement::HTMLElementTypeId; use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers; use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers}; use script::dom::htmltextareaelement::LayoutHTMLTextAreaElementHelpers; -use script::dom::node::{HAS_CHANGED, IS_DIRTY, HAS_DIRTY_SIBLINGS, HAS_DIRTY_DESCENDANTS}; +use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, HAS_DIRTY_SIBLINGS, IS_DIRTY}; use script::dom::node::{LayoutNodeHelpers, SharedLayoutData}; use script::dom::node::{Node, NodeTypeId}; use script::dom::text::Text; use selectors::matching::DeclarationBlock; -use selectors::parser::{NamespaceConstraint, AttrSelector}; +use selectors::parser::{AttrSelector, NamespaceConstraint}; use smallvec::VecLike; use std::borrow::ToOwned; use std::cell::{Ref, RefMut}; @@ -1132,4 +1132,3 @@ impl TextContent { } } } - diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index e888072eda9..025713894e2 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -26,8 +26,7 @@ use gfx::paint_task::LayoutToPaintMsg; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use net_traits::image_cache_task::ImageCacheTask; -use profile_traits::mem; -use profile_traits::time; +use profile_traits::{mem, time}; use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel}; use std::sync::mpsc::Sender; use url::Url; diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 3ac57165c34..ed66bbebff1 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -3,15 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use azure::azure_hl::Color; -use constellation_msg::PipelineId; -use constellation_msg::{Key, KeyState, KeyModifiers}; -use euclid::Matrix4; -use euclid::{Size2D, Point2D, Rect}; +use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId}; +use euclid::{Matrix4, Point2D, Rect, Size2D}; use ipc_channel::ipc::IpcSender; use layers::layers::{BufferRequest, LayerBufferSet}; use layers::platform::surface::NativeDisplay; -use std::fmt; -use std::fmt::{Formatter, Debug}; +use std::fmt::{self, Debug, Formatter}; /// A newtype struct for denoting the age of messages; prevents race conditions. #[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)] diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index dc42e2deca5..c43a5566a1c 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -17,13 +17,13 @@ use layers::geometry::DevicePixel; use offscreen_gl_context::GLContextAttributes; use png::Image; use std::collections::HashMap; -use std::sync::mpsc::{channel, Sender, Receiver}; +use std::sync::mpsc::{Receiver, Sender, channel}; use style_traits::viewport::ViewportConstraints; use url::Url; use util::cursor::Cursor; use util::geometry::{PagePx, ViewportPx}; use util::mem::HeapSizeOf; -use webdriver_msg::{WebDriverScriptCommand, LoadStatus}; +use webdriver_msg::{LoadStatus, WebDriverScriptCommand}; #[derive(Clone)] pub struct ConstellationChan(pub Sender<Msg>); diff --git a/components/msg/lib.rs b/components/msg/lib.rs index 0fd0b59c304..995b1bc5587 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -5,25 +5,25 @@ #![feature(custom_derive, plugin)] #![plugin(serde_macros, plugins)] +#[macro_use] +extern crate bitflags; extern crate azure; -#[macro_use] extern crate bitflags; extern crate canvas_traits; +#[cfg(target_os = "macos")] +extern crate core_foundation; extern crate euclid; extern crate hyper; +#[cfg(target_os = "macos")] +extern crate io_surface; extern crate ipc_channel; extern crate layers; extern crate offscreen_gl_context; extern crate png; extern crate rustc_serialize; extern crate serde; -extern crate util; -extern crate url; extern crate style_traits; - -#[cfg(target_os = "macos")] -extern crate core_foundation; -#[cfg(target_os = "macos")] -extern crate io_surface; +extern crate url; +extern crate util; pub mod compositor_msg; pub mod constellation_msg; diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs index 57ae5265b5a..611d72d51d8 100644 --- a/components/net/about_loader.rs +++ b/components/net/about_loader.rs @@ -5,10 +5,10 @@ use file_loader; use hyper::header::ContentType; use hyper::http::RawStatus; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::Done; -use net_traits::{LoadData, Metadata, LoadConsumer}; +use net_traits::{LoadConsumer, LoadData, Metadata}; use resource_task::start_sending; use std::fs::PathExt; use std::sync::Arc; diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 674f8032541..257fd3440fc 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -4,8 +4,8 @@ use hyper::mime::Mime; use mime_classifier::MIMEClassifier; -use net_traits::ProgressMsg::{Payload, Done}; -use net_traits::{LoadData, Metadata, LoadConsumer}; +use net_traits::ProgressMsg::{Done, Payload}; +use net_traits::{LoadConsumer, LoadData, Metadata}; use resource_task::start_sending; use rustc_serialize::base64::FromBase64; use std::sync::Arc; diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index 4abdff1945d..1751fed49ba 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -4,12 +4,12 @@ use fetch::cors_cache::{CORSCache, CacheRequestDetails}; use fetch::response::{Response, ResponseType}; -use hyper::header::{Accept, IfUnmodifiedSince, IfMatch, IfRange, Location}; -use hyper::header::{Header, Headers, ContentType, IfModifiedSince, IfNoneMatch}; -use hyper::header::{HeaderView, AcceptLanguage, ContentLanguage}; -use hyper::header::{QualityItem, qitem, q}; +use hyper::header::{Accept, IfMatch, IfRange, IfUnmodifiedSince, Location}; +use hyper::header::{AcceptLanguage, ContentLanguage, HeaderView}; +use hyper::header::{ContentType, Header, Headers, IfModifiedSince, IfNoneMatch}; +use hyper::header::{QualityItem, q, qitem}; use hyper::method::Method; -use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value}; use hyper::status::StatusCode; use std::ascii::AsciiExt; use std::str::FromStr; diff --git a/components/net/file_loader.rs b/components/net/file_loader.rs index b3e38bf4d71..5a18ab385fe 100644 --- a/components/net/file_loader.rs +++ b/components/net/file_loader.rs @@ -3,9 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use mime_classifier::MIMEClassifier; -use net_traits::ProgressMsg::{Payload, Done}; -use net_traits::{LoadData, Metadata, LoadConsumer}; -use resource_task::{start_sending, start_sending_sniffed, ProgressSender}; +use net_traits::ProgressMsg::{Done, Payload}; +use net_traits::{LoadConsumer, LoadData, Metadata}; +use resource_task::{ProgressSender, start_sending, start_sending_sniffed}; use std::borrow::ToOwned; use std::error::Error; use std::fs::File; diff --git a/components/net/hsts.rs b/components/net/hsts.rs index a9a793fc16d..cfa5b981428 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.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 net_traits::{IncludeSubdomains, IPV4_REGEX, IPV6_REGEX}; +use net_traits::{IPV4_REGEX, IPV6_REGEX, IncludeSubdomains}; use rustc_serialize::json::{decode}; use std::str::{from_utf8}; use time; @@ -131,4 +131,3 @@ pub fn secure_url(url: &Url) -> Url { url.clone() } } - diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 55e94ce3b46..8d0f4613f08 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -8,23 +8,23 @@ use cookie_storage::CookieStorage; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent}; use file_loader; use flate2::read::{DeflateDecoder, GzDecoder}; -use hsts::{secure_url, HSTSList, HSTSEntry}; +use hsts::{HSTSEntry, HSTSList, secure_url}; use hyper::Error as HttpError; -use hyper::client::{Request, Response, Pool}; -use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host}; -use hyper::header::{Location, qitem, StrictTransportSecurity, UserAgent, SetCookie}; -use hyper::header::{Quality, QualityItem, Headers, ContentEncoding, Encoding, Header}; +use hyper::client::{Pool, Request, Response}; +use hyper::header::{Accept, AcceptEncoding, ContentLength, ContentType, Host}; +use hyper::header::{ContentEncoding, Encoding, Header, Headers, Quality, QualityItem}; +use hyper::header::{Location, SetCookie, StrictTransportSecurity, UserAgent, qitem}; use hyper::http::RawStatus; use hyper::method::Method; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use hyper::net::{Fresh, HttpsConnector, Openssl}; -use hyper::status::{StatusCode, StatusClass}; +use hyper::status::{StatusClass, StatusCode}; use log; use mime_classifier::MIMEClassifier; -use net_traits::ProgressMsg::{Payload, Done}; +use net_traits::ProgressMsg::{Done, Payload}; use net_traits::hosts::replace_hosts; -use net_traits::{CookieSource, LoadData, Metadata, LoadConsumer, IncludeSubdomains}; -use openssl::ssl::{SslContext, SslMethod, SSL_VERIFY_PEER}; +use net_traits::{CookieSource, IncludeSubdomains, LoadConsumer, LoadData, Metadata}; +use openssl::ssl::{SSL_VERIFY_PEER, SslContext, SslMethod}; use resource_task::{start_sending_opt, start_sending_sniffed_opt}; use std::borrow::ToOwned; use std::boxed::FnBox; diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs index 0e371f3e688..42e82006674 100644 --- a/components/net/image_cache_task.rs +++ b/components/net/image_cache_task.rs @@ -6,16 +6,16 @@ use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use net_traits::image::base::{Image, load_from_memory}; use net_traits::image_cache_task::ImageResponder; +use net_traits::image_cache_task::{ImageCacheChan, ImageCacheCommand, ImageCacheTask, ImageState}; use net_traits::image_cache_task::{ImageCacheResult, ImageResponse, UsePlaceholder}; -use net_traits::image_cache_task::{ImageState, ImageCacheTask, ImageCacheChan, ImageCacheCommand}; use net_traits::load_whole_resource; -use net_traits::{AsyncResponseTarget, ControlMsg, LoadData, ResponseAction, ResourceTask, LoadConsumer}; +use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, LoadData, ResourceTask, ResponseAction}; use std::borrow::ToOwned; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::mem; use std::sync::Arc; -use std::sync::mpsc::{channel, Sender, Receiver, Select}; +use std::sync::mpsc::{Receiver, Select, Sender, channel}; use url::Url; use util::resource_files::resources_dir_path; use util::task::spawn_named; diff --git a/components/net/lib.rs b/components/net/lib.rs index 2d4f8309c5f..7fd1bf3c0be 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -11,21 +11,21 @@ #![feature(plugin)] #![plugin(plugins)] -extern crate net_traits; +#[macro_use] +extern crate log; extern crate cookie as cookie_rs; extern crate devtools_traits; -extern crate flate2; extern crate euclid; +extern crate flate2; extern crate hyper; extern crate ipc_channel; -extern crate png; -#[macro_use] -extern crate log; +extern crate net_traits; extern crate openssl; +extern crate png; extern crate rustc_serialize; -extern crate util; extern crate time; extern crate url; +extern crate util; extern crate uuid; pub mod about_loader; diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index d0fea0ac6c1..4337bf1cc31 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -11,18 +11,18 @@ use data_loader; use devtools_traits::{DevtoolsControlMsg}; use file_loader; use hsts::{HSTSList, preload_hsts_domains}; -use http_loader::{self, create_http_connector, Connector}; +use http_loader::{self, Connector, create_http_connector}; use hyper::client::pool::Pool; use hyper::header::{ContentType, Header, SetCookie}; -use hyper::mime::{Mime, TopLevel, SubLevel}; +use hyper::mime::{Mime, SubLevel, TopLevel}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use mime_classifier::{ApacheBugFlag, MIMEClassifier, NoSniffFlag}; use net_traits::ProgressMsg::Done; -use net_traits::{ControlMsg, LoadData, LoadResponse, LoadConsumer, CookieSource}; -use net_traits::{Metadata, ProgressMsg, ResourceTask, AsyncResponseTarget, ResponseAction}; +use net_traits::{AsyncResponseTarget, Metadata, ProgressMsg, ResourceTask, ResponseAction}; +use net_traits::{ControlMsg, CookieSource, LoadConsumer, LoadData, LoadResponse}; use std::borrow::ToOwned; use std::boxed::FnBox; -use std::sync::mpsc::{channel, Sender}; +use std::sync::mpsc::{Sender, channel}; use std::sync::{Arc, RwLock}; use url::Url; use util::opts; diff --git a/components/net_traits/hosts.rs b/components/net_traits/hosts.rs index 67001324dcf..b4c7cf560e4 100644 --- a/components/net_traits/hosts.rs +++ b/components/net_traits/hosts.rs @@ -2,12 +2,12 @@ * 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 ::{IPV4_REGEX, IPV6_REGEX}; use std::collections::HashMap; use std::env; use std::fs::File; use std::io::{BufReader, Read}; use url::Url; -use {IPV4_REGEX, IPV6_REGEX}; static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 2834730f552..68911832989 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -3,33 +3,33 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(box_syntax)] +#![feature(custom_attribute)] #![feature(custom_derive)] #![feature(plugin)] #![feature(slice_patterns)] #![feature(step_by)] #![feature(vec_push_all)] -#![feature(custom_attribute)] -#![plugin(serde_macros, plugins)] +#![plugin(plugins, serde_macros)] #![plugin(regex_macros)] +#[macro_use] +extern crate log; extern crate euclid; extern crate hyper; extern crate ipc_channel; -#[macro_use] -extern crate log; +extern crate msg; extern crate png; extern crate regex; extern crate serde; extern crate stb_image; extern crate url; extern crate util; -extern crate msg; use hyper::header::{ContentType, Headers}; use hyper::http::RawStatus; use hyper::method::Method; -use hyper::mime::{Mime, Attr}; +use hyper::mime::{Attr, Mime}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::{PipelineId}; use regex::Regex; diff --git a/components/profile/Cargo.toml b/components/profile/Cargo.toml index c71569c3177..6d5d632ddbd 100644 --- a/components/profile/Cargo.toml +++ b/components/profile/Cargo.toml @@ -10,6 +10,9 @@ path = "lib.rs" [dependencies.profile_traits] path = "../profile_traits" +[dependencies.plugins] +path = "../plugins" + [dependencies.util] path = "../util" diff --git a/components/profile/lib.rs b/components/profile/lib.rs index 635b9af083f..087bf48e6e0 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -5,22 +5,23 @@ #![feature(box_syntax)] #![feature(iter_arith)] #![feature(slice_splits)] +#![feature(plugin)] +#![plugin(plugins)] -#[macro_use] extern crate log; - +#[macro_use] +extern crate log; +#[macro_use] +extern crate profile_traits; extern crate hbs_pow; extern crate ipc_channel; extern crate libc; -#[macro_use] -extern crate profile_traits; #[cfg(target_os = "linux")] extern crate regex; +extern crate time as std_time; #[cfg(target_os = "macos")] extern crate task_info; -extern crate time as std_time; extern crate util; +mod heartbeats; pub mod mem; pub mod time; - -mod heartbeats; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index 0a58f6cec0a..b0736ff961d 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -7,7 +7,7 @@ use ipc_channel::ipc::{self, IpcReceiver}; use ipc_channel::router::ROUTER; use profile_traits::mem::ReportsChan; -use profile_traits::mem::{ProfilerChan, ProfilerMsg, Reporter, ReporterRequest, ReportKind}; +use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest}; use std::borrow::ToOwned; use std::cmp::Ordering; use std::collections::HashMap; @@ -362,7 +362,7 @@ impl ReportsForest { mod system_reporter { use libc::{c_char, c_int, c_void, size_t}; - use profile_traits::mem::{Report, ReporterRequest, ReportKind}; + use profile_traits::mem::{Report, ReportKind, ReporterRequest}; use std::borrow::ToOwned; use std::ffi::CString; use std::mem::size_of; diff --git a/components/profile_traits/Cargo.toml b/components/profile_traits/Cargo.toml index 00ea9fbadb2..0f993d3dcd5 100644 --- a/components/profile_traits/Cargo.toml +++ b/components/profile_traits/Cargo.toml @@ -26,8 +26,10 @@ optional = true version = "0.1.0" optional = true +[dependencies.plugins] +path = "../plugins" + [dependencies] serde = "0.6" serde_macros = "0.5" time = "0.1.12" - diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs index abeec3bb1ad..26ae6be4338 100644 --- a/components/profile_traits/lib.rs +++ b/components/profile_traits/lib.rs @@ -8,7 +8,7 @@ #![feature(box_syntax)] #![feature(custom_derive, plugin)] -#![plugin(serde_macros)] +#![plugin(plugins, serde_macros)] extern crate ipc_channel; extern crate serde; @@ -16,4 +16,3 @@ extern crate serde; pub mod energy; pub mod mem; pub mod time; - 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; diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 617449a871b..d7547cc5c59 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -13,6 +13,9 @@ path = "../msg" [dependencies.net_traits] path = "../net_traits" +[dependencies.plugins] +path = "../plugins" + [dependencies.profile_traits] path = "../profile_traits" @@ -34,4 +37,3 @@ libc = "0.1" euclid = "0.2" serde = "0.6" serde_macros = "0.5" - diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index ae5e9b22bb6..8bea026d706 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -7,7 +7,7 @@ //! to depend on script. #![feature(custom_derive, plugin)] -#![plugin(serde_macros)] +#![plugin(plugins, serde_macros)] #![deny(missing_docs)] extern crate devtools_traits; @@ -18,8 +18,8 @@ extern crate msg; extern crate net_traits; extern crate profile_traits; extern crate serde; -extern crate util; extern crate url; +extern crate util; use devtools_traits::ScriptToDevtoolsControlMsg; use euclid::point::Point2D; @@ -27,8 +27,8 @@ use euclid::rect::Rect; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; use msg::compositor_msg::{Epoch, LayerId, ScriptToCompositorMsg}; -use msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData}; -use msg::constellation_msg::{LoadData, SubpageId, Key, KeyState, KeyModifiers}; +use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; use msg::constellation_msg::{MozBrowserEvent, PipelineExitType}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::ResourceTask; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 232fe4fcf3c..5caf483d592 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -146,6 +146,7 @@ dependencies = [ "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", + "plugins 0.0.1", "util 0.0.1", ] @@ -1334,6 +1335,7 @@ dependencies = [ "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "plugins 0.0.1", "profile_traits 0.0.1", "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "task_info 0.0.1", @@ -1348,6 +1350,7 @@ dependencies = [ "energy-monitor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "energymon 0.1.0 (git+https://github.com/energymon/energymon-rust.git?rev=67f74732ac)", "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", + "plugins 0.0.1", "serde 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1488,6 +1491,7 @@ dependencies = [ "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "plugins 0.0.1", "profile_traits 0.0.1", "serde 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1907,6 +1911,7 @@ dependencies = [ "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", + "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 91ef9939a90..eb144007dab 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -21,26 +21,25 @@ extern crate util as _util; mod export { + extern crate canvas; + extern crate canvas_traits; extern crate compositing; extern crate devtools; extern crate devtools_traits; + extern crate euclid; + extern crate gfx; + extern crate gleam; + extern crate layers; + extern crate layout; + extern crate msg; extern crate net; extern crate net_traits; - extern crate msg; extern crate profile; extern crate profile_traits; extern crate script; extern crate script_traits; - extern crate layout; - extern crate gfx; extern crate style; - extern crate canvas; - extern crate canvas_traits; - - extern crate euclid; extern crate url; - extern crate layers; - extern crate gleam; } extern crate libc; @@ -56,28 +55,6 @@ fn webdriver(port: u16, constellation: msg::constellation_msg::ConstellationChan #[cfg(not(feature = "webdriver"))] fn webdriver(_port: u16, _constellation: msg::constellation_msg::ConstellationChan) { } -pub use _util as util; -pub use export::compositing; -pub use export::devtools; -pub use export::devtools_traits; -pub use export::net; -pub use export::net_traits; -pub use export::msg; -pub use export::profile; -pub use export::profile_traits; -pub use export::script; -pub use export::script_traits; -pub use export::layout; -pub use export::gfx; -pub use export::style; -pub use export::canvas; -pub use export::canvas_traits; - -pub use export::euclid; -pub use export::url; -pub use export::layers; -pub use export::gleam::gl; - use compositing::CompositorEventListener; use compositing::compositor_task::InitialCompositorState; use compositing::constellation::InitialConstellationState; @@ -100,6 +77,27 @@ use std::rc::Rc; use std::sync::mpsc::Sender; use util::opts; +pub use _util as util; +pub use export::canvas; +pub use export::canvas_traits; +pub use export::compositing; +pub use export::devtools; +pub use export::devtools_traits; +pub use export::euclid; +pub use export::gfx; +pub use export::gleam::gl; +pub use export::layers; +pub use export::layout; +pub use export::msg; +pub use export::net; +pub use export::net_traits; +pub use export::profile; +pub use export::profile_traits; +pub use export::script; +pub use export::script_traits; +pub use export::style; +pub use export::url; + pub struct Browser { compositor: Box<CompositorEventListener + 'static>, } diff --git a/components/servo/main.rs b/components/servo/main.rs index 66b5b670547..8112b7fa4cc 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -17,17 +17,15 @@ #![feature(start)] -// The Servo engine -extern crate servo; - -// The window backed by glutin -extern crate glutin_app as app; -extern crate time; -extern crate env_logger; - #[cfg(target_os = "android")] #[macro_use] extern crate android_glue; +// The window backed by glutin +extern crate glutin_app as app; +extern crate env_logger; +// The Servo engine +extern crate servo; +extern crate time; use servo::Browser; use servo::compositing::windowing::WindowEvent; diff --git a/components/style/animation.rs b/components/style/animation.rs index 32aae7c7cce..b3afc145425 100644 --- a/components/style/animation.rs +++ b/components/style/animation.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 cssparser::{RGBA, Color}; +use cssparser::{Color, RGBA}; use euclid::point::Point2D; use properties::ComputedValues; use properties::longhands::background_position::computed_value::T as BackgroundPosition; @@ -28,7 +28,7 @@ use util::bezier::Bezier; use util::geometry::Au; use values::CSSFloat; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; -use values::computed::{LengthOrPercentage, Length, Time, Calc}; +use values::computed::{Calc, Length, LengthOrPercentage, Time}; #[derive(Clone, Debug)] pub struct PropertyAnimation { diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 4a6f5076f56..b5f7c3f3232 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.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 cssparser::{Parser, Token, SourcePosition, Delimiter, TokenSerializationType, ToCss}; +use cssparser::{Delimiter, Parser, SourcePosition, ToCss, Token, TokenSerializationType}; use properties::DeclaredValue; use std::ascii::AsciiExt; use std::collections::{HashMap, HashSet}; diff --git a/components/style/font_face.rs b/components/style/font_face.rs index 6d24321bca6..54ffdcc7891 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use computed_values::font_family::FontFamily; -use cssparser::{Token, Parser, DeclarationListParser, AtRuleParser, DeclarationParser}; +use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser, Token}; use parser::{ParserContext, log_css_error}; use properties::longhands::font_family::parse_one_family; use std::ascii::AsciiExt; diff --git a/components/style/lib.rs b/components/style/lib.rs index f230bc5a02f..d97ed9edb21 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -16,40 +16,43 @@ #![plugin(serde_macros)] #![plugin(plugins)] -#[macro_use] extern crate log; -#[macro_use] extern crate bitflags; - -extern crate fnv; -extern crate euclid; -extern crate serde; -extern crate smallvec; -extern crate url; - +#[macro_use] +extern crate bitflags; #[macro_use] extern crate cssparser; - +#[macro_use] +extern crate lazy_static; +#[macro_use] +extern crate log; #[macro_use] extern crate matches; - +#[macro_use] +extern crate style_traits; extern crate encoding; +extern crate euclid; +extern crate fnv; +extern crate num; extern crate rustc_serialize; -extern crate string_cache; extern crate selectors; - -#[macro_use] -extern crate lazy_static; - -extern crate num; +extern crate serde; +extern crate smallvec; +extern crate string_cache; +extern crate url; extern crate util; -#[macro_use] -extern crate style_traits; - +pub mod animation; mod custom_properties; +pub mod font_face; +pub mod legacy; +pub mod media_queries; +pub mod node; pub mod parser; pub mod selector_matching; pub mod stylesheets; -#[macro_use] pub mod values; +#[macro_use] +#[allow(non_camel_case_types)] +pub mod values; +pub mod viewport; // Generated from the properties.mako.rs template by build.rs #[macro_use] @@ -57,13 +60,6 @@ pub mod properties { include!(concat!(env!("OUT_DIR"), "/properties.rs")); } -pub mod animation; -pub mod font_face; -pub mod legacy; -pub mod media_queries; -pub mod node; -pub mod viewport; - macro_rules! reexport_computed_values { ( $( $name: ident )+ ) => { pub mod computed_values { diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 2f4d85a9627..f42d6970133 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.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 cssparser::{Token, Parser, Delimiter}; +use cssparser::{Delimiter, Parser, Token}; use euclid::size::{Size2D, TypedSize2D}; use properties::longhands; use std::ascii::AsciiExt; diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 41d0f6f6141..b758c535da8 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -9,12 +9,12 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock}; use selectors::Element; use selectors::bloom::BloomFilter; use selectors::matching::DeclarationBlock as GenericDeclarationBlock; -use selectors::matching::{SelectorMap, Rule}; +use selectors::matching::{Rule, SelectorMap}; use selectors::parser::PseudoElement; use smallvec::VecLike; use std::process; use style_traits::viewport::ViewportConstraints; -use stylesheets::{Stylesheet, CSSRuleIteratorExt, Origin}; +use stylesheets::{CSSRuleIteratorExt, Origin, Stylesheet}; use url::Url; use util::opts; use util::resource_files::read_resource_file; diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index 8f6f5db7b64..8c78b19aa3c 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -2,8 +2,8 @@ * 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 cssparser::{Parser, decode_stylesheet_bytes, QualifiedRuleParser, AtRuleParser}; -use cssparser::{RuleListParser, AtRuleType}; +use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, decode_stylesheet_bytes}; +use cssparser::{AtRuleType, RuleListParser}; use encoding::EncodingRef; use font_face::{FontFaceRule, parse_font_face_block}; use media_queries::{Device, MediaQueryList, parse_media_query_list}; @@ -19,7 +19,6 @@ use string_cache::{Atom, Namespace}; use url::Url; use viewport::ViewportRule; - /// Each style rule has an origin, which determines where it enters the cascade. /// /// http://dev.w3.org/csswg/css-cascade/#cascading-origins diff --git a/components/style/values.rs b/components/style/values.rs index e58def1d66d..4eb5b02b20e 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -2,11 +2,8 @@ * 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/. */ -#![allow(non_camel_case_types)] - pub use cssparser::RGBA; - macro_rules! define_numbered_css_keyword_enum { ($name: ident: $( $css: expr => $variant: ident = $value: expr ),+,) => { define_numbered_css_keyword_enum!($name: $( $css => $variant = $value ),+); @@ -43,14 +40,13 @@ pub type CSSFloat = f32; pub mod specified { - use cssparser::{self, Token, Parser, ToCss, CssStringWriter}; + use cssparser::{self, CssStringWriter, Parser, ToCss, Token}; use euclid::size::Size2D; use parser::ParserContext; use std::ascii::AsciiExt; use std::cmp; use std::f32::consts::PI; - use std::fmt; - use std::fmt::Write; + use std::fmt::{self, Write}; use std::ops::Mul; use style_traits::values::specified::AllowedNumericType; use super::CSSFloat; @@ -1213,15 +1209,15 @@ pub mod specified { } pub mod computed { - pub use super::specified::{Angle, BorderStyle, Time}; use euclid::size::Size2D; - pub use cssparser::Color as CSSColor; use properties::longhands; use std::fmt; use super::specified::AngleOrCorner; - use super::{specified, CSSFloat}; + use super::{CSSFloat, specified}; use url::Url; use util::geometry::Au; + pub use cssparser::Color as CSSColor; + pub use super::specified::{Angle, BorderStyle, Time}; pub struct Context { pub inherited_font_weight: longhands::font_weight::computed_value::T, diff --git a/components/style/viewport.rs b/components/style/viewport.rs index 72da1098a74..5f86804b39b 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.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 cssparser::{Parser, DeclarationListParser, AtRuleParser, DeclarationParser, parse_important}; +use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser, parse_important}; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; use parser::{ParserContext, log_css_error}; @@ -10,7 +10,7 @@ use properties::longhands; use std::ascii::AsciiExt; use std::collections::hash_map::{Entry, HashMap}; use std::intrinsics; -use style_traits::viewport::{UserZoom, Zoom, Orientation, ViewportConstraints}; +use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom}; use stylesheets::Origin; use util::geometry::{Au, ViewportPx}; use values::computed::{Context, ToComputedValue}; diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs index f1348fa79a7..2589bb961d6 100644 --- a/components/style_traits/lib.rs +++ b/components/style_traits/lib.rs @@ -14,17 +14,13 @@ #![plugin(plugins)] #![deny(unsafe_code)] - - +#[macro_use] +extern crate cssparser; extern crate euclid; extern crate rustc_serialize; extern crate serde; extern crate util; #[macro_use] -extern crate cssparser; - -#[macro_use] pub mod values; - pub mod viewport; diff --git a/components/util/deque/mod.rs b/components/util/deque/mod.rs index c3393202e37..3764fbf933d 100644 --- a/components/util/deque/mod.rs +++ b/components/util/deque/mod.rs @@ -47,17 +47,15 @@ // FIXME: more than likely, more atomic operations than necessary use SeqCst -pub use self::Stolen::{Empty, Abort, Data}; - use std::marker; -use std::mem::{forget, align_of, size_of, transmute}; +use std::mem::{align_of, forget, size_of, transmute}; use std::ptr; use alloc::heap::{allocate, deallocate}; use std::sync::Arc; - use std::sync::Mutex; use std::sync::atomic::Ordering::{Relaxed, SeqCst}; use std::sync::atomic::{AtomicIsize, AtomicPtr}; +pub use self::Stolen::{Abort, Data, Empty}; // Once the queue is less than 1/K full, then it will be downsized. Note that // the deque requires that this number be less than 2. diff --git a/components/util/geometry.rs b/components/util/geometry.rs index abdcf100531..fb39cfd9919 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -8,11 +8,11 @@ use euclid::num::Zero; use euclid::point::Point2D; use euclid::rect::Rect; use euclid::size::Size2D; -use rustc_serialize::{Encoder, Encodable}; +use rustc_serialize::{Encodable, Encoder}; use std::default::Default; use std::fmt; use std::i32; -use std::ops::{Add, Sub, Neg, Mul, Div, Rem}; +use std::ops::{Add, Div, Mul, Neg, Rem, Sub}; // Units for use with euclid::length and euclid::scale_factor. diff --git a/components/util/lib.rs b/components/util/lib.rs index 13029275bc4..0fd7cc034de 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -18,15 +18,18 @@ #![feature(step_trait)] #![feature(zero_one)] -#![plugin(serde_macros)] +#![plugin(plugins, serde_macros)] -#[macro_use] extern crate log; -#[macro_use] extern crate lazy_static; - -extern crate azure; +#[macro_use] +extern crate bitflags; +#[macro_use] +extern crate cssparser; +#[macro_use] +extern crate lazy_static; +#[macro_use] +extern crate log; extern crate alloc; -#[macro_use] extern crate bitflags; -#[macro_use] extern crate cssparser; +extern crate azure; extern crate euclid; extern crate getopts; extern crate html5ever; @@ -35,8 +38,8 @@ extern crate ipc_channel; extern crate js; extern crate layers; extern crate libc; -extern crate num as num_lib; extern crate num_cpus; +extern crate num as num_lib; extern crate rand; extern crate rustc_serialize; extern crate selectors; diff --git a/components/util/logical_geometry.rs b/components/util/logical_geometry.rs index c77f862fbbb..7eac6e82802 100644 --- a/components/util/logical_geometry.rs +++ b/components/util/logical_geometry.rs @@ -5,9 +5,9 @@ //! Geometry in flow-relative space. use euclid::num::Zero; -use euclid::{Size2D, Point2D, SideOffsets2D, Rect}; -use std::cmp::{min, max}; -use std::fmt::{self, Debug, Formatter, Error}; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use std::cmp::{max, min}; +use std::fmt::{self, Debug, Error, Formatter}; use std::ops::{Add, Sub}; bitflags!( @@ -1026,4 +1026,3 @@ pub enum PhysicalSide { Bottom, Left, } - diff --git a/components/util/mem.rs b/components/util/mem.rs index 802d34c5385..aac020b3334 100644 --- a/components/util/mem.rs +++ b/components/util/mem.rs @@ -10,13 +10,13 @@ use cssparser::{RGBA, TokenSerializationType}; use cursor::Cursor; use euclid::length::Length; use euclid::scale_factor::ScaleFactor; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D, Matrix4}; -use geometry::{PagePx, ViewportPx, Au}; +use euclid::{Matrix2D, Matrix4, Point2D, Rect, SideOffsets2D, Size2D}; +use geometry::{Au, PagePx, ViewportPx}; use html5ever::tree_builder::QuirksMode; use hyper::header::ContentType; use hyper::http::RawStatus; use hyper::method::Method; -use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value}; use js::jsapi::Heap; use js::jsval::JSVal; use js::rust::GCMethods; @@ -25,7 +25,7 @@ use libc::{c_void, size_t}; use logical_geometry::WritingMode; use rand::OsRng; use range::Range; -use selectors::parser::{PseudoElement, Selector, CompoundSelector, SimpleSelector, Combinator}; +use selectors::parser::{Combinator, CompoundSelector, PseudoElement, Selector, SimpleSelector}; use std::cell::{Cell, RefCell}; use std::collections::{HashMap, LinkedList, hash_state}; use std::hash::Hash; diff --git a/components/util/str.rs b/components/util/str.rs index 466d2d644eb..606933d7033 100644 --- a/components/util/str.rs +++ b/components/util/str.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 cssparser::{self, RGBA, Color}; +use cssparser::{self, Color, RGBA}; use geometry::Au; use libc::c_char; use num_lib::ToPrimitive; @@ -11,7 +11,7 @@ use std::borrow::ToOwned; use std::ffi::CStr; use std::iter::Filter; use std::ops::Deref; -use std::str::{from_utf8, FromStr, Split}; +use std::str::{FromStr, Split, from_utf8}; pub type DOMString = String; pub type StaticCharVec = &'static [char]; diff --git a/components/util/task_state.rs b/components/util/task_state.rs index 0f559b98b4c..f67e059c4c1 100644 --- a/components/util/task_state.rs +++ b/components/util/task_state.rs @@ -8,7 +8,7 @@ //! In release builds, `get` returns 0. All of the other functions inline //! away to nothing. -pub use self::imp::{initialize, get, enter, exit}; +pub use self::imp::{enter, exit, get, initialize}; bitflags! { flags TaskState: u32 { @@ -50,7 +50,7 @@ task_types! { #[cfg(debug_assertions)] mod imp { use std::cell::RefCell; - use super::{TaskState, TYPES}; + use super::{TYPES, TaskState}; thread_local!(static STATE: RefCell<Option<TaskState>> = RefCell::new(None)); diff --git a/components/util/taskpool.rs b/components/util/taskpool.rs index 04059e00f7e..1784c9fb63b 100644 --- a/components/util/taskpool.rs +++ b/components/util/taskpool.rs @@ -16,7 +16,7 @@ // use std::boxed::FnBox; -use std::sync::mpsc::{channel, Sender, Receiver}; +use std::sync::mpsc::{Receiver, Sender, channel}; use std::sync::{Arc, Mutex}; use task::spawn_named; diff --git a/components/util/tid.rs b/components/util/tid.rs index ebed22881b3..55e3c091bf6 100644 --- a/components/util/tid.rs +++ b/components/util/tid.rs @@ -4,7 +4,7 @@ use std::cell::RefCell; use std::rc::Rc; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; static NEXT_TID: AtomicUsize = ATOMIC_USIZE_INIT; diff --git a/components/util/vec.rs b/components/util/vec.rs index ff9dcc0292d..808aeb96479 100644 --- a/components/util/vec.rs +++ b/components/util/vec.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 std::cmp::{PartialOrd, PartialEq, Ordering}; +use std::cmp::{Ordering, PartialEq, PartialOrd}; use std::marker::PhantomData; use std::ops; use super::smallvec::VecLike; diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs index 0ffd50163e3..af481312f21 100644 --- a/components/util/workqueue.rs +++ b/components/util/workqueue.rs @@ -9,9 +9,9 @@ use deque::{Abort, BufferPool, Data, Empty, Stealer, Worker}; use libc::funcs::posix88::unistd::usleep; -use rand::{Rng, weak_rng, XorShiftRng}; +use rand::{Rng, XorShiftRng, weak_rng}; use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::mpsc::{channel, Sender, Receiver}; +use std::sync::mpsc::{Receiver, Sender, channel}; use task::spawn_named; use task_state; diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 85285808a8e..684781882d8 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -10,6 +10,9 @@ path = "lib.rs" [dependencies.msg] path = "../msg" +[dependencies.plugins] +path = "../plugins" + [dependencies.util] path = "../util" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index df0d3c928f1..6ecbdd18c68 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -5,30 +5,30 @@ #![crate_name = "webdriver_server"] #![crate_type = "rlib"] -#![feature(ip_addr)] +#![feature(ip_addr, plugin)] +#![plugin(plugins)] #[macro_use] extern crate log; - -extern crate webdriver; +extern crate hyper; +extern crate ipc_channel; extern crate msg; extern crate png; +extern crate regex; +extern crate rustc_serialize; extern crate url; extern crate util; -extern crate rustc_serialize; extern crate uuid; -extern crate ipc_channel; -extern crate regex; -extern crate hyper; +extern crate webdriver; use hyper::method::Method::{self, Post}; -use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; +use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::Msg as ConstellationMsg; -use msg::constellation_msg::{ConstellationChan, LoadData, FrameId, PipelineId}; +use msg::constellation_msg::{ConstellationChan, FrameId, LoadData, PipelineId}; use msg::constellation_msg::{NavigationDirection, WebDriverCommandMsg}; -use msg::webdriver_msg::{WebDriverFrameId, WebDriverScriptCommand, WebDriverJSError, WebDriverJSResult, LoadStatus}; +use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use regex::Captures; -use rustc_serialize::base64::{Config, ToBase64, CharacterSet, Newline}; +use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; use std::borrow::ToOwned; use std::collections::BTreeMap; @@ -39,13 +39,13 @@ use util::prefs::{get_pref, set_pref}; use util::task::spawn_named; use uuid::Uuid; use webdriver::command::{GetParameters, JavascriptCommandParameters, LocatorParameters}; -use webdriver::command::{SwitchToFrameParameters, TimeoutsParameters, Parameters}; -use webdriver::command::{WebDriverMessage, WebDriverCommand, WebDriverExtensionCommand}; +use webdriver::command::{Parameters, SwitchToFrameParameters, TimeoutsParameters}; +use webdriver::command::{WebDriverCommand, WebDriverExtensionCommand, WebDriverMessage}; use webdriver::common::{LocatorStrategy, WebElement}; -use webdriver::error::{WebDriverResult, WebDriverError, ErrorStatus}; +use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult}; use webdriver::httpapi::{WebDriverExtensionRoute}; -use webdriver::response::{WebDriverResponse, NewSessionResponse, ValueResponse}; -use webdriver::server::{self, WebDriverHandler, Session}; +use webdriver::response::{NewSessionResponse, ValueResponse, WebDriverResponse}; +use webdriver::server::{self, Session, WebDriverHandler}; fn extension_routes() -> Vec<(Method, &'static str, ServoExtensionRoute)> { return vec![(Post, "/session/{sessionId}/servo/prefs/get", ServoExtensionRoute::GetPrefs), |