diff options
Diffstat (limited to 'components')
160 files changed, 434 insertions, 429 deletions
diff --git a/components/bluetooth_traits/lib.rs b/components/bluetooth_traits/lib.rs index e96beb6efbc..bc77d885050 100644 --- a/components/bluetooth_traits/lib.rs +++ b/components/bluetooth_traits/lib.rs @@ -11,8 +11,8 @@ extern crate serde; pub mod blocklist; pub mod scanfilter; -use ipc_channel::ipc::IpcSender; use crate::scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions}; +use ipc_channel::ipc::IpcSender; #[derive(Debug, Deserialize, Serialize)] pub enum BluetoothError { diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index d674d4272ad..0eecd116348 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use azure::azure_hl::AntialiasMode; -use crate::canvas_data::*; use canvas_traits::canvas::*; +use crate::canvas_data::*; use euclid::Size2D; use ipc_channel::ipc::{self, IpcSender}; use std::borrow::ToOwned; diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index b86a6c9b454..c7b1756aa32 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -2,17 +2,17 @@ * 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 crate::gl_context::GLContextFactory; use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver}; use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler}; use canvas_traits::webgl::DOMToTextureCommand; use canvas_traits::webgl::webgl_channel; +use crate::gl_context::GLContextFactory; +use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread}; use euclid::Size2D; use fnv::FnvHashMap; use gleam::gl; use servo_config::prefs::PREFS; use std::rc::Rc; -use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread}; use webrender; use webrender_api; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index eb7b30db12a..e69606ee4d2 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -6,10 +6,12 @@ use crate::CompositionPipeline; use crate::SendableFrameTree; use crate::compositor_thread::{CompositorProxy, CompositorReceiver}; use crate::compositor_thread::{InitialCompositorState, Msg}; -use euclid::{TypedPoint2D, TypedVector2D, TypedScale}; -use gfx_traits::Epoch; #[cfg(feature = "gleam")] use crate::gl; +use crate::touch::{TouchHandler, TouchAction}; +use crate::windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods}; +use euclid::{TypedPoint2D, TypedVector2D, TypedScale}; +use gfx_traits::Epoch; #[cfg(feature = "gleam")] use image::{DynamicImage, ImageFormat}; use ipc_channel::ipc; @@ -36,11 +38,9 @@ use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor}; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; use time::{now, precise_time_ns, precise_time_s}; -use crate::touch::{TouchHandler, TouchAction}; use webrender; use webrender_api::{self, DeviceIntPoint, DevicePoint, HitTestFlags, HitTestResult}; use webrender_api::{LayoutVector2D, ScrollLocation}; -use crate::windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods}; #[derive(Debug, PartialEq)] enum UnableToComposite { diff --git a/components/config/opts.rs b/components/config/opts.rs index 7ade976e165..1c0ca14e6b0 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -5,10 +5,10 @@ //! Configuration options for a single run of the servo application. Created //! from command line arguments. +use crate::prefs::{self, PrefValue, PREFS}; use euclid::TypedSize2D; use getopts::Options; use num_cpus; -use crate::prefs::{self, PrefValue, PREFS}; use servo_geometry::DeviceIndependentPixel; use servo_url::ServoUrl; use std::borrow::Cow; diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 6c09da22e3d..85b86adadd5 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -3,9 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::basedir::default_config_dir; +use crate::opts; use embedder_traits::resources::{self, Resource}; use num_cpus; -use crate::opts; use rustc_serialize::json::{Json, ToJson}; use std::borrow::ToOwned; use std::cmp::max; diff --git a/components/constellation/browsingcontext.rs b/components/constellation/browsingcontext.rs index b6084ffe634..06db6f7d58c 100644 --- a/components/constellation/browsingcontext.rs +++ b/components/constellation/browsingcontext.rs @@ -2,9 +2,9 @@ * 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 crate::pipeline::Pipeline; use euclid::TypedSize2D; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; -use crate::pipeline::Pipeline; use std::collections::{HashMap, HashSet}; use style_traits::CSSPixel; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index e7466fb38e7..32aaa3a1106 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -91,8 +91,6 @@ use backtrace::Backtrace; use bluetooth_traits::BluetoothRequest; -use crate::browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator}; -use crate::browsingcontext::NewBrowsingContextInfo; use canvas::canvas_paint_thread::CanvasPaintThread; use canvas::webgl_thread::WebGLThreads; use canvas_traits::canvas::CanvasId; @@ -101,11 +99,17 @@ use clipboard::{ClipboardContext, ClipboardProvider}; use compositing::SendableFrameTree; use compositing::compositor_thread::CompositorProxy; use compositing::compositor_thread::Msg as ToCompositorMsg; +use crate::browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator}; +use crate::browsingcontext::NewBrowsingContextInfo; +use crate::event_loop::EventLoop; +use crate::network_listener::NetworkListener; +use crate::pipeline::{InitialPipelineState, Pipeline}; +use crate::session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff}; +use crate::timer_scheduler::TimerScheduler; use debugger; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use embedder_traits::{EmbedderMsg, EmbedderProxy}; use euclid::{Size2D, TypedSize2D, TypedScale}; -use crate::event_loop::EventLoop; use gfx::font_cache_thread::FontCacheThread; use gfx_traits::Epoch; use ipc_channel::{Error as IpcError}; @@ -120,8 +124,6 @@ use net_traits::{self, IpcSend, FetchResponseMsg, ResourceThreads}; use net_traits::pub_domains::reg_host; use net_traits::request::RequestInit; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; -use crate::network_listener::NetworkListener; -use crate::pipeline::{InitialPipelineState, Pipeline}; use profile_traits::mem; use profile_traits::time; use script_traits::{AnimationState, AuxiliaryBrowsingContextLoadInfo, AnimationTickType, CompositorEvent}; @@ -139,7 +141,6 @@ use servo_config::prefs::PREFS; use servo_rand::{Rng, SeedableRng, ServoRng, random}; use servo_remutex::ReentrantMutex; use servo_url::{Host, ImmutableOrigin, ServoUrl}; -use crate::session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff}; use std::borrow::ToOwned; use std::collections::{HashMap, VecDeque}; use std::marker::PhantomData; @@ -151,7 +152,6 @@ use std::thread; use style_traits::CSSPixel; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; -use crate::timer_scheduler::TimerScheduler; use webrender_api; use webvr_traits::{WebVREvent, WebVRMsg}; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index c1420cd4837..4a826189d53 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -7,9 +7,9 @@ use canvas_traits::webgl::WebGLPipeline; use compositing::CompositionPipeline; use compositing::CompositorProxy; use compositing::compositor_thread::Msg as CompositorMsg; +use crate::event_loop::EventLoop; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; use euclid::{TypedSize2D, TypedScale}; -use crate::event_loop::EventLoop; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::Error; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; @@ -555,9 +555,9 @@ impl UnprivilegedPipelineContent { #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] pub fn spawn_multiprocess(self) -> Result<(), Error> { + use crate::sandboxing::content_process_sandbox_profile; use gaol::sandbox::{self, Sandbox, SandboxMethods}; use ipc_channel::ipc::IpcOneShotServer; - use crate::sandboxing::content_process_sandbox_profile; impl CommandMethods for sandbox::Command { fn arg<T>(&mut self, arg: T) diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs index c48f12253c6..2d332c51f43 100644 --- a/components/devtools/actors/browsing_context.rs +++ b/components/devtools/actors/browsing_context.rs @@ -9,8 +9,8 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::console::ConsoleActor; -use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications}; use crate::protocol::JsonPacketStream; +use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications}; use serde_json::{Map, Value}; use std::net::TcpStream; diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 2764763e6ec..0f3b0e10ed2 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -9,13 +9,13 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::object::ObjectActor; +use crate::protocol::JsonPacketStream; use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg}; use devtools_traits::CachedConsoleMessage; use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue}; use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; -use crate::protocol::JsonPacketStream; use serde_json::{self, Map, Number, Value}; use std::cell::RefCell; use std::net::TcpStream; diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index 0c8461fc768..4177d838571 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -6,12 +6,12 @@ //! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; +use crate::protocol::JsonPacketStream; use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, GetRootNode}; use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; -use crate::protocol::JsonPacketStream; use serde_json::{self, Map, Value}; use std::cell::RefCell; use std::net::TcpStream; diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs index 07144fbefff..beb7d3e50ba 100644 --- a/components/devtools/actors/network_event.rs +++ b/components/devtools/actors/network_event.rs @@ -7,13 +7,13 @@ //! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo. use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; +use crate::protocol::JsonPacketStream; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; use headers_core::HeaderMapExt; use headers_ext::{ContentType, Cookie}; use http::{header, HeaderMap}; use hyper::{Method, StatusCode}; -use crate::protocol::JsonPacketStream; use serde_json::{Map, Value}; use std::net::TcpStream; use time; diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 33c7c17b78e..45c662988b5 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -5,12 +5,12 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::framerate::FramerateActor; use crate::actors::memory::{MemoryActor, TimelineMemoryReply}; +use crate::protocol::JsonPacketStream; use devtools_traits::{PreciseTime, TimelineMarker, TimelineMarkerType}; use devtools_traits::DevtoolScriptControlMsg; use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::PipelineId; -use crate::protocol::JsonPacketStream; use serde::{Serialize, Serializer}; use serde_json::{Map, Value}; use std::cell::RefCell; diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 2440fba21f5..ef147ca953d 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -42,12 +42,12 @@ use crate::actors::stylesheets::StyleSheetsActor; use crate::actors::thread::ThreadActor; use crate::actors::timeline::TimelineActor; use crate::actors::worker::WorkerActor; +use crate::protocol::JsonPacketStream; use devtools_traits::{ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolsControlMsg}; use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo, LogLevel, NetworkEvent}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use crate::protocol::JsonPacketStream; use servo_channel::{Receiver, Sender, channel}; use std::borrow::ToOwned; use std::cell::RefCell; diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 18188bc9f2d..18a8ed21e11 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -3,14 +3,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use euclid::{Point2D, Rect, Size2D}; use crate::font_context::{FontContext, FontSource}; use crate::font_template::FontTemplateDescriptor; -use ordered_float::NotNan; use crate::platform::font::{FontHandle, FontTable}; use crate::platform::font_context::FontContextHandle; pub use crate::platform::font_list::fallback_font_families; use crate::platform::font_template::FontTemplateData; +use crate::text::Shaper; +use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; +use crate::text::shaping::ShaperMethods; +use euclid::{Point2D, Rect, Size2D}; +use ordered_float::NotNan; use servo_atoms::Atom; use smallvec::SmallVec; use std::borrow::ToOwned; @@ -24,9 +27,6 @@ use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight}; use style::properties::style_structs::Font as FontStyleStruct; use style::values::computed::font::SingleFontFamily; -use crate::text::Shaper; -use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; -use crate::text::shaping::ShaperMethods; use time; use unicode_script::Script; use webrender_api; diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index 0e4c7727997..94b2138d68f 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -6,16 +6,16 @@ use app_units::Au; use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; use crate::font_context::FontSource; use crate::font_template::{FontTemplate, FontTemplateDescriptor}; -use fontsan; -use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; -use net_traits::{CoreResourceThread, FetchResponseMsg, fetch_async}; -use net_traits::request::{Destination, RequestInit}; use crate::platform::font_context::FontContextHandle; use crate::platform::font_list::SANS_SERIF_FONT_FAMILY; use crate::platform::font_list::for_each_available_family; use crate::platform::font_list::for_each_variation; use crate::platform::font_list::system_default_family; use crate::platform::font_template::FontTemplateData; +use fontsan; +use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; +use net_traits::{CoreResourceThread, FetchResponseMsg, fetch_async}; +use net_traits::request::{Destination, RequestInit}; use servo_atoms::Atom; use servo_url::ServoUrl; use std::{fmt, f32, mem, thread}; diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 7356edaa4a6..e2f332e028c 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -3,13 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use fnv::FnvHasher; use crate::font::{Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef}; use crate::font_cache_thread::FontTemplateInfo; use crate::font_template::FontTemplateDescriptor; -use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use crate::platform::font::FontHandle; pub use crate::platform::font_context::FontContextHandle; +use fnv::FnvHasher; +use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use servo_arc::Arc; use std::cell::RefCell; use std::collections::HashMap; diff --git a/components/gfx/platform/freetype/android/font_list.rs b/components/gfx/platform/freetype/android/font_list.rs index 940283c55c5..ef4a0612f24 100644 --- a/components/gfx/platform/freetype/android/font_list.rs +++ b/components/gfx/platform/freetype/android/font_list.rs @@ -2,11 +2,11 @@ * 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 crate::text::util::is_cjk; use std::cell::RefCell; use std::fs::File; use std::io::{self, Read}; use std::path::Path; -use crate::text::util::is_cjk; use ucd::{Codepoint, UnicodeBlock}; use xml5ever::Attribute; use xml5ever::driver::parse_document; diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index b3762b26fe7..4ce38aa96d5 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -5,6 +5,10 @@ use app_units::Au; use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN}; +use crate::platform::font_context::FontContextHandle; +use crate::platform::font_template::FontTemplateData; +use crate::text::glyph::GlyphId; +use crate::text::util::fixed_to_float; use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face}; use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec}; use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name}; @@ -16,8 +20,6 @@ use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector}; use freetype::freetype::FT_Sfnt_Tag; use freetype::succeeded; use freetype::tt_os2::TT_OS2; -use crate::platform::font_context::FontContextHandle; -use crate::platform::font_template::FontTemplateData; use servo_atoms::Atom; use std::{mem, ptr}; use std::ffi::CString; @@ -27,8 +29,6 @@ use style::computed_values::font_stretch::T as FontStretch; use style::computed_values::font_weight::T as FontWeight; use style::values::computed::font::FontStyle; use super::c_str_to_string; -use crate::text::glyph::GlyphId; -use crate::text::util::fixed_to_float; // This constant is not present in the freetype // bindings due to bindgen not handling the way diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index 378f2f1944c..71b7e9bc4e0 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -2,6 +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 crate::text::util::is_cjk; use fontconfig::fontconfig::{FcChar8, FcResultMatch, FcSetSystem}; use fontconfig::fontconfig::{FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute}; use fontconfig::fontconfig::{FcDefaultSubstitute, FcFontMatch, FcNameParse, FcPatternGetString}; @@ -13,7 +14,6 @@ use libc::{c_char, c_int}; use std::ffi::CString; use std::ptr; use super::c_str_to_string; -use crate::text::util::is_cjk; static FC_FAMILY: &'static [u8] = b"family\0"; static FC_FILE: &'static [u8] = b"file\0"; diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index 6e0bb05c1ef..b9570da0760 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -17,12 +17,12 @@ use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag use crate::font::{GPOS, GSUB, KERN}; use crate::platform::font_template::FontTemplateData; use crate::platform::macos::font_context::FontContextHandle; +use crate::text::glyph::GlyphId; use servo_atoms::Atom; use std::{fmt, ptr}; use std::ops::Range; use std::sync::Arc; use style::values::computed::font::{FontStretch, FontStyle, FontWeight}; -use crate::text::glyph::GlyphId; const KERN_PAIR_LEN: usize = 6; diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs index d9f80de1103..a85c8383f5f 100644 --- a/components/gfx/platform/windows/font.rs +++ b/components/gfx/platform/windows/font.rs @@ -7,14 +7,15 @@ // renderer moves to a sandboxed process. use app_units::Au; -use dwrote; -use dwrote::{Font, FontFace, FontFile}; -use dwrote::{FontStretch, FontStyle}; use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; use crate::font::{FontTableTag, FractionalPixel}; use crate::platform::font_template::FontTemplateData; use crate::platform::windows::font_context::FontContextHandle; use crate::platform::windows::font_list::font_from_atom; +use crate::text::glyph::GlyphId; +use dwrote; +use dwrote::{Font, FontFace, FontFile}; +use dwrote::{FontStretch, FontStyle}; use servo_atoms::Atom; use std::fmt; use std::ops::Deref; @@ -25,7 +26,6 @@ use style::values::computed::font::FontStyle as StyleFontStyle; use style::values::generics::NonNegative; use style::values::generics::font::FontStyle as GenericFontStyle; use style::values::specified::font::FontStretchKeyword; -use crate::text::glyph::GlyphId; use truetype; // 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs index 44a3f3704d7..21e47aa76e6 100644 --- a/components/gfx/platform/windows/font_list.rs +++ b/components/gfx/platform/windows/font_list.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 crate::text::util::unicode_plane; use dwrote::{Font, FontDescriptor, FontCollection}; use servo_atoms::Atom; use std::collections::HashMap; use std::sync::Mutex; use std::sync::atomic::{Ordering, AtomicUsize}; -use crate::text::util::unicode_plane; use ucd::{Codepoint, UnicodeBlock}; lazy_static! { diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index dc25783cb11..343c27c63c9 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -5,7 +5,6 @@ #![allow(unsafe_code)] use app_units::Au; -use euclid::Point2D; use crate::font::{ShapingFlags, Font, FontTableMethods, FontTableTag, ShapingOptions, KERN}; use crate::harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; use crate::harfbuzz::{hb_blob_create, hb_face_create_for_tables}; @@ -34,11 +33,12 @@ use crate::harfbuzz::hb_font_set_scale; use crate::harfbuzz::hb_glyph_info_t; use crate::harfbuzz::hb_glyph_position_t; use crate::platform::font::FontTable; -use std::{char, cmp, ptr}; -use std::os::raw::{c_char, c_int, c_uint, c_void}; use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::shaping::ShaperMethods; use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; +use euclid::Point2D; +use std::{char, cmp, ptr}; +use std::os::raw::{c_char, c_int, c_uint, c_void}; const NO_GLYPH: i32 = -1; const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a'); diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index c97575bf636..7a6e6623b9c 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -6,13 +6,13 @@ use app_units::Au; use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags}; use crate::font::{RunMetrics, ShapingOptions}; use crate::platform::font_template::FontTemplateData; +use crate::text::glyph::{ByteIndex, GlyphStore}; use range::Range; use std::cell::Cell; use std::cmp::{Ordering, max}; use std::slice::Iter; use std::sync::Arc; use style::str::char_is_whitespace; -use crate::text::glyph::{ByteIndex, GlyphStore}; use unicode_bidi as bidi; use webrender_api; use xi_unicode::LineBreakLeafIter; diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 305aef2cf96..c9c83744361 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -7,10 +7,10 @@ use crate::context::LayoutContext; use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, GetBaseFlow}; +use crate::opaque_node::OpaqueNodeMethods; use fxhash::FxHashMap; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use crate::opaque_node::OpaqueNodeMethods; use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::UntrustedNodeAddress; use servo_channel::Receiver; diff --git a/components/layout/block.rs b/components/layout/block.rs index 01025c22513..76fb026ae0b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -31,17 +31,18 @@ use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags}; use crate::display_list::StackingContextCollectionState; use crate::display_list::items::DisplayListSection; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo}; use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow}; use crate::flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags}; use crate::flow_list::FlowList; use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags}; -use gfx_traits::print_tree::PrintTree; use crate::incremental::RelayoutMode; use crate::layout_debug; use crate::model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto}; use crate::sequential; +use crate::traversal::PreorderFlowTraversal; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use servo_geometry::MaxRect; use std::cmp::{max, min}; @@ -59,7 +60,6 @@ use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrAuto; -use crate::traversal::PreorderFlowTraversal; /// Information specific to floated blocks. #[derive(Clone, Serialize)] diff --git a/components/layout/construct.rs b/components/layout/construct.rs index ef1f0fbb7bb..b06e80bdd61 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -30,6 +30,16 @@ use crate::linked_list::prepend_from; use crate::list_item::{ListItemFlow, ListStyleTypeContent}; use crate::multicol::{MulticolColumnFlow, MulticolFlow}; use crate::parallel; +use crate::table::TableFlow; +use crate::table_caption::TableCaptionFlow; +use crate::table_cell::TableCellFlow; +use crate::table_colgroup::TableColGroupFlow; +use crate::table_row::TableRowFlow; +use crate::table_rowgroup::TableRowGroupFlow; +use crate::table_wrapper::TableWrapperFlow; +use crate::text::TextRunScanner; +use crate::traversal::PostorderNodeMutTraversal; +use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers}; use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use servo_config::opts; @@ -53,16 +63,6 @@ use style::selector_parser::{PseudoElement, RestyleDamage}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::generics::counters::ContentItem; use style::values::generics::url::UrlOrNone as ImageUrlOrNone; -use crate::table::TableFlow; -use crate::table_caption::TableCaptionFlow; -use crate::table_cell::TableCellFlow; -use crate::table_colgroup::TableColGroupFlow; -use crate::table_row::TableRowFlow; -use crate::table_rowgroup::TableRowGroupFlow; -use crate::table_wrapper::TableWrapperFlow; -use crate::text::TextRunScanner; -use crate::traversal::PostorderNodeMutTraversal; -use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers}; /// The results of flow construction for a DOM node. #[derive(Clone)] diff --git a/components/layout/context.rs b/components/layout/context.rs index be3f3e41ff2..134a3cedec1 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -5,6 +5,7 @@ //! Data needed by the layout thread. use crate::display_list::items::{WebRenderImageInfo, OpaqueNode}; +use crate::opaque_node::OpaqueNodeMethods; use fnv::FnvHasher; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; @@ -12,7 +13,6 @@ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use msg::constellation_msg::PipelineId; use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; -use crate::opaque_node::OpaqueNodeMethods; use parking_lot::RwLock; use script_layout_interface::{PendingImage, PendingImageState}; use script_traits::Painter; diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs index a6f4c1f92a0..23e519f1c1d 100644 --- a/components/layout/display_list/background.rs +++ b/components/layout/display_list/background.rs @@ -6,8 +6,8 @@ use app_units::Au; use crate::display_list::border; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use crate::model::MaybeAuto; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use style::computed_values::background_attachment::single_value::T as BackgroundAttachment; use style::computed_values::background_clip::single_value::T as BackgroundClip; use style::computed_values::background_origin::single_value::T as BackgroundOrigin; diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index e6a58d76272..2d99900eac2 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -9,8 +9,8 @@ //! paint. use app_units::{Au, AU_PER_PX}; -use crate::block::BlockFlow; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; +use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::ToLayout; use crate::display_list::background::{self, get_cyclic}; @@ -24,20 +24,21 @@ use crate::display_list::items::{IframeDisplayItem, OpaqueNode}; use crate::display_list::items::{PopAllTextShadowsDisplayItem, PushTextShadowDisplayItem}; use crate::display_list::items::{StackingContext, StackingContextType, StickyFrameData}; use crate::display_list::items::{TextOrientation, WebRenderImageInfo}; -use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D, Vector2D}; use crate::flex::FlexFlow; use crate::flow::{BaseFlow, Flow, FlowFlags}; use crate::flow_ref::FlowRef; -use fnv::FnvHashMap; use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo}; use crate::fragment::SpecificFragmentInfo; +use crate::inline::{InlineFlow, InlineFragmentNodeFlags}; +use crate::list_item::ListItemFlow; +use crate::model::MaybeAuto; +use crate::table_cell::CollapsedBordersForCell; +use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D, Vector2D}; +use fnv::FnvHashMap; use gfx::text::TextRun; use gfx::text::glyph::ByteIndex; use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId}; -use crate::inline::{InlineFlow, InlineFragmentNodeFlags}; use ipc_channel::ipc; -use crate::list_item::ListItemFlow; -use crate::model::MaybeAuto; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::UsePlaceholder; use range::Range; @@ -65,7 +66,6 @@ use style::values::generics::ui::Cursor; use style_traits::CSSPixel; use style_traits::ToCss; use style_traits::cursor::CursorKind; -use crate::table_cell::CollapsedBordersForCell; use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF}; use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LayoutRect}; use webrender_api::{LayoutSize, LayoutTransform, LayoutVector2D, LineStyle, NinePatchBorder}; diff --git a/components/layout/flex.rs b/components/layout/flex.rs index d7f39bdd3ce..3ccbb59a4b4 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -9,13 +9,14 @@ use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseF use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding}; use crate::display_list::StackingContextCollectionState; -use euclid::Point2D; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, FlowFlags}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::model::{AdjoiningMargins, CollapsibleMargins}; use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint}; +use crate::traversal::PreorderFlowTraversal; +use euclid::Point2D; use std::cmp::{max, min}; use std::ops::Range; use style::computed_values::align_content::T as AlignContent; @@ -29,7 +30,6 @@ use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use style::values::computed::flex::FlexBasis; use style::values::generics::flex::FlexBasis as GenericFlexBasis; -use crate::traversal::PreorderFlowTraversal; /// The size of an axis. May be a specified size, a min/max /// constraint, or an unlimited size diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 7faca7d5eb8..aa6b1b1e79d 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -30,18 +30,25 @@ use crate::block::{BlockFlow, FormattingContextType}; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::display_list::items::ClippingAndScrolling; -use euclid::{Point2D, Vector2D, Rect, Size2D}; use crate::flex::FlexFlow; use crate::floats::{Floats, SpeculatedFloatPlacement}; use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; use crate::flow_ref::{FlowRef, WeakFlowRef}; use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::StackingContextId; -use gfx_traits::print_tree::PrintTree; use crate::inline::InlineFlow; use crate::model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo}; use crate::multicol::MulticolFlow; use crate::parallel::FlowParallelInfo; +use crate::table::TableFlow; +use crate::table_caption::TableCaptionFlow; +use crate::table_cell::TableCellFlow; +use crate::table_colgroup::TableColGroupFlow; +use crate::table_row::TableRowFlow; +use crate::table_rowgroup::TableRowGroupFlow; +use crate::table_wrapper::TableWrapperFlow; +use euclid::{Point2D, Vector2D, Rect, Size2D}; +use gfx_traits::StackingContextId; +use gfx_traits::print_tree::PrintTree; use serde::ser::{Serialize, SerializeStruct, Serializer}; use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect}; use std::fmt; @@ -60,13 +67,6 @@ use style::properties::ComputedValues; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::LengthOrPercentageOrAuto; -use crate::table::TableFlow; -use crate::table_caption::TableCaptionFlow; -use crate::table_cell::TableCellFlow; -use crate::table_colgroup::TableColGroupFlow; -use crate::table_row::TableRowFlow; -use crate::table_rowgroup::TableRowGroupFlow; -use crate::table_wrapper::TableWrapperFlow; use webrender_api::LayoutTransform; /// This marker trait indicates that a type is a struct with `#[repr(C)]` whose first field diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 3eeae6fac55..7774a4a9014 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -4,27 +4,30 @@ //! The `Fragment` type, which represents the leaves of the layout tree. -use crate::ServoArc; use app_units::Au; use canvas_traits::canvas::{CanvasMsg, CanvasId}; +use crate::ServoArc; use crate::context::{LayoutContext, with_thread_local_font_context}; use crate::display_list::ToLayout; use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode}; -use euclid::{Point2D, Vector2D, Rect, Size2D}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; use crate::flow_ref::FlowRef; -use gfx; -use gfx::text::glyph::ByteIndex; -use gfx::text::text_run::{TextRun, TextRunSlice}; -use gfx_traits::StackingContextId; use crate::inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo}; use crate::inline::{InlineMetrics, LineMetrics}; -use ipc_channel::ipc::IpcSender; #[cfg(debug_assertions)] use crate::layout_debug; use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint}; use crate::model::style_length; +use crate::text; +use crate::text::TextRunScanner; +use crate::wrapper::ThreadSafeLayoutNodeHelpers; +use euclid::{Point2D, Vector2D, Rect, Size2D}; +use gfx; +use gfx::text::glyph::ByteIndex; +use gfx::text::text_run::{TextRun, TextRunSlice}; +use gfx_traits::StackingContextId; +use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; @@ -60,10 +63,7 @@ use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAu use style::values::computed::counters::ContentItem; use style::values::generics::box_::{Perspective, VerticalAlign}; use style::values::generics::transform; -use crate::text; -use crate::text::TextRunScanner; use webrender_api::{self, LayoutTransform}; -use crate::wrapper::ThreadSafeLayoutNodeHelpers; // From gfxFontConstants.h in Firefox. static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20; diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 35ce85148d8..f7a2836e036 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -12,6 +12,8 @@ use crate::context::{LayoutContext, with_thread_local_font_context}; use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; use crate::fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; +use crate::text::TextRunScanner; +use crate::traversal::InorderFlowTraversal; use script_layout_interface::wrapper_traits::PseudoElementType; use smallvec::SmallVec; use std::collections::{HashMap, LinkedList}; @@ -21,8 +23,6 @@ use style::properties::ComputedValues; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::generics::counters::ContentItem; -use crate::text::TextRunScanner; -use crate::traversal::InorderFlowTraversal; // Decimal styles per CSS-COUNTER-STYLES § 6.1: static DECIMAL: [char; 10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 7e49850d19f..8093f3c9eeb 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -2,14 +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 crate::ServoArc; use app_units::{Au, MIN_AU}; +use crate::ServoArc; use crate::block::AbsoluteAssignBSizesTraversal; use crate::context::{LayoutContext, LayoutFontContext}; use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding}; use crate::display_list::StackingContextCollectionState; use crate::display_list::items::OpaqueNode; -use euclid::{Point2D, Size2D}; use crate::floats::{FloatKind, Floats, PlacementInfo}; use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag}; use crate::flow::{FlowFlags, EarlyAbsolutePositionInfo, GetBaseFlow, OpaqueFlow}; @@ -17,10 +16,13 @@ use crate::flow_ref::FlowRef; use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; use crate::fragment::FragmentFlags; use crate::fragment::SpecificFragmentInfo; -use gfx::font::FontMetrics; -use gfx_traits::print_tree::PrintTree; use crate::layout_debug; use crate::model::IntrinsicISizesContribution; +use crate::text; +use crate::traversal::PreorderFlowTraversal; +use euclid::{Point2D, Size2D}; +use gfx::font::FontMetrics; +use gfx_traits::print_tree::PrintTree; use range::{Range, RangeIndex}; use script_layout_interface::wrapper_traits::PseudoElementType; use std::{fmt, i32, isize, mem}; @@ -39,8 +41,6 @@ use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::box_::VerticalAlign; use style::values::generics::box_::VerticalAlign as GenericVerticalAlign; use style::values::specified::text::TextOverflowSide; -use crate::text; -use crate::traversal::PreorderFlowTraversal; use unicode_bidi as bidi; /// `Line`s are represented as offsets into the child list, rather than diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index f62ce1a4d0a..002651918f3 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -10,13 +10,13 @@ use crate::block::BlockFlow; use crate::context::{LayoutContext, with_thread_local_font_context}; use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding}; use crate::display_list::StackingContextCollectionState; -use euclid::Point2D; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, OpaqueFlow}; use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo}; use crate::fragment::Overflow; use crate::generated_content; use crate::inline::InlineFlow; +use euclid::Point2D; use style::computed_values::list_style_type::T as ListStyleType; use style::computed_values::position::T as Position; use style::logical_geometry::LogicalSize; diff --git a/components/layout/model.rs b/components/layout/model.rs index 59065300c4d..c33c21a49b9 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -5,8 +5,8 @@ //! Borders, padding, and margins. use app_units::Au; -use euclid::SideOffsets2D; use crate::fragment::Fragment; +use euclid::SideOffsets2D; use std::cmp::{max, min}; use std::fmt; use style::logical_geometry::{LogicalMargin, WritingMode}; diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 0693fac63dd..4344ffa531b 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -4,15 +4,15 @@ //! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/ -use crate::ServoArc; use app_units::Au; +use crate::ServoArc; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; -use euclid::{Point2D, Vector2D}; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, OpaqueFlow, FragmentationContext, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; +use euclid::{Point2D, Vector2D}; use gfx_traits::print_tree::PrintTree; use std::cmp::{min, max}; use std::fmt; diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index f6aa6e85050..1587e957007 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -12,6 +12,8 @@ use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::flow::{Flow, GetBaseFlow}; use crate::flow_ref::FlowRef; +use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes}; +use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal}; use profile_traits::time::{self, TimerMetadata, profile}; use rayon; use servo_config::opts; @@ -19,8 +21,6 @@ use smallvec::SmallVec; use std::mem; use std::ptr; use std::sync::atomic::{AtomicIsize, Ordering}; -use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes}; -use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal}; /// Traversal chunk size. const CHUNK_SIZE: usize = 16; diff --git a/components/layout/query.rs b/components/layout/query.rs index c2fb8e61004..eb94e9c0449 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -9,13 +9,15 @@ use crate::construct::ConstructionResult; use crate::context::LayoutContext; use crate::display_list::IndexableText; use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap}; -use euclid::{Point2D, Vector2D, Rect, Size2D}; use crate::flow::{Flow, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use crate::inline::InlineFragmentNodeFlags; +use crate::opaque_node::OpaqueNodeMethods; +use crate::sequential; +use crate::wrapper::LayoutNodeLayoutData; +use euclid::{Point2D, Vector2D, Rect, Size2D}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use crate::opaque_node::OpaqueNodeMethods; use script_layout_interface::{LayoutElementType, LayoutNodeType}; use script_layout_interface::StyleData; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; @@ -25,7 +27,6 @@ use script_layout_interface::rpc::TextIndexResponse; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use script_traits::LayoutMsg as ConstellationMsg; use script_traits::UntrustedNodeAddress; -use crate::sequential; use std::cmp::{min, max}; use std::ops::Deref; use std::sync::{Arc, Mutex}; @@ -39,7 +40,6 @@ use style::properties::{style_structs, PropertyId, PropertyDeclarationId, Longha use style::selector_parser::PseudoElement; use style_traits::ToCss; use webrender_api::ExternalScrollId; -use crate::wrapper::LayoutNodeLayoutData; /// Mutable data belonging to the LayoutThread. /// diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 2d6d90de75c..b35bba206b2 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -7,16 +7,16 @@ use app_units::Au; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; -use euclid::{Point2D, Vector2D}; use crate::floats::SpeculatedFloatPlacement; use crate::flow::{Flow, ImmutableFlowUtils, FlowFlags, GetBaseFlow}; use crate::fragment::{FragmentBorderBoxIterator, CoordinateSystem}; use crate::generated_content::ResolveGeneratedContent; use crate::incremental::RelayoutMode; -use servo_config::opts; -use style::servo::restyle_damage::ServoRestyleDamage; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList}; use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal}; +use euclid::{Point2D, Vector2D}; +use servo_config::opts; +use style::servo::restyle_damage::ServoRestyleDamage; use webrender_api::LayoutPoint; pub fn resolve_generated_content(root: &mut Flow, layout_context: &LayoutContext) { diff --git a/components/layout/table.rs b/components/layout/table.rs index 4551b85b110..f167f74911e 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -10,13 +10,17 @@ use crate::block::{ISizeConstraintInput, ISizeConstraintSolution}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState}; -use euclid::Point2D; use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; use crate::flow_list::{FlowListIterator, MutFlowListIterator}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::print_tree::PrintTree; use crate::layout_debug; use crate::model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto}; +use crate::table_cell::TableCellFlow; +use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance}; +use crate::table_row::{TableRowFlow, TableRowSizeData}; +use crate::table_wrapper::TableLayout; +use euclid::Point2D; +use gfx_traits::print_tree::PrintTree; use std::{cmp, fmt}; use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::context::SharedStyleContext; @@ -26,10 +30,6 @@ use style::properties::style_structs::Background; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; -use crate::table_cell::TableCellFlow; -use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance}; -use crate::table_row::{TableRowFlow, TableRowSizeData}; -use crate::table_wrapper::TableLayout; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableFlow {} diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 2c43583cbce..a9d9660144f 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -9,9 +9,9 @@ use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use euclid::Point2D; use crate::flow::{Flow, FlowClass, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; +use euclid::Point2D; use gfx_traits::print_tree::PrintTree; use std::fmt; use style::logical_geometry::LogicalSize; diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index be45f638228..e94ecba71dd 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -9,12 +9,14 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::print_tree::PrintTree; use crate::layout_debug; use crate::model::MaybeAuto; +use crate::table::InternalTable; +use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance}; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use gfx_traits::print_tree::PrintTree; use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use std::fmt; use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; @@ -22,8 +24,6 @@ use style::properties::ComputedValues; use style::values::computed::Color; use style::values::generics::box_::VerticalAlign; use style::values::specified::BorderStyle; -use crate::table::InternalTable; -use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance}; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableCellFlow {} diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index aa897fccbea..d1347ef4cce 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -7,10 +7,10 @@ use app_units::Au; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; -use euclid::Point2D; use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; +use euclid::Point2D; use std::fmt; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 615f11bfed2..15d660098bf 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -9,13 +9,15 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use euclid::Point2D; use crate::flow::{EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; use crate::flow_list::MutFlowListIterator; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::print_tree::PrintTree; use crate::layout_debug; use crate::model::MaybeAuto; +use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; +use crate::table_cell::{CollapsedBordersForCell, TableCellFlow}; +use euclid::Point2D; +use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use std::cmp::max; use std::fmt; @@ -26,8 +28,6 @@ use style::computed_values::border_top_style::T as BorderStyle; use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode}; use style::properties::ComputedValues; use style::values::computed::{Color, LengthOrPercentageOrAuto}; -use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; -use crate::table_cell::{CollapsedBordersForCell, TableCellFlow}; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableRowFlow {} diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 55d23b2b55e..703bd9217a0 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -9,18 +9,18 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use euclid::Point2D; use crate::flow::{Flow, FlowClass, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::print_tree::PrintTree; use crate::layout_debug; +use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; +use euclid::Point2D; +use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use std::fmt; use std::iter::{IntoIterator, Iterator, Peekable}; use style::computed_values::{border_collapse, border_spacing}; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; -use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableRowGroupFlow {} diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index d9792bb2992..0d1596d9c85 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -17,12 +17,13 @@ use crate::block::{ISizeConstraintSolution, MarginsMayCollapseFlag}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags}; use crate::display_list::StackingContextCollectionState; -use euclid::Point2D; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use gfx_traits::print_tree::PrintTree; use crate::model::MaybeAuto; +use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; +use euclid::Point2D; +use gfx_traits::print_tree::PrintTree; use std::cmp::{max, min}; use std::fmt; use std::ops::Add; @@ -32,7 +33,6 @@ use style::logical_geometry::{LogicalRect, LogicalSize}; use style::properties::ComputedValues; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; -use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; #[derive(Clone, Copy, Debug, Serialize)] pub enum TableLayout { diff --git a/components/layout/text.rs b/components/layout/text.rs index 2eb1945c6fe..358a386d887 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -8,12 +8,12 @@ use app_units::Au; use crate::context::LayoutFontContext; use crate::fragment::{Fragment, ScannedTextFlags}; use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; +use crate::inline::{InlineFragmentNodeFlags, InlineFragments}; +use crate::linked_list::split_off_head; use gfx::font::{FontRef, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; -use crate::inline::{InlineFragmentNodeFlags, InlineFragments}; -use crate::linked_list::split_off_head; use ordered_float::NotNan; use range::Range; use servo_atoms::Atom; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 21ebb2f1b56..c18eeae5112 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -8,6 +8,8 @@ use crate::construct::FlowConstructor; use crate::context::LayoutContext; use crate::display_list::DisplayListBuildState; use crate::flow::{FlowFlags, Flow, GetBaseFlow, ImmutableFlowUtils}; +use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; +use crate::wrapper::ThreadSafeLayoutNodeHelpers; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode}; use servo_config::opts; use style::context::{SharedStyleContext, StyleContext}; @@ -17,8 +19,6 @@ use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::traversal::{DomTraversal, recalc_style_at}; use style::traversal::PerLevelTraversalData; -use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; -use crate::wrapper::ThreadSafeLayoutNodeHelpers; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 823046d6cfa..9ce078799f1 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -4,11 +4,12 @@ use crate::blob_loader::load_blob_sync; use crate::data_loader::decode; -use devtools_traits::DevtoolsControlMsg; use crate::fetch::cors_cache::CorsCache; use crate::filemanager_thread::FileManager; use crate::http_loader::{HttpState, determine_request_referrer, http_fetch}; use crate::http_loader::{set_default_accept, set_default_accept_language}; +use crate::subresource_integrity::is_response_integrity_valid; +use devtools_traits::DevtoolsControlMsg; use headers_core::HeaderMapExt; use headers_ext::{AccessControlExposeHeaders, ContentType, Range}; use http::header::{self, HeaderMap, HeaderName, HeaderValue}; @@ -32,7 +33,6 @@ use std::str; use std::sync::{Arc, Mutex}; use std::sync::atomic::Ordering; use std::thread; -use crate::subresource_integrity::is_response_integrity_valid; lazy_static! { static ref X_CONTENT_TYPE_OPTIONS: HeaderName = diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 3b47a21c4cc..10fccc3561b 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -7,14 +7,15 @@ use bytes::Bytes; use crate::connector::{BUF_SIZE, Connector, create_http_client, WrappedBody}; use crate::cookie; use crate::cookie_storage::CookieStorage; -use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest}; -use devtools_traits::{HttpResponse as DevtoolsHttpResponse, NetworkEvent}; use crate::fetch::cors_cache::CorsCache; use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target}; use crate::fetch::methods::{is_cors_safelisted_request_header, is_cors_safelisted_method, main_fetch}; -use flate2::read::{DeflateDecoder, GzDecoder}; use crate::hsts::HstsList; use crate::http_cache::HttpCache; +use crate::resource_thread::AuthCache; +use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest}; +use devtools_traits::{HttpResponse as DevtoolsHttpResponse, NetworkEvent}; +use flate2::read::{DeflateDecoder, GzDecoder}; use headers_core::HeaderMapExt; use headers_ext::{AccessControlAllowCredentials, AccessControlAllowHeaders}; use headers_ext::{AccessControlAllowMethods, AccessControlRequestHeaders, AccessControlRequestMethod, Authorization}; @@ -36,7 +37,6 @@ use net_traits::request::{RedirectMode, Referrer, Request, RequestMode}; use net_traits::request::{ResponseTainting, ServiceWorkersMode}; use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType}; use openssl::ssl::SslConnectorBuilder; -use crate::resource_thread::AuthCache; use servo_channel::{channel, Sender}; use servo_url::{ImmutableOrigin, ServoUrl}; use std::collections::{HashMap, HashSet}; diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 7e11859828c..6c4cc78479a 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -7,15 +7,17 @@ use crate::connector::{create_http_client, create_ssl_connector_builder}; use crate::cookie; use crate::cookie_rs; use crate::cookie_storage::CookieStorage; -use devtools_traits::DevtoolsControlMsg; -use embedder_traits::EmbedderProxy; -use embedder_traits::resources::{self, Resource}; use crate::fetch::cors_cache::CorsCache; use crate::fetch::methods::{CancellationListener, FetchContext, fetch}; use crate::filemanager_thread::FileManager; use crate::hsts::HstsList; use crate::http_cache::HttpCache; use crate::http_loader::{HANDLE, HttpState, http_redirect_fetch}; +use crate::storage_thread::StorageThreadFactory; +use crate::websocket_loader; +use devtools_traits::DevtoolsControlMsg; +use embedder_traits::EmbedderProxy; +use embedder_traits::resources::{self, Resource}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcReceiver, IpcReceiverSet, IpcSender}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; @@ -44,8 +46,6 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex, RwLock}; use std::thread; -use crate::storage_thread::StorageThreadFactory; -use crate::websocket_loader; /// Returns a tuple of (public, private) senders to the new threads. pub fn new_resource_threads( diff --git a/components/net/storage_thread.rs b/components/net/storage_thread.rs index b901c717931..48a5043a994 100644 --- a/components/net/storage_thread.rs +++ b/components/net/storage_thread.rs @@ -2,9 +2,9 @@ * 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 crate::resource_thread; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; -use crate::resource_thread; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::collections::BTreeMap; diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs index bd24b873352..aba99c2fdd4 100644 --- a/components/net/tests/fetch.rs +++ b/components/net/tests/fetch.rs @@ -3,10 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::{DEFAULT_USER_AGENT, new_fetch_context, create_embedder_proxy, fetch, make_server, make_ssl_server}; -use devtools_traits::HttpRequest as DevtoolsHttpRequest; -use devtools_traits::HttpResponse as DevtoolsHttpResponse; use crate::fetch_with_context; use crate::fetch_with_cors_cache; +use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response}; +use devtools_traits::HttpRequest as DevtoolsHttpRequest; +use devtools_traits::HttpResponse as DevtoolsHttpResponse; use headers_core::HeaderMapExt; use headers_ext::{AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowOrigin}; use headers_ext::{AccessControlAllowMethods, AccessControlMaxAge}; @@ -14,7 +15,6 @@ use headers_ext::{CacheControl, ContentLength, ContentType, Expires, Host, LastM use http::{Method, StatusCode}; use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::uri::Authority; -use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response}; use hyper::{Request as HyperRequest, Response as HyperResponse}; use hyper::body::Body; use mime::{self, Mime}; diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index 25ed6f0e094..545716789fe 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -3,11 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::cookie_rs::Cookie as CookiePair; +use crate::fetch; +use crate::fetch_with_context; +use crate::make_server; +use crate::new_fetch_context; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent}; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; -use crate::fetch; -use crate::fetch_with_context; use flate2::Compression; use flate2::write::{DeflateEncoder, GzEncoder}; use futures::{self, Future, Stream}; @@ -19,7 +21,6 @@ use http::header::{self, HeaderMap, HeaderValue}; use http::uri::Authority; use hyper::{Request as HyperRequest, Response as HyperResponse}; use hyper::body::Body; -use crate::make_server; use msg::constellation_msg::TEST_PIPELINE_ID; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; @@ -28,7 +29,6 @@ use net::test::replace_host_table; use net_traits::{CookieSource, NetworkError}; use net_traits::request::{Request, RequestInit, RequestMode, CredentialsMode, Destination}; use net_traits::response::ResponseBody; -use crate::new_fetch_context; use servo_channel::{channel, Receiver}; use servo_url::{ServoUrl, ImmutableOrigin}; use std::collections::HashMap; diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs index 0dc0632d7ed..c37555afcb5 100644 --- a/components/net/websocket_loader.rs +++ b/components/net/websocket_loader.rs @@ -4,11 +4,11 @@ use crate::connector::create_ssl_connector_builder; use crate::cookie::Cookie; -use embedder_traits::resources::{self, Resource}; use crate::fetch::methods::should_be_blocked_due_to_bad_port; -use headers_ext::Host; use crate::hosts::replace_host; use crate::http_loader::HttpState; +use embedder_traits::resources::{self, Resource}; +use headers_ext::Host; use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::uri::Authority; use ipc_channel::ipc::{IpcReceiver, IpcSender}; diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 5d863cfa4bf..e1ccf625789 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.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 ipc_channel::ipc::IpcSharedMemory; use crate::piston_image::{self, DynamicImage, ImageFormat}; +use ipc_channel::ipc::IpcSharedMemory; use pixels; use std::fmt; use webrender_api; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index c839ab11451..e766bee302c 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -36,6 +36,9 @@ extern crate webrender_api; use crate::cookie_rs::Cookie; use crate::filemanager_thread::FileManagerThreadMsg; +use crate::request::{Request, RequestInit}; +use crate::response::{HttpsState, Response, ResponseInit}; +use crate::storage_thread::StorageThreadMsg; use headers_core::HeaderMapExt; use headers_ext::{ContentType, ReferrerPolicy as ReferrerPolicyHeader}; use http::{Error as HttpError, HeaderMap}; @@ -47,11 +50,8 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use mime::Mime; use msg::constellation_msg::HistoryStateId; -use crate::request::{Request, RequestInit}; -use crate::response::{HttpsState, Response, ResponseInit}; use servo_url::ServoUrl; use std::error::Error; -use crate::storage_thread::StorageThreadMsg; use url::percent_encoding; pub mod blob_url_store; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index e1354ab1eb4..83756722e61 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -4,6 +4,7 @@ //! Memory profiling functions. +use crate::time::duration_from_seconds; use ipc_channel::ipc::{self, IpcReceiver}; use ipc_channel::router::ROUTER; use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest}; @@ -13,7 +14,6 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::thread; use std::time::Instant; -use crate::time::duration_from_seconds; pub struct Profiler { /// The port through which messages are received. diff --git a/components/profile/time.rs b/components/profile/time.rs index 7380ae7de04..2738e21c198 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -5,6 +5,8 @@ //! Timing functions. use crate::heartbeats; +use crate::std_time::precise_time_ns; +use crate::trace_dump::TraceDump; use influent::client::{Client, Credentials}; use influent::create_client; use influent::measurement::{Measurement, Value}; @@ -22,8 +24,6 @@ use std::fs::File; use std::io::{self, Write}; use std::path::Path; use std::time::Duration; -use crate::std_time::precise_time_ns; -use crate::trace_dump::TraceDump; use tokio; use tokio::prelude::Future; diff --git a/components/profile_traits/ipc.rs b/components/profile_traits/ipc.rs index ca86ab3c5ec..1aec4162522 100644 --- a/components/profile_traits/ipc.rs +++ b/components/profile_traits/ipc.rs @@ -3,12 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use bincode; -use ipc_channel::ipc; -use serde::{Deserialize, Serialize}; -use std::io::Error; use crate::time; use crate::time::ProfilerCategory; use crate::time::ProfilerChan; +use ipc_channel::ipc; +use serde::{Deserialize, Serialize}; +use std::io::Error; pub struct IpcReceiver<T> where diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 72afaad0e45..d0409cf5fbc 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -2,10 +2,6 @@ * 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::{AutoMargins, CachedConsoleMessage, CachedConsoleMessageTypes}; -use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError}; -use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker}; -use devtools_traits::TimelineMarkerType; use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; @@ -21,12 +17,16 @@ use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::node::{Node, window_from_node}; use crate::dom::window::Window; +use crate::script_thread::Documents; +use devtools_traits::{AutoMargins, CachedConsoleMessage, CachedConsoleMessageTypes}; +use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError}; +use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker}; +use devtools_traits::TimelineMarkerType; use ipc_channel::ipc::IpcSender; use js::jsapi::JSAutoCompartment; use js::jsval::UndefinedValue; use js::rust::wrappers::ObjectClassName; use msg::constellation_msg::PipelineId; -use crate::script_thread::Documents; use std::ffi::CStr; use std::str; use style::properties::longhands::{margin_bottom, margin_left, margin_right, margin_top}; diff --git a/components/script/dom/abstractworkerglobalscope.rs b/components/script/dom/abstractworkerglobalscope.rs index 4efc60d58c6..1ca0fdcacfd 100644 --- a/components/script/dom/abstractworkerglobalscope.rs +++ b/components/script/dom/abstractworkerglobalscope.rs @@ -2,7 +2,6 @@ * 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::DevtoolScriptControlMsg; use crate::dom::abstractworker::WorkerScriptMsg; use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::reflector::DomObject; @@ -11,8 +10,9 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::worker::TrustedWorkerAddress; use crate::dom::workerglobalscope::WorkerGlobalScope; use crate::script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort}; -use servo_channel::{Receiver, Sender}; use crate::task_queue::{QueuedTaskConversion, TaskQueue}; +use devtools_traits::DevtoolScriptControlMsg; +use servo_channel::{Receiver, Sender}; /// A ScriptChan that can be cloned freely and will silently send a TrustedWorkerAddress with /// common event loop messages. While this SendableWorkerScriptChan is alive, the associated diff --git a/components/script/dom/analysernode.rs b/components/script/dom/analysernode.rs index 48c71c456c5..88cee14c3a1 100644 --- a/components/script/dom/analysernode.rs +++ b/components/script/dom/analysernode.rs @@ -13,6 +13,7 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; +use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcReceiver}; use ipc_channel::router::ROUTER; @@ -21,7 +22,6 @@ use js::typedarray::{Float32Array, Uint8Array}; use servo_media::audio::analyser_node::AnalysisEngine; use servo_media::audio::block::Block; use servo_media::audio::node::AudioNodeInit; -use crate::task_source::{TaskSource, TaskSourceName}; #[dom_struct] pub struct AnalyserNode { diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index bf9b41034d7..b90fe33e347 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -2,7 +2,6 @@ * 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::AttrInfo; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use crate::dom::bindings::inheritance::Castable; @@ -15,9 +14,10 @@ use crate::dom::mutationobserver::{Mutation, MutationObserver}; use crate::dom::node::Node; use crate::dom::virtualmethods::vtable_for; use crate::dom::window::Window; +use crate::script_thread::ScriptThread; +use devtools_traits::AttrInfo; use dom_struct::dom_struct; use html5ever::{Prefix, LocalName, Namespace}; -use crate::script_thread::ScriptThread; use servo_atoms::Atom; use std::borrow::ToOwned; use std::cell::Ref; diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 5bf022fb96f..af7e63aa83d 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -16,10 +16,10 @@ use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::promise::Promise; use crate::dom::window::Window; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions}; use std::rc::Rc; -use crate::task_source::TaskSource; #[dom_struct] pub struct AudioContext { diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index 2f1917364ee..fa094555c1e 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * 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 crate::dom::audionode::{AudioNode, UnwrappedAudioNodeOptions}; use crate::dom::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; @@ -9,11 +10,11 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomObject; +use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit, AudioScheduledSourceNodeMessage}; use servo_media::audio::node::OnEndedCallback; use std::cell::Cell; -use crate::task_source::{TaskSource, TaskSourceName}; #[dom_struct] pub struct AudioScheduledSourceNode { diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 6a07b6b43b8..95ad60314ee 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -38,6 +38,7 @@ use crate::dom::oscillatornode::OscillatorNode; use crate::dom::pannernode::PannerNode; use crate::dom::promise::Promise; use crate::dom::window::Window; +use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBuffer; @@ -51,7 +52,6 @@ use std::collections::{HashMap, VecDeque}; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use crate::task_source::{TaskSource, TaskSourceName}; use uuid::Uuid; #[allow(dead_code)] diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index c2d0be39a44..061e74fb3cc 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -7,7 +7,7 @@ #[cfg(feature = "js_backtrace")] use backtrace::Backtrace; #[cfg(feature = "js_backtrace")] -use dom::bindings::cell::DomRefCell; +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods; use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name; use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs index 282c9e556a1..9923ad8716d 100644 --- a/components/script/dom/bindings/htmlconstructor.rs +++ b/components/script/dom/bindings/htmlconstructor.rs @@ -76,6 +76,7 @@ use crate::dom::customelementregistry::ConstructionStackEntry; use crate::dom::element::{CustomElementState, Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; use crate::dom::window::Window; +use crate::script_thread::ScriptThread; use html5ever::LocalName; use html5ever::interface::QualName; use js::glue::UnwrapObject; @@ -83,7 +84,6 @@ use js::jsapi::{CallArgs, CurrentGlobalOrNull}; use js::jsapi::{JSAutoCompartment, JSContext, JSObject}; use js::rust::HandleObject; use js::rust::MutableHandleObject; -use crate::script_thread::ScriptThread; use std::ptr; // https://html.spec.whatwg.org/multipage/#htmlconstructor diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index f74fba6355f..740cb82b520 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -28,6 +28,7 @@ use crate::dom::bindings::reflector::{DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::trace::trace_reflector; use crate::dom::promise::Promise; +use crate::task::TaskOnce; use js::jsapi::JSTracer; use libc; use std::cell::RefCell; @@ -37,7 +38,6 @@ use std::hash::Hash; use std::marker::PhantomData; use std::rc::Rc; use std::sync::{Arc, Weak}; -use crate::task::TaskOnce; #[allow(missing_docs)] // FIXME mod dummy { diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index e6758dacaf2..669f9481fb5 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -37,8 +37,6 @@ use canvas_traits::webgl::{WebGLContextShareMode, WebGLError, WebGLFramebufferId use canvas_traits::webgl::{WebGLPipeline, WebGLProgramId, WebGLReceiver, WebGLRenderbufferId}; use canvas_traits::webgl::{WebGLSLVersion, WebGLSender, WebGLShaderId, WebGLTextureId}; use canvas_traits::webgl::{WebGLVersion, WebGLVertexArrayId}; -use cssparser::RGBA; -use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::error::Error; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; @@ -49,6 +47,8 @@ use crate::dom::bindings::utils::WindowProxyHandler; use crate::dom::document::PendingRestyle; use crate::dom::htmlimageelement::SourceSet; use crate::dom::htmlmediaelement::MediaFrameRenderer; +use cssparser::RGBA; +use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use encoding_rs::{Decoder, Encoding}; use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, TypedScale}; use euclid::Length as EuclidLength; diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 1b5c911d2d5..b59c4bf49cd 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -8,8 +8,9 @@ use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence}; use bluetooth_traits::scanfilter::{RequestDeviceoptions, ServiceUUIDSequence}; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::BluetoothBinding::{self, BluetoothDataFilterInit, BluetoothLEScanFilterInit}; +use crate::dom::bindings::codegen::Bindings::BluetoothBinding::{self, BluetoothDataFilterInit}; use crate::dom::bindings::codegen::Bindings::BluetoothBinding::{BluetoothMethods, RequestDeviceOptions}; +use crate::dom::bindings::codegen::Bindings::BluetoothBinding::BluetoothLEScanFilterInit; use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::BluetoothPermissionDescriptor; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerBinding:: BluetoothRemoteGATTServerMethods; @@ -28,6 +29,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::permissions::{get_descriptor_permission_state, PermissionAlgorithm}; use crate::dom::promise::Promise; +use crate::task::TaskOnce; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; @@ -40,7 +42,6 @@ use std::collections::HashMap; use std::rc::Rc; use std::str::FromStr; use std::sync::{Arc, Mutex}; -use crate::task::TaskOnce; const KEY_CONVERSION_ERROR: &'static str = "This `manufacturerData` key can not be parsed as unsigned short:"; diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index d16662e8bd8..c3a8dfa7c4b 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -3,8 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::canvas::{CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle}; -use cssparser::{Parser, ParserInput, RGBA}; -use cssparser::Color as CSSColor; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding; use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods; @@ -14,6 +12,8 @@ use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; +use cssparser::{Parser, ParserInput, RGBA}; +use cssparser::Color as CSSColor; use dom_struct::dom_struct; // https://html.spec.whatwg.org/multipage/#canvasgradient diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 99cb8399557..817250408d2 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -6,8 +6,6 @@ use canvas_traits::canvas::{Canvas2dMsg, CanvasMsg, CanvasId}; use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule}; use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle}; use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle}; -use cssparser::{Parser, ParserInput, RGBA}; -use cssparser::Color as CSSColor; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule; @@ -30,6 +28,9 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement}; use crate::dom::imagedata::ImageData; use crate::dom::node::{Node, NodeDamage, window_from_node}; +use crate::unpremultiplytable::UNPREMULTIPLY_TABLE; +use cssparser::{Parser, ParserInput, RGBA}; +use cssparser::Color as CSSColor; use dom_struct::dom_struct; use euclid::{Transform2D, Point2D, Rect, Size2D, vec2}; use ipc_channel::ipc::{self, IpcSender}; @@ -48,7 +49,6 @@ use std::{fmt, mem}; use std::cell::Cell; use std::str::FromStr; use std::sync::Arc; -use crate::unpremultiplytable::UNPREMULTIPLY_TABLE; #[must_root] #[derive(Clone, JSTraceable, MallocSizeOf)] diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index ba8a9d45afe..18f2d64129e 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -2,11 +2,11 @@ * 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::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::workerglobalscope::WorkerGlobalScope; +use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg}; use std::io; // https://developer.mozilla.org/en-US/docs/Web/API/Console diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs index b8afe815b8e..00526a9e59f 100644 --- a/components/script/dom/create.rs +++ b/components/script/dom/create.rs @@ -78,9 +78,9 @@ use crate::dom::htmlulistelement::HTMLUListElement; use crate::dom::htmlunknownelement::HTMLUnknownElement; use crate::dom::htmlvideoelement::HTMLVideoElement; use crate::dom::svgsvgelement::SVGSVGElement; +use crate::script_thread::ScriptThread; use html5ever::{LocalName, Prefix, QualName}; use js::jsapi::JSAutoCompartment; -use crate::script_thread::ScriptThread; use servo_config::prefs::PREFS; fn create_svg_element( diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs index 123828a0690..a4539c17f76 100644 --- a/components/script/dom/css.rs +++ b/components/script/dom/css.rs @@ -2,7 +2,6 @@ * 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, ParserInput, serialize_identifier}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::Reflector; @@ -10,6 +9,7 @@ use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; use crate::dom::worklet::Worklet; +use cssparser::{Parser, ParserInput, serialize_identifier}; use dom_struct::dom_struct; use style::context::QuirksMode; use style::parser::ParserContext; diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index 82e53c06402..27280cc651e 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -2,7 +2,6 @@ * 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, ParserInput}; use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use crate::dom::bindings::error::ErrorResult; @@ -15,6 +14,7 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; use crate::dom::cssrulelist::{CSSRuleList, RulesSource}; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::window::Window; +use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index 7e15c0e9da8..fc7608a476f 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -2,7 +2,6 @@ * 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, ParserInput}; use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; @@ -14,6 +13,7 @@ use crate::dom::cssrule::SpecificCSSRule; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::medialist::MediaList; use crate::dom::window::Window; +use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::media_queries::MediaList as StyleMediaList; diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 9d3b5fed9bb..662ea8bb542 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -2,8 +2,6 @@ * 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 as CssParser, ParserInput as CssParserInput}; -use cssparser::ToCss; use crate::dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMethods}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::inheritance::Castable; @@ -14,6 +12,8 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::window::Window; +use cssparser::{Parser as CssParser, ParserInput as CssParserInput}; +use cssparser::ToCss; use dom_struct::dom_struct; use selectors::parser::SelectorList; use servo_arc::Arc; diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs index 032d6c6aced..668c8bbec98 100644 --- a/components/script/dom/cssstylevalue.rs +++ b/components/script/dom/cssstylevalue.rs @@ -2,8 +2,6 @@ * 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; -use cssparser::ParserInput; use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods; use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::Wrap; use crate::dom::bindings::reflector::Reflector; @@ -11,6 +9,8 @@ use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; +use cssparser::Parser; +use cssparser::ParserInput; use dom_struct::dom_struct; use servo_url::ServoUrl; diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index b3976bea646..17005ce0aec 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -2,7 +2,6 @@ * 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, ParserInput}; use crate::dom::bindings::codegen::Bindings::CSSSupportsRuleBinding; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; @@ -12,6 +11,7 @@ use crate::dom::cssconditionrule::CSSConditionRule; use crate::dom::cssrule::SpecificCSSRule; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::window::Window; +use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::parser::ParserContext; diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 4f53210a8c1..8a38a98dc49 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -25,6 +25,8 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{document_from_node, Node, window_from_node}; use crate::dom::promise::Promise; use crate::dom::window::Window; +use crate::microtask::Microtask; +use crate::script_thread::ScriptThread; use dom_struct::dom_struct; use html5ever::{LocalName, Namespace, Prefix}; use js::conversions::ToJSValConvertible; @@ -34,8 +36,6 @@ use js::jsapi::{JSAutoCompartment, JSContext, JSObject}; use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue}; use js::rust::{HandleObject, HandleValue, MutableHandleValue}; use js::rust::wrappers::{JS_GetProperty, Construct1, JS_SameValue}; -use crate::microtask::Microtask; -use crate::script_thread::ScriptThread; use std::cell::Cell; use std::collections::{HashMap, VecDeque}; use std::mem; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 59f0f393be8..f880d09f11d 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::devtools; -use devtools_traits::DevtoolScriptControlMsg; use crate::dom::abstractworker::{SimpleWorkerErrorHandler, WorkerScriptMsg}; use crate::dom::abstractworkerglobalscope::{SendableWorkerScriptChan, WorkerThreadWorkerChan}; use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; @@ -23,6 +22,11 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::dom::worker::{TrustedWorkerAddress, Worker}; use crate::dom::workerglobalscope::WorkerGlobalScope; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, new_rt_and_cx, Runtime}; +use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent; +use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; +use crate::task_source::TaskSourceName; +use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; @@ -33,8 +37,6 @@ use js::rust::HandleValue; use msg::constellation_msg::TopLevelBrowsingContextId; use net_traits::{IpcSend, load_whole_resource}; use net_traits::request::{CredentialsMode, Destination, RequestInit}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, new_rt_and_cx, Runtime}; -use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent; use script_traits::{TimerEvent, TimerSource, WorkerGlobalScopeInit, WorkerScriptLoadOrigin}; use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Sender, Receiver}; use servo_rand::random; @@ -44,8 +46,6 @@ use std::sync::Arc; use std::sync::atomic::AtomicBool; use std::thread; use style::thread_state::{self, ThreadState}; -use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; -use crate::task_source::TaskSourceName; /// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular /// value for the duration of this object's lifetime. This ensures that the related Worker diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index fb8e7b37bfd..9ce096e2e65 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::cookie_rs; -use devtools_traits::ScriptToDevtoolsControlMsg; use crate::document_loader::{DocumentLoader, LoadType}; use crate::dom::activation::{ActivationSource, synthetic_click_activation}; use crate::dom::attr::Attr; @@ -12,7 +11,8 @@ use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding; -use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState, ElementCreationOptions}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::ElementCreationOptions; use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; @@ -89,11 +89,16 @@ use crate::dom::virtualmethods::vtable_for; use crate::dom::webglcontextevent::WebGLContextEvent; use crate::dom::window::{ReflowReason, Window}; use crate::dom::windowproxy::WindowProxy; +use crate::fetch::FetchCanceller; +use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; +use crate::script_thread::{MainThreadScriptMsg, ScriptThread}; +use crate::task_source::{TaskSource, TaskSourceName}; +use crate::timers::OneshotTimerCallback; +use devtools_traits::ScriptToDevtoolsControlMsg; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use encoding_rs::{Encoding, UTF_8}; use euclid::Point2D; -use crate::fetch::FetchCanceller; use html5ever::{LocalName, Namespace, QualName}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; @@ -114,8 +119,6 @@ use profile_traits::ipc as profile_ipc; use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType}; use ref_slice::ref_slice; use script_layout_interface::message::{Msg, NodesFromPointQueryType, QueryMsg, ReflowGoal}; -use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; -use crate::script_thread::{MainThreadScriptMsg, ScriptThread}; use script_traits::{AnimationState, DocumentActivity, MouseButton, MouseEventType}; use script_traits::{MsDuration, ScriptMsg, TouchEventType, TouchId, UntrustedNodeAddress}; use servo_arc::Arc; @@ -141,9 +144,7 @@ use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuar use style::str::{split_html_space_chars, str_join}; use style::stylesheet_set::DocumentStylesheetSet; use style::stylesheets::{CssRule, Stylesheet, Origin, OriginSet}; -use crate::task_source::{TaskSource, TaskSourceName}; use time; -use crate::timers::OneshotTimerCallback; use url::Host; use url::percent_encoding::percent_decode; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 0cbf11fab78..2600f0cc575 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -4,7 +4,6 @@ //! Element nodes. -use devtools_traits::AttrInfo; use crate::dom::activation::Activatable; use crate::dom::attr::{Attr, AttrHelpersForLayout}; use crate::dom::bindings::cell::DomRefCell; @@ -75,6 +74,10 @@ use crate::dom::text::Text; use crate::dom::validation::Validatable; use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; use crate::dom::window::ReflowReason; +use crate::script_thread::ScriptThread; +use crate::stylesheet_loader::StylesheetOwner; +use crate::task::TaskOnce; +use devtools_traits::AttrInfo; use dom_struct::dom_struct; use html5ever::{Prefix, LocalName, Namespace, QualName}; use html5ever::serialize; @@ -87,7 +90,6 @@ use msg::constellation_msg::InputMethodType; use net_traits::request::CorsSettings; use ref_filter_map::ref_filter_map; use script_layout_interface::message::ReflowGoal; -use crate::script_thread::ScriptThread; use selectors::Element as SelectorsElement; use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity}; use selectors::matching::{ElementSelectorFlags, MatchingContext}; @@ -119,8 +121,6 @@ use style::shared_lock::{SharedRwLock, Locked}; use style::thread_state; use style::values::{CSSFloat, Either}; use style::values::{specified, computed}; -use crate::stylesheet_loader::StylesheetOwner; -use crate::task::TaskOnce; use xml5ever::serialize as xmlSerialize; use xml5ever::serialize::SerializeOpts as XmlSerializeOpts; use xml5ever::serialize::TraversalScope as XmlTraversalScope; diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 7999eed6423..d7151dbdcc1 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -2,7 +2,6 @@ * 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::{TimelineMarker, TimelineMarkerType}; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::EventBinding; @@ -19,11 +18,12 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::node::Node; use crate::dom::virtualmethods::vtable_for; use crate::dom::window::Window; +use crate::task::TaskOnce; +use devtools_traits::{TimelineMarker, TimelineMarkerType}; use dom_struct::dom_struct; use servo_atoms::Atom; use std::cell::Cell; use std::default::Default; -use crate::task::TaskOnce; use time; #[dom_struct] diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index a1869e108f0..cd2136c72fa 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -14,9 +14,12 @@ use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; +use crate::fetch::FetchCanceller; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::{TaskSource, TaskSourceName}; +use crate::timers::OneshotTimerCallback; use dom_struct::dom_struct; use euclid::Length; -use crate::fetch::FetchCanceller; use headers_ext::ContentType; use http::header::{self, HeaderName, HeaderValue}; use ipc_channel::ipc; @@ -29,15 +32,12 @@ use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata}; use net_traits::{FetchResponseMsg, FetchResponseListener, NetworkError}; use net_traits::request::{CacheMode, CorsSettings, CredentialsMode}; use net_traits::request::{RequestInit, RequestMode}; -use crate::network_listener::{NetworkListener, PreInvoke}; use servo_atoms::Atom; use servo_url::ServoUrl; use std::cell::Cell; use std::mem; use std::str::{Chars, FromStr}; use std::sync::{Arc, Mutex}; -use crate::task_source::{TaskSource, TaskSourceName}; -use crate::timers::OneshotTimerCallback; use utf8; diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index c5baeede050..885ff56901d 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -20,6 +20,9 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::progressevent::ProgressEvent; +use crate::task::TaskCanceller; +use crate::task_source::{TaskSource, TaskSourceName}; +use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource}; use dom_struct::dom_struct; use encoding_rs::{Encoding, UTF_8}; use js::jsapi::Heap; @@ -34,9 +37,6 @@ use std::cell::Cell; use std::ptr; use std::sync::Arc; use std::thread; -use crate::task::TaskCanceller; -use crate::task_source::{TaskSource, TaskSourceName}; -use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource}; #[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)] pub enum FileReaderFunction { diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index f974e2f4d50..20dd3d0e91e 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -2,7 +2,6 @@ * 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, WorkerId}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::EventSourceBinding::EventSourceBinding::EventSourceMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; @@ -25,6 +24,20 @@ use crate::dom::performance::Performance; use crate::dom::window::Window; use crate::dom::workerglobalscope::WorkerGlobalScope; use crate::dom::workletglobalscope::WorkletGlobalScope; +use crate::microtask::{Microtask, MicrotaskQueue}; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; +use crate::script_thread::{MainThreadScriptChan, ScriptThread}; +use crate::task::TaskCanceller; +use crate::task_source::TaskSourceName; +use crate::task_source::dom_manipulation::DOMManipulationTaskSource; +use crate::task_source::file_reading::FileReadingTaskSource; +use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; +use crate::task_source::remote_event::RemoteEventTaskSource; +use crate::task_source::websocket::WebsocketTaskSource; +use crate::timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle}; +use crate::timers::{OneshotTimers, TimerCallback}; +use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; @@ -38,12 +51,9 @@ use js::rust::{CompileOptionsWrapper, Runtime, get_object_class}; use js::rust::{HandleValue, MutableHandleValue}; use js::rust::wrappers::Evaluate2; use libc; -use crate::microtask::{Microtask, MicrotaskQueue}; use msg::constellation_msg::PipelineId; use net_traits::{CoreResourceThread, ResourceThreads, IpcSend}; use profile_traits::{mem, time}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; -use crate::script_thread::{MainThreadScriptChan, ScriptThread}; use script_traits::{MsDuration, ScriptToConstellationChan, TimerEvent}; use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource}; use servo_url::{MutableOrigin, ServoUrl}; @@ -54,17 +64,7 @@ use std::ffi::CString; use std::rc::Rc; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use crate::task::TaskCanceller; -use crate::task_source::TaskSourceName; -use crate::task_source::dom_manipulation::DOMManipulationTaskSource; -use crate::task_source::file_reading::FileReadingTaskSource; -use crate::task_source::networking::NetworkingTaskSource; -use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; -use crate::task_source::remote_event::RemoteEventTaskSource; -use crate::task_source::websocket::WebsocketTaskSource; use time::{Timespec, get_time}; -use crate::timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle}; -use crate::timers::{OneshotTimers, TimerCallback}; #[derive(JSTraceable)] pub struct AutoCloseWorker(Arc<AtomicBool>); diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 2af9d637d5e..a72906e1337 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; @@ -15,6 +14,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{Node, document_from_node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index e838c24bde0..b3c8fadbc43 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -14,10 +14,10 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{Node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use std::cell::Cell; -use crate::task_source::TaskSource; #[dom_struct] pub struct HTMLDetailsElement { diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index b06df92d75a..371e55ea65a 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLFontElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods; @@ -14,6 +13,7 @@ use crate::dom::element::{Element, RawLayoutElementHelpers}; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::Node; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use servo_atoms::Atom; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index ef3cce2ecce..848822126c8 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -42,6 +42,8 @@ use crate::dom::node::{document_from_node, window_from_node}; use crate::dom::validitystate::ValidationFlags; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; +use crate::script_thread::MainThreadScriptMsg; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use encoding_rs::{Encoding, UTF_8}; use headers_core::HeaderMapExt; @@ -49,7 +51,6 @@ use headers_ext::ContentType; use html5ever::{LocalName, Prefix}; use hyper::Method; use mime::{self, Mime}; -use crate::script_thread::MainThreadScriptMsg; use net_traits::http_percent_encode; use script_traits::LoadData; use servo_rand::random; @@ -57,7 +58,6 @@ use std::borrow::ToOwned; use std::cell::Cell; use style::attr::AttrValue; use style::str::split_html_space_chars; -use crate::task_source::TaskSource; use url::UrlQuery; use url::form_urlencoded::Serializer; diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index e9724984aaf..1abb3727a8b 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::{self, HTMLHRElementMethods}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{DomRoot, LayoutDom}; @@ -12,6 +11,7 @@ use crate::dom::element::{Element, RawLayoutElementHelpers}; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::Node; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index ed79eb5412b..2fe6ccb1537 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -23,13 +23,14 @@ use crate::dom::node::{Node, NodeDamage, UnbindContext, document_from_node, wind use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::ReflowReason; use crate::dom::windowproxy::WindowProxy; +use crate::script_thread::ScriptThread; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use profile_traits::ipc as ProfiledIpc; use script_layout_interface::message::ReflowGoal; -use crate::script_thread::ScriptThread; use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason}; use script_traits::{NewLayoutInfo, ScriptMsg}; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; @@ -37,7 +38,6 @@ use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::cell::Cell; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; -use crate::task_source::TaskSource; bitflags! { #[derive(JSTraceable, MallocSizeOf)] diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 4dab7af24cd..89f6eb66e25 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::{Au, AU_PER_PX}; -use cssparser::{Parser, ParserInput}; use crate::document_loader::{LoadType, LoadBlocker}; use crate::dom::activation::Activatable; use crate::dom::attr::Attr; @@ -38,12 +37,16 @@ use crate::dom::progressevent::ProgressEvent; use crate::dom::values::UNSIGNED_LONG_MAX; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; +use crate::microtask::{Microtask, MicrotaskRunnable}; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::script_thread::ScriptThread; +use crate::task_source::{TaskSource, TaskSourceName}; +use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use euclid::Point2D; use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use crate::microtask::{Microtask, MicrotaskRunnable}; use mime::{self, Mime}; use net_traits::{FetchResponseListener, FetchMetadata, NetworkError, FetchResponseMsg}; use net_traits::image::base::{Image, ImageMetadata}; @@ -51,9 +54,7 @@ use net_traits::image_cache::{CanRequestImages, ImageCache, ImageOrMetadataAvail use net_traits::image_cache::{ImageResponder, ImageResponse, ImageState, PendingImageId}; use net_traits::image_cache::UsePlaceholder; use net_traits::request::RequestInit; -use crate::network_listener::{NetworkListener, PreInvoke}; use num_traits::ToPrimitive; -use crate::script_thread::ScriptThread; use servo_url::ServoUrl; use servo_url::origin::MutableOrigin; use std::cell::{Cell, RefMut}; @@ -72,7 +73,6 @@ use style::stylesheets::{CssRuleType, Origin}; use style::values::specified::{AbsoluteLength, source_size_list::SourceSizeList}; use style::values::specified::length::{Length, NoCalcLength}; use style_traits::ParsingMode; -use crate::task_source::{TaskSource, TaskSourceName}; enum ParseState { InDescriptor, diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index d1d8d7350df..ae4dc5c7eef 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -37,6 +37,9 @@ use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; use crate::dom::validation::Validatable; use crate::dom::validitystate::ValidationFlags; use crate::dom::virtualmethods::VirtualMethods; +use crate::textinput::{Direction, SelectionDirection, TextInput}; +use crate::textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction}; +use crate::textinput::Lines::Single; use dom_struct::dom_struct; use embedder_traits::FilterPattern; use html5ever::{LocalName, Prefix}; @@ -55,9 +58,6 @@ use std::ops::Range; use style::attr::AttrValue; use style::element_state::ElementState; use style::str::split_commas; -use crate::textinput::{Direction, SelectionDirection, TextInput}; -use crate::textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction}; -use crate::textinput::Lines::Single; const DEFAULT_SUBMIT_VALUE: &'static str = "Submit"; const DEFAULT_RESET_VALUE: &'static str = "Reset"; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 949a5dacd0f..dd32b053885 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -2,7 +2,6 @@ * 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 as CssParser, ParserInput}; use crate::dom::attr::Attr; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding::DOMTokenListMethods; @@ -20,6 +19,8 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{Node, UnbindContext, document_from_node, window_from_node}; use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; +use crate::stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; +use cssparser::{Parser as CssParser, ParserInput}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use html5ever::{LocalName, Prefix}; @@ -34,7 +35,6 @@ use style::parser::ParserContext as CssParserContext; use style::str::HTML_SPACE_CHARACTERS; use style::stylesheets::{CssRuleType, Stylesheet}; use style_traits::ParsingMode; -use crate::stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; #[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)] pub struct RequestGenerationId(u32); diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 0747f67a653..010795a0b80 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -32,22 +32,23 @@ use crate::dom::mediaerror::MediaError; use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage, UnbindContext}; use crate::dom::promise::Promise; use crate::dom::virtualmethods::VirtualMethods; -use dom_struct::dom_struct; use crate::fetch::FetchCanceller; +use crate::microtask::{Microtask, MicrotaskRunnable}; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::script_thread::ScriptThread; +use crate::task_source::{TaskSource, TaskSourceName}; +use dom_struct::dom_struct; use headers_core::HeaderMapExt; use headers_ext::ContentLength; use html5ever::{LocalName, Prefix}; use http::header::{self, HeaderMap, HeaderValue}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use crate::microtask::{Microtask, MicrotaskRunnable}; use mime::{self, Mime}; use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseListener, FetchMetadata, Metadata}; use net_traits::NetworkError; use net_traits::request::{CredentialsMode, Destination, RequestInit}; -use crate::network_listener::{NetworkListener, PreInvoke}; use script_layout_interface::HTMLMediaData; -use crate::script_thread::ScriptThread; use servo_media::Error as ServoMediaError; use servo_media::ServoMedia; use servo_media::player::{PlaybackState, Player, PlayerEvent, StreamType}; @@ -59,7 +60,6 @@ use std::f64; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use crate::task_source::{TaskSource, TaskSourceName}; use time::{self, Timespec, Duration}; use webrender_api::{ImageData, ImageDescriptor, ImageFormat, ImageKey, RenderApi}; use webrender_api::{RenderApiSender, Transaction}; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 10ecc1786c0..2b941b909dc 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -22,6 +22,8 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{ChildrenMutation, CloneChildrenFlag, Node}; use crate::dom::node::{document_from_node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::TaskSourceName; use dom_struct::dom_struct; use encoding_rs::Encoding; use html5ever::{LocalName, Prefix}; @@ -30,7 +32,6 @@ use ipc_channel::router::ROUTER; use js::jsval::UndefinedValue; use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError}; use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestInit, RequestMode}; -use crate::network_listener::{NetworkListener, PreInvoke}; use servo_atoms::Atom; use servo_config::opts; use servo_url::ServoUrl; @@ -41,7 +42,6 @@ use std::path::PathBuf; use std::process::{Command, Stdio}; use std::sync::{Arc, Mutex}; use style::str::{HTML_SPACE_CHARACTERS, StaticStringVec}; -use crate::task_source::TaskSourceName; use uuid::Uuid; #[dom_struct] diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index bca4d177c32..f9a45cc2314 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -2,7 +2,6 @@ * 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 as CssParser, ParserInput}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; @@ -16,6 +15,8 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{ChildrenMutation, Node, UnbindContext, document_from_node, window_from_node}; use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; +use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner}; +use cssparser::{Parser as CssParser, ParserInput}; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use net_traits::ReferrerPolicy; @@ -25,7 +26,6 @@ use style::media_queries::MediaList; use style::parser::ParserContext as CssParserContext; use style::stylesheets::{CssRuleType, Stylesheet, Origin}; use style_traits::ParsingMode; -use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner}; #[dom_struct] pub struct HTMLStyleElement { diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 07bcc24feb8..ddf668bb4d4 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; @@ -16,6 +15,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::htmltablerowelement::HTMLTableRowElement; use crate::dom::node::Node; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 25ad9fbf094..218f5e44d41 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding; @@ -22,6 +21,7 @@ use crate::dom::htmltablerowelement::HTMLTableRowElement; use crate::dom::htmltablesectionelement::HTMLTableSectionElement; use crate::dom::node::{Node, document_from_node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use std::cell::Cell; diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 0666c9a90ed..e84cad5164a 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods; use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{self, HTMLTableRowElementMethods}; use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods; @@ -20,6 +19,7 @@ use crate::dom::htmltableelement::HTMLTableElement; use crate::dom::htmltablesectionelement::HTMLTableSectionElement; use crate::dom::node::{Node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use style::attr::AttrValue; diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index 18a9488e70f..c45c2450064 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods}; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::error::{ErrorResult, Fallible}; @@ -16,6 +15,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::htmltablerowelement::HTMLTableRowElement; use crate::dom::node::{Node, window_from_node}; use crate::dom::virtualmethods::VirtualMethods; +use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use style::attr::AttrValue; diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index fbbbd49a3ac..e919d10a1bd 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -28,6 +28,7 @@ use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; use crate::dom::validation::Validatable; use crate::dom::virtualmethods::VirtualMethods; +use crate::textinput::{Direction, KeyReaction, Lines, SelectionDirection, TextInput}; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use script_traits::ScriptToConstellationChan; @@ -36,7 +37,6 @@ use std::default::Default; use std::ops::Range; use style::attr::AttrValue; use style::element_state::ElementState; -use crate::textinput::{Direction, KeyReaction, Lines, SelectionDirection, TextInput}; #[dom_struct] pub struct HTMLTextAreaElement { diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index f9bb9d4f38d..5293947354b 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -2,7 +2,6 @@ * 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, ParserInput}; use crate::dom::bindings::codegen::Bindings::MediaListBinding; use crate::dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; @@ -11,6 +10,7 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::window::Window; +use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::media_queries::MediaList as StyleMediaList; diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 31a0b8a37a3..362c05b8197 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -15,10 +15,10 @@ use crate::dom::bindings::str::DOMString; use crate::dom::mutationrecord::MutationRecord; use crate::dom::node::Node; use crate::dom::window::Window; -use dom_struct::dom_struct; -use html5ever::{Namespace, LocalName}; use crate::microtask::Microtask; use crate::script_thread::ScriptThread; +use dom_struct::dom_struct; +use html5ever::{Namespace, LocalName}; use std::rc::Rc; #[dom_struct] diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 636c5c6e37e..3fbc1b81c0b 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -5,7 +5,6 @@ //! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements. use app_units::Au; -use devtools_traits::NodeInfo; use crate::document_loader::DocumentLoader; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; @@ -55,6 +54,8 @@ use crate::dom::svgsvgelement::{SVGSVGElement, LayoutSVGSVGElementHelpers}; use crate::dom::text::Text; use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; use crate::dom::window::Window; +use crate::script_thread::ScriptThread; +use devtools_traits::NodeInfo; use dom_struct::dom_struct; use euclid::{Point2D, Vector2D, Rect, Size2D}; use html5ever::{Prefix, Namespace, QualName}; @@ -67,7 +68,6 @@ use ref_slice::ref_slice; use script_layout_interface::{HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType}; use script_layout_interface::{OpaqueStyleAndLayoutData, SVGSVGData, TrustedNodeAddress}; use script_layout_interface::message::Msg; -use crate::script_thread::ScriptThread; use script_traits::DocumentActivity; use script_traits::UntrustedNodeAddress; use selectors::matching::{matches_selector_list, MatchingContext, MatchingMode}; diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index d6acf4a11d3..8d2d0d6663b 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -20,6 +20,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::offlineaudiocompletionevent::OfflineAudioCompletionEvent; use crate::dom::promise::Promise; use crate::dom::window::Window; +use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions; use std::cell::Cell; @@ -27,7 +28,6 @@ use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::sync::mpsc; use std::thread::Builder; -use crate::task_source::{TaskSource, TaskSourceName}; #[dom_struct] pub struct OfflineAudioContext { diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 9e6dd0b2cc4..2c0e8e95269 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -2,7 +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 crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionDescriptor, PermissionName, PermissionState}; +use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, PermissionState}; +use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionDescriptor; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; use crate::dom::bindings::codegen::Bindings::PermissionsBinding::{self, PermissionsMethods}; use crate::dom::bindings::error::Error; diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index b6fce511a9f..0d87aa7eac9 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -14,13 +14,13 @@ use crate::dom::bindings::str::USVString; use crate::dom::bindings::structuredclone::StructuredCloneData; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; +use crate::task::TaskOnce; use dom_struct::dom_struct; use js::jsapi::JSContext; use js::rust::HandleValue; use script_traits::{ScriptMsg, DOMMessage}; use servo_url::ServoUrl; use std::cell::Cell; -use crate::task::TaskOnce; pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>; diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index 2eafbfc1031..e650002b348 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -13,9 +13,9 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::serviceworker::ServiceWorker; -use dom_struct::dom_struct; use crate::script_thread::ScriptThread; use crate::serviceworkerjob::{Job, JobType}; +use dom_struct::dom_struct; use std::default::Default; use std::rc::Rc; diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 4f79cd493ff..650308438a5 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::devtools; -use devtools_traits::DevtoolScriptControlMsg; use crate::dom::abstractworker::WorkerScriptMsg; use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; use crate::dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; @@ -20,13 +19,16 @@ use crate::dom::extendablemessageevent::ExtendableMessageEvent; use crate::dom::globalscope::GlobalScope; use crate::dom::worker::TrustedWorkerAddress; use crate::dom::workerglobalscope::WorkerGlobalScope; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, new_rt_and_cx, Runtime}; +use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; +use crate::task_source::TaskSourceName; +use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; use js::jsapi::{JSAutoCompartment, JSContext, JS_AddInterruptCallback}; use js::jsval::UndefinedValue; use net_traits::{load_whole_resource, IpcSend, CustomResponseMediator}; use net_traits::request::{CredentialsMode, Destination, RequestInit}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, new_rt_and_cx, Runtime}; use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin}; use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Receiver, Sender}; use servo_config::prefs::PREFS; @@ -35,8 +37,6 @@ use servo_url::ServoUrl; use std::thread; use std::time::Duration; use style::thread_state::{self, ThreadState}; -use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; -use crate::task_source::TaskSourceName; /// Messages used to control service worker event loop pub enum ServiceWorkerScriptMsg { diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index f52499f8270..8ce775f6fa8 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -29,6 +29,8 @@ use crate::dom::node::Node; use crate::dom::processinginstruction::ProcessingInstruction; use crate::dom::text::Text; use crate::dom::virtualmethods::vtable_for; +use crate::network_listener::PreInvoke; +use crate::script_thread::ScriptThread; use dom_struct::dom_struct; use embedder_traits::resources::{self, Resource}; use html5ever::{Attribute, ExpandedName, LocalName, QualName}; @@ -39,10 +41,8 @@ use hyper_serde::Serde; use mime::{self, Mime}; use msg::constellation_msg::PipelineId; use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError}; -use crate::network_listener::PreInvoke; use profile_traits::time::{TimerMetadata, TimerMetadataFrameType}; use profile_traits::time::{TimerMetadataReflowType, ProfilerCategory, profile}; -use crate::script_thread::ScriptThread; use script_traits::DocumentActivity; use servo_config::prefs::PREFS; use servo_url::ServoUrl; diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 251719eb809..030d8f662b1 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -13,6 +13,7 @@ use crate::dom::bindings::str::DOMString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::storageevent::StorageEvent; use crate::dom::window::Window; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use net_traits::IpcSend; @@ -20,7 +21,6 @@ use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use profile_traits::ipc; use script_traits::ScriptMsg; use servo_url::ServoUrl; -use crate::task_source::TaskSource; #[dom_struct] pub struct Storage { diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 9e87a0f12db..436829b1876 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -17,8 +17,9 @@ use crate::dom::bindings::codegen::UnionTypes::{ByteStringOrLong, ByteStringSequ use crate::dom::bindings::codegen::UnionTypes::{ByteStringSequenceOrLong, DocumentOrTestTypedef}; use crate::dom::bindings::codegen::UnionTypes::{EventOrUSVString, HTMLElementOrLong, LongSequenceOrTestTypedef}; use crate::dom::bindings::codegen::UnionTypes::{HTMLElementOrUnsignedLongOrStringOrBoolean, LongSequenceOrBoolean}; -use crate::dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence, StringSequenceOrUnsignedLong}; -use crate::dom::bindings::codegen::UnionTypes::{StringOrUnsignedLong, StringOrBoolean, UnsignedLongOrBoolean}; +use crate::dom::bindings::codegen::UnionTypes::{StringOrBoolean, UnsignedLongOrBoolean}; +use crate::dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence}; +use crate::dom::bindings::codegen::UnionTypes::{StringSequenceOrUnsignedLong, StringOrUnsignedLong}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::mozmap::MozMap; use crate::dom::bindings::num::Finite; @@ -33,6 +34,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::promisenativehandler::{PromiseNativeHandler, Callback}; use crate::dom::url::URL; +use crate::timers::OneshotTimerCallback; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray}; @@ -46,7 +48,6 @@ use std::borrow::ToOwned; use std::ptr; use std::ptr::NonNull; use std::rc::Rc; -use crate::timers::OneshotTimerCallback; #[dom_struct] pub struct TestBinding { diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index e6fa2150274..ea25de058d1 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -18,8 +18,8 @@ use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::dom::worklet::Worklet; use crate::dom::workletglobalscope::WorkletGlobalScopeType; -use dom_struct::dom_struct; use crate::script_thread::ScriptThread; +use dom_struct::dom_struct; use std::rc::Rc; #[dom_struct] diff --git a/components/script/dom/textcontrol.rs b/components/script/dom/textcontrol.rs index ef4f547537b..2b862c2c6cf 100644 --- a/components/script/dom/textcontrol.rs +++ b/components/script/dom/textcontrol.rs @@ -15,8 +15,8 @@ use crate::dom::bindings::str::DOMString; use crate::dom::event::{EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::node::{Node, NodeDamage, window_from_node}; -use script_traits::ScriptToConstellationChan; use crate::textinput::{SelectionDirection, SelectionState, TextInput}; +use script_traits::ScriptToConstellationChan; pub trait TextControlElement: DerivedFrom<EventTarget> + DerivedFrom<Node> { fn selection_api_applies(&self) -> bool; diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index 6f8e111b4ea..3bd44601c16 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -30,11 +30,12 @@ use crate::dom::vrframedata::VRFrameData; use crate::dom::vrpose::VRPose; use crate::dom::vrstageparameters::VRStageParameters; use crate::dom::webglrenderingcontext::WebGLRenderingContext; +use crate::script_runtime::CommonScriptMsg; +use crate::script_runtime::ScriptThreadEventCategory::WebVREvent; +use crate::task_source::TaskSourceName; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use profile_traits::ipc; -use crate::script_runtime::CommonScriptMsg; -use crate::script_runtime::ScriptThreadEventCategory::WebVREvent; use serde_bytes::ByteBuf; use servo_channel::{channel, Sender}; use std::cell::Cell; @@ -42,7 +43,6 @@ use std::mem; use std::ops::Deref; use std::rc::Rc; use std::thread; -use crate::task_source::TaskSourceName; use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRLayer, WebVRMsg}; #[dom_struct] diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 117a5a1244a..c6efde14cfc 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -20,6 +20,11 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; +use crate::script_runtime::CommonScriptMsg; +use crate::script_runtime::ScriptThreadEventCategory::WebSocketEvent; +use crate::task::{TaskOnce, TaskCanceller}; +use crate::task_source::TaskSource; +use crate::task_source::websocket::WebsocketTaskSource; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use js::jsapi::{JSAutoCompartment, JSObject}; @@ -31,16 +36,11 @@ use net_traits::{WebSocketDomAction, WebSocketNetworkEvent}; use net_traits::MessageData; use net_traits::request::{RequestInit, RequestMode}; use profile_traits::ipc as ProfiledIpc; -use crate::script_runtime::CommonScriptMsg; -use crate::script_runtime::ScriptThreadEventCategory::WebSocketEvent; use servo_url::{ImmutableOrigin, ServoUrl}; use std::borrow::ToOwned; use std::cell::Cell; use std::ptr; use std::thread; -use crate::task::{TaskOnce, TaskCanceller}; -use crate::task_source::TaskSource; -use crate::task_source::websocket::WebsocketTaskSource; #[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)] enum WebSocketRequestState { diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index b9ad630825c..25fee74860c 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -6,8 +6,6 @@ use app_units::Au; use base64; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLChan; -use cssparser::{Parser, ParserInput}; -use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; @@ -54,10 +52,30 @@ use crate::dom::testrunner::TestRunner; use crate::dom::windowproxy::WindowProxy; use crate::dom::worklet::Worklet; use crate::dom::workletglobalscope::WorkletGlobalScopeType; +use crate::fetch; +use crate::layout_image::fetch_image_for_layout; +use crate::microtask::MicrotaskQueue; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, Runtime}; +use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg}; +use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan}; +use crate::task::TaskCanceller; +use crate::task_source::TaskSourceName; +use crate::task_source::dom_manipulation::DOMManipulationTaskSource; +use crate::task_source::file_reading::FileReadingTaskSource; +use crate::task_source::history_traversal::HistoryTraversalTaskSource; +use crate::task_source::media_element::MediaElementTaskSource; +use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; +use crate::task_source::remote_event::RemoteEventTaskSource; +use crate::task_source::user_interaction::UserInteractionTaskSource; +use crate::task_source::websocket::WebsocketTaskSource; +use crate::timers::{IsInterval, TimerCallback}; +use crate::webdriver_handlers::jsval_to_webdriver; +use cssparser::{Parser, ParserInput}; +use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use euclid::{Point2D, Vector2D, Rect, Size2D, TypedPoint2D, TypedScale, TypedSize2D}; -use crate::fetch; use ipc_channel::ipc::IpcSender; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoCompartment; @@ -68,9 +86,7 @@ use js::jsval::JSVal; use js::jsval::UndefinedValue; use js::rust::HandleValue; use js::rust::wrappers::JS_DefineProperty; -use crate::layout_image::fetch_image_for_layout; use libc; -use crate::microtask::MicrotaskQueue; use msg::constellation_msg::PipelineId; use net_traits::{ResourceThreads, ReferrerPolicy}; use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse}; @@ -85,9 +101,6 @@ use script_layout_interface::message::{Msg, Reflow, QueryMsg, ReflowGoal, Script use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; use script_layout_interface::rpc::{NodeScrollIdResponse, ResolvedStyleResponse, TextIndexResponse}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, Runtime}; -use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg}; -use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan}; use script_traits::{ConstellationControlMsg, DocumentState, LoadData}; use script_traits::{ScriptToConstellationChan, ScriptMsg, ScrollState, TimerEvent, TimerEventId}; use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType}; @@ -118,21 +131,8 @@ use style::selector_parser::PseudoElement; use style::str::HTML_SPACE_CHARACTERS; use style::stylesheets::CssRuleType; use style_traits::{CSSPixel, DevicePixel, ParsingMode}; -use crate::task::TaskCanceller; -use crate::task_source::TaskSourceName; -use crate::task_source::dom_manipulation::DOMManipulationTaskSource; -use crate::task_source::file_reading::FileReadingTaskSource; -use crate::task_source::history_traversal::HistoryTraversalTaskSource; -use crate::task_source::media_element::MediaElementTaskSource; -use crate::task_source::networking::NetworkingTaskSource; -use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; -use crate::task_source::remote_event::RemoteEventTaskSource; -use crate::task_source::user_interaction::UserInteractionTaskSource; -use crate::task_source::websocket::WebsocketTaskSource; use time; -use crate::timers::{IsInterval, TimerCallback}; use url::Position; -use crate::webdriver_handlers::jsval_to_webdriver; use webrender_api::{DeviceIntPoint, DeviceUintSize, DocumentId, ExternalScrollId, RenderApiSender}; use webvr_traits::WebVRMsg; diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 0cbcf7c2df5..bc0fe4a9e09 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -17,6 +17,7 @@ use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; +use crate::script_thread::ScriptThread; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use ipc_channel::ipc; @@ -43,7 +44,6 @@ use js::rust::wrappers::{NewWindowProxy, SetWindowProxy, JS_TransplantObject}; use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; -use crate::script_thread::ScriptThread; use script_traits::{AuxiliaryBrowsingContextLoadInfo, LoadData, NewLayoutInfo, ScriptMsg}; use servo_config::prefs::PREFS; use servo_url::ServoUrl; diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index d3455845cbf..3ad9525466c 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -2,7 +2,6 @@ * 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::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg}; use crate::dom::abstractworker::SimpleWorkerErrorHandler; use crate::dom::abstractworker::WorkerScriptMsg; use crate::dom::bindings::codegen::Bindings::WorkerBinding; @@ -19,6 +18,8 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::dom::workerglobalscope::prepare_workerscope_init; +use crate::task::TaskOnce; +use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg}; use dom_struct::dom_struct; use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSContext, JS_RequestInterruptCallback}; @@ -29,7 +30,6 @@ use servo_channel::{channel, Sender}; use std::cell::Cell; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use crate::task::TaskOnce; pub type TrustedWorkerAddress = Trusted<Worker>; diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 8ca6aed86fc..e7c141f1500 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -2,7 +2,6 @@ * 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::{DevtoolScriptControlMsg, WorkerId}; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; @@ -23,8 +22,18 @@ use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope; use crate::dom::window::{base64_atob, base64_btoa}; use crate::dom::workerlocation::WorkerLocation; use crate::dom::workernavigator::WorkerNavigator; -use dom_struct::dom_struct; use crate::fetch; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, get_reports, Runtime}; +use crate::task::TaskCanceller; +use crate::task_source::dom_manipulation::DOMManipulationTaskSource; +use crate::task_source::file_reading::FileReadingTaskSource; +use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; +use crate::task_source::remote_event::RemoteEventTaskSource; +use crate::task_source::websocket::WebsocketTaskSource; +use crate::timers::{IsInterval, TimerCallback}; +use devtools_traits::{DevtoolScriptControlMsg, WorkerId}; +use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use js::jsapi::{JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; @@ -33,7 +42,6 @@ use js::rust::HandleValue; use msg::constellation_msg::PipelineId; use net_traits::{IpcSend, load_whole_resource}; use net_traits::request::{CredentialsMode, Destination, RequestInit as NetRequestInit}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, get_reports, Runtime}; use script_traits::{TimerEvent, TimerEventId}; use script_traits::WorkerGlobalScopeInit; use servo_channel::Receiver; @@ -42,15 +50,7 @@ use std::default::Default; use std::rc::Rc; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use crate::task::TaskCanceller; -use crate::task_source::dom_manipulation::DOMManipulationTaskSource; -use crate::task_source::file_reading::FileReadingTaskSource; -use crate::task_source::networking::NetworkingTaskSource; -use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; -use crate::task_source::remote_event::RemoteEventTaskSource; -use crate::task_source::websocket::WebsocketTaskSource; use time::precise_time_ns; -use crate::timers::{IsInterval, TimerCallback}; pub fn prepare_workerscope_init( global: &GlobalScope, diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 519c0fbe65d..346ba443f54 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -32,6 +32,13 @@ use crate::dom::workletglobalscope::WorkletGlobalScope; use crate::dom::workletglobalscope::WorkletGlobalScopeInit; use crate::dom::workletglobalscope::WorkletGlobalScopeType; use crate::dom::workletglobalscope::WorkletTask; +use crate::script_runtime::CommonScriptMsg; +use crate::script_runtime::Runtime; +use crate::script_runtime::ScriptThreadEventCategory; +use crate::script_runtime::new_rt_and_cx; +use crate::script_thread::{MainThreadScriptMsg, ScriptThread}; +use crate::task::TaskBox; +use crate::task_source::TaskSourceName; use dom_struct::dom_struct; use js::jsapi::JSGCParamKey; use js::jsapi::JSTracer; @@ -43,11 +50,6 @@ use net_traits::load_whole_resource; use net_traits::request::Destination; use net_traits::request::RequestInit; use net_traits::request::RequestMode; -use crate::script_runtime::CommonScriptMsg; -use crate::script_runtime::Runtime; -use crate::script_runtime::ScriptThreadEventCategory; -use crate::script_runtime::new_rt_and_cx; -use crate::script_thread::{MainThreadScriptMsg, ScriptThread}; use servo_channel::{channel, Sender, Receiver}; use servo_rand; use servo_url::ImmutableOrigin; @@ -63,8 +65,6 @@ use std::thread; use style::thread_state::{self, ThreadState}; use swapper::Swapper; use swapper::swapper; -use crate::task::TaskBox; -use crate::task_source::TaskSourceName; use uuid::Uuid; // Magic numbers diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index 4cd27de3e87..eae9281b687 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -2,7 +2,6 @@ * 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; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; @@ -11,6 +10,8 @@ use crate::dom::paintworkletglobalscope::PaintWorkletTask; use crate::dom::testworkletglobalscope::TestWorkletGlobalScope; use crate::dom::testworkletglobalscope::TestWorkletTask; use crate::dom::worklet::WorkletExecutor; +use crate::script_thread::MainThreadScriptMsg; +use devtools_traits::ScriptToDevtoolsControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc; use ipc_channel::ipc::IpcSender; @@ -22,7 +23,6 @@ use net_traits::ResourceThreads; use net_traits::image_cache::ImageCache; use profile_traits::mem; use profile_traits::time; -use crate::script_thread::MainThreadScriptMsg; use script_traits::{Painter, ScriptMsg}; use script_traits::{ScriptToConstellationChan, TimerSchedulerMsg}; use servo_atoms::Atom; diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index df9d6374970..cd3be4c6faf 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -35,10 +35,14 @@ use crate::dom::window::Window; use crate::dom::workerglobalscope::WorkerGlobalScope; use crate::dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget; use crate::dom::xmlhttprequestupload::XMLHttpRequestUpload; +use crate::fetch::FetchCanceller; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::TaskSourceName; +use crate::task_source::networking::NetworkingTaskSource; +use crate::timers::{OneshotTimerCallback, OneshotTimerHandle}; use dom_struct::dom_struct; use encoding_rs::{Encoding, UTF_8}; use euclid::Length; -use crate::fetch::FetchCanceller; use headers_core::HeaderMapExt; use headers_ext::{ContentLength, ContentType}; use html5ever::serialize; @@ -59,7 +63,6 @@ use net_traits::{FetchResponseListener, NetworkError, ReferrerPolicy}; use net_traits::CoreResourceMsg::Fetch; use net_traits::request::{CredentialsMode, Destination, RequestInit, RequestMode}; use net_traits::trim_http_whitespace; -use crate::network_listener::{NetworkListener, PreInvoke}; use script_traits::DocumentActivity; use servo_atoms::Atom; use servo_url::ServoUrl; @@ -71,10 +74,7 @@ use std::ptr::NonNull; use std::slice; use std::str::{self, FromStr}; use std::sync::{Arc, Mutex}; -use crate::task_source::TaskSourceName; -use crate::task_source::networking::NetworkingTaskSource; use time; -use crate::timers::{OneshotTimerCallback, OneshotTimerHandle}; use url::Position; #[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)] diff --git a/components/script/fetch.rs b/components/script/fetch.rs index ca4de47dc82..db3d3479f5a 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -18,6 +18,8 @@ use crate::dom::promise::Promise; use crate::dom::request::Request; use crate::dom::response::Response; use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::TaskSourceName; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoCompartment; @@ -26,12 +28,10 @@ use net_traits::{FilteredMetadata, FetchMetadata, Metadata}; use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch; use net_traits::request::{Request as NetTraitsRequest, ServiceWorkersMode}; use net_traits::request::RequestInit as NetTraitsRequestInit; -use crate::network_listener::{NetworkListener, PreInvoke}; use servo_url::ServoUrl; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use crate::task_source::TaskSourceName; struct FetchContext { fetch_promise: Option<TrustedPromise>, diff --git a/components/script/layout_image.rs b/components/script/layout_image.rs index 4d08feeb819..5ede7398506 100644 --- a/components/script/layout_image.rs +++ b/components/script/layout_image.rs @@ -9,15 +9,15 @@ use crate::dom::bindings::reflector::DomObject; use crate::dom::node::{Node, document_from_node}; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::TaskSourceName; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use net_traits::{FetchResponseMsg, FetchResponseListener, FetchMetadata, NetworkError}; use net_traits::image_cache::{ImageCache, PendingImageId}; use net_traits::request::{Destination, RequestInit as FetchRequestInit}; -use crate::network_listener::{NetworkListener, PreInvoke}; use servo_url::ServoUrl; use std::sync::{Arc, Mutex}; -use crate::task_source::TaskSourceName; struct LayoutImageContext { id: PendingImageId, diff --git a/components/script/lib.rs b/components/script/lib.rs index 26ad0ed338e..1eb70033d32 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -163,8 +163,8 @@ pub mod layout_exports { use crate::dom::bindings::codegen::RegisterBindings; use crate::dom::bindings::proxyhandler; -use script_traits::SWManagerSenders; use crate::serviceworker_manager::ServiceWorkerManager; +use script_traits::SWManagerSenders; #[cfg(target_os = "linux")] #[allow(unsafe_code)] diff --git a/components/script/microtask.rs b/components/script/microtask.rs index d249b17c0ed..d1fe004f073 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -14,9 +14,9 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::htmlimageelement::ImageElementMicrotask; use crate::dom::htmlmediaelement::MediaElementMicrotask; use crate::dom::mutationobserver::MutationObserver; -use msg::constellation_msg::PipelineId; use crate::script_runtime::notify_about_rejected_promises; use crate::script_thread::ScriptThread; +use msg::constellation_msg::PipelineId; use std::cell::Cell; use std::mem; use std::rc::Rc; diff --git a/components/script/network_listener.rs b/components/script/network_listener.rs index 810993f2862..6a7512c0561 100644 --- a/components/script/network_listener.rs +++ b/components/script/network_listener.rs @@ -2,11 +2,11 @@ * 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::{Action, FetchResponseListener, FetchResponseMsg}; -use std::sync::{Arc, Mutex}; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::TaskSource; use crate::task_source::networking::NetworkingTaskSource; +use net_traits::{Action, FetchResponseListener, FetchResponseMsg}; +use std::sync::{Arc, Mutex}; /// An off-thread sink for async network event tasks. All such events are forwarded to /// a target thread, where they are invoked on the provided context object. diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 5b475b639c6..560e3fe571d 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -21,6 +21,10 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::promiserejectionevent::PromiseRejectionEvent; +use crate::microtask::{EnqueuedPromiseCallback, Microtask}; +use crate::script_thread::trace_thread; +use crate::task::TaskBox; +use crate::task_source::{TaskSource, TaskSourceName}; use js::glue::CollectServoSizes; use js::glue::SetBuildId; use js::jsapi::{BuildIdCharVector, DisableIncrementalGC, GCDescription, GCProgress}; @@ -37,10 +41,8 @@ use js::rust::Handle; use js::rust::Runtime as RustRuntime; use js::rust::wrappers::{GetPromiseIsHandled, GetPromiseResult}; use malloc_size_of::MallocSizeOfOps; -use crate::microtask::{EnqueuedPromiseCallback, Microtask}; use msg::constellation_msg::PipelineId; use profile_traits::mem::{Report, ReportKind, ReportsChan}; -use crate::script_thread::trace_thread; use servo_config::opts; use servo_config::prefs::PREFS; use std::cell::Cell; @@ -52,8 +54,6 @@ use std::os::raw::c_void; use std::panic::AssertUnwindSafe; use std::ptr; use style::thread_state::{self, ThreadState}; -use crate::task::TaskBox; -use crate::task_source::{TaskSource, TaskSourceName}; use time::{Tm, now}; /// Common messages used to control the event loops in both the script and the worker diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 0f641972e25..18fdff8d777 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -22,9 +22,6 @@ extern crate itertools; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use crate::devtools; -use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; -use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; -use devtools_traits::CSSError; use crate::document_loader::DocumentLoader; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; @@ -62,9 +59,28 @@ use crate::dom::windowproxy::WindowProxy; use crate::dom::worker::TrustedWorkerAddress; use crate::dom::worklet::WorkletThreadPool; use crate::dom::workletglobalscope::WorkletGlobalScopeInit; +use crate::fetch::FetchCanceller; +use crate::microtask::{MicrotaskQueue, Microtask}; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; +use crate::script_runtime::{ScriptPort, get_reports, new_rt_and_cx, Runtime}; +use crate::serviceworkerjob::{Job, JobQueue}; +use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; +use crate::task_source::TaskSourceName; +use crate::task_source::dom_manipulation::DOMManipulationTaskSource; +use crate::task_source::file_reading::FileReadingTaskSource; +use crate::task_source::history_traversal::HistoryTraversalTaskSource; +use crate::task_source::media_element::MediaElementTaskSource; +use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; +use crate::task_source::remote_event::RemoteEventTaskSource; +use crate::task_source::user_interaction::UserInteractionTaskSource; +use crate::task_source::websocket::WebsocketTaskSource; +use crate::webdriver_handlers; +use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; +use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; +use devtools_traits::CSSError; use embedder_traits::EmbedderMsg; use euclid::{Point2D, Vector2D, Rect}; -use crate::fetch::FetchCanceller; use headers_core::HeaderMapExt; use headers_ext::LastModified; use headers_ext::ReferrerPolicy as ReferrerPolicyHeader; @@ -75,7 +91,6 @@ use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks}; use js::jsapi::{JSTracer, SetWindowProxyClass}; use js::jsval::UndefinedValue; use metrics::{MAX_TASK_NS, PaintTimeMetrics}; -use crate::microtask::{MicrotaskQueue, Microtask}; use mime::{self, Mime}; use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId}; use msg::constellation_msg::{PipelineNamespace, TopLevelBrowsingContextId}; @@ -87,8 +102,6 @@ use net_traits::storage_thread::StorageType; use profile_traits::mem::{self, OpaqueSender, ReportsChan}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_layout_interface::message::{self, Msg, NewLayoutThreadInfo, ReflowGoal}; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; -use crate::script_runtime::{ScriptPort, get_reports, new_rt_and_cx, Runtime}; use script_traits::{CompositorEvent, ConstellationControlMsg}; use script_traits::{DiscardBrowsingContext, DocumentActivity, EventResult}; use script_traits::{InitialScriptState, JsEvalResult, LayoutMsg, LoadData}; @@ -99,7 +112,6 @@ use script_traits::{TimerSource, TouchEventType, TouchId, UntrustedNodeAddress}; use script_traits::{UpdatePipelineIdReason, WindowSizeData, WindowSizeType}; use script_traits::CompositorEvent::{KeyboardEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent, TouchEvent}; use script_traits::webdriver_msg::WebDriverScriptCommand; -use crate::serviceworkerjob::{Job, JobQueue}; use servo_atoms::Atom; use servo_channel::{channel, Receiver, Sender}; use servo_channel::{route_ipc_receiver_to_new_servo_receiver, route_ipc_receiver_to_new_servo_sender}; @@ -118,21 +130,9 @@ use std::sync::Arc; use std::thread; use std::time::SystemTime; use style::thread_state::{self, ThreadState}; -use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; -use crate::task_source::TaskSourceName; -use crate::task_source::dom_manipulation::DOMManipulationTaskSource; -use crate::task_source::file_reading::FileReadingTaskSource; -use crate::task_source::history_traversal::HistoryTraversalTaskSource; -use crate::task_source::media_element::MediaElementTaskSource; -use crate::task_source::networking::NetworkingTaskSource; -use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; -use crate::task_source::remote_event::RemoteEventTaskSource; -use crate::task_source::user_interaction::UserInteractionTaskSource; -use crate::task_source::websocket::WebsocketTaskSource; use time::{at_utc, get_time, precise_time_ns, Timespec}; use url::Position; use url::percent_encoding::percent_decode; -use crate::webdriver_handlers; use webrender_api::{DocumentId, RenderApiSender}; use webvr_traits::{WebVREvent, WebVRMsg}; diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs index df0ebce1803..49f3fecb138 100644 --- a/components/script/serviceworker_manager.rs +++ b/components/script/serviceworker_manager.rs @@ -7,11 +7,11 @@ //! If an active service worker timeouts, then it removes the descriptor entry from its //! active_workers map -use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg}; use crate::dom::abstractworker::WorkerScriptMsg; use crate::dom::bindings::structuredclone::StructuredCloneData; use crate::dom::serviceworkerglobalscope::{ServiceWorkerGlobalScope, ServiceWorkerScriptMsg}; use crate::dom::serviceworkerregistration::longest_prefix_match; +use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::{CustomResponseMediator, CoreResourceMsg}; use script_traits::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders, DOMMessage}; diff --git a/components/script/serviceworkerjob.rs b/components/script/serviceworkerjob.rs index 036dc0dfd5c..95193ecebf5 100644 --- a/components/script/serviceworkerjob.rs +++ b/components/script/serviceworkerjob.rs @@ -17,12 +17,12 @@ use crate::dom::promise::Promise; use crate::dom::serviceworkerregistration::ServiceWorkerRegistration; use crate::dom::urlhelper::UrlHelper; use crate::script_thread::ScriptThread; +use crate::task_source::TaskSource; +use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use servo_url::ServoUrl; use std::cmp::PartialEq; use std::collections::HashMap; use std::rc::Rc; -use crate::task_source::TaskSource; -use crate::task_source::dom_manipulation::DOMManipulationTaskSource; #[derive(Clone, Copy, Debug, JSTraceable, PartialEq)] pub enum JobType { diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 0a878265c6e..e1a55b3a8ac 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -2,7 +2,6 @@ * 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::SourceLocation; use crate::document_loader::LoadType; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; @@ -13,13 +12,15 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmllinkelement::{RequestGenerationId, HTMLLinkElement}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::network_listener::{NetworkListener, PreInvoke}; +use crate::task_source::TaskSourceName; +use cssparser::SourceLocation; use encoding_rs::UTF_8; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use mime::{self, Mime}; use net_traits::{FetchResponseListener, FetchMetadata, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy}; use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestInit, RequestMode}; -use crate::network_listener::{NetworkListener, PreInvoke}; use parking_lot::RwLock; use servo_arc::Arc; use servo_url::ServoUrl; @@ -33,7 +34,6 @@ use style::stylesheets::{CssRules, ImportRule, Namespaces, Stylesheet, Styleshee use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; use style::stylesheets::import_rule::ImportSheet; use style::values::CssUrl; -use crate::task_source::TaskSourceName; pub trait StylesheetOwner { /// Returns whether this element was inserted by the parser (i.e., it should diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 9314d96b019..b82db1aac5b 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -6,14 +6,14 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::worker::TrustedWorkerAddress; -use msg::constellation_msg::PipelineId; use crate::script_runtime::ScriptThreadEventCategory; +use crate::task::TaskBox; +use crate::task_source::TaskSourceName; +use msg::constellation_msg::PipelineId; use servo_channel::{Receiver, Sender, base_channel}; use std::cell::Cell; use std::collections::{HashMap, VecDeque}; use std::default::Default; -use crate::task::TaskBox; -use crate::task_source::TaskSourceName; pub type QueuedTask = ( Option<TrustedWorkerAddress>, diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index d361372e77c..fa6da31e6eb 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -7,13 +7,13 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::event::{EventBubbles, EventCancelable, EventTask, SimpleEventTask}; use crate::dom::eventtarget::EventTarget; use crate::dom::window::Window; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; +use crate::task::{TaskCanceller, TaskOnce}; +use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; use servo_atoms::Atom; use std::fmt; use std::result::Result; -use crate::task::{TaskCanceller, TaskOnce}; -use crate::task_source::{TaskSource, TaskSourceName}; #[derive(JSTraceable)] pub struct DOMManipulationTaskSource(pub Box<ScriptChan + Send>, pub PipelineId); diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index db810939f68..129e4f35315 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -4,11 +4,11 @@ use crate::dom::domexception::DOMErrorName; use crate::dom::filereader::{FileReader, TrustedFileReader, GenerationId, ReadMetaData}; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory, ScriptChan}; -use std::sync::Arc; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; +use std::sync::Arc; #[derive(JSTraceable)] pub struct FileReadingTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); diff --git a/components/script/task_source/media_element.rs b/components/script/task_source/media_element.rs index 63d0f3da81b..d57368ecae1 100644 --- a/components/script/task_source/media_element.rs +++ b/components/script/task_source/media_element.rs @@ -7,15 +7,15 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::event::SimpleEventTask; use crate::dom::eventtarget::EventTarget; use crate::dom::window::Window; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; use crate::script_thread::MainThreadScriptMsg; +use crate::task::{TaskCanceller, TaskOnce}; +use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; use servo_atoms::Atom; use servo_channel::Sender; use std::fmt; use std::result::Result; -use crate::task::{TaskCanceller, TaskOnce}; -use crate::task_source::{TaskSource, TaskSourceName}; #[derive(Clone, JSTraceable)] pub struct MediaElementTaskSource(pub Sender<MainThreadScriptMsg>, pub PipelineId); diff --git a/components/script/task_source/mod.rs b/components/script/task_source/mod.rs index 719f232afd9..f0105422be3 100644 --- a/components/script/task_source/mod.rs +++ b/components/script/task_source/mod.rs @@ -13,9 +13,9 @@ pub mod user_interaction; pub mod websocket; use crate::dom::globalscope::GlobalScope; +use crate::task::{TaskCanceller, TaskOnce}; use enum_iterator::IntoEnumIterator; use std::result::Result; -use crate::task::{TaskCanceller, TaskOnce}; // The names of all task sources, used to differentiate TaskCancellers. // Note: When adding a task source, update this enum. diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index 7eef50b5b47..a472a8f5691 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.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 msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; #[derive(JSTraceable)] pub struct NetworkingTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index 5b7716bd3e2..f6c29880e98 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -8,12 +8,12 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::globalscope::GlobalScope; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; -use std::fmt; -use std::result::Result; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; +use std::fmt; +use std::result::Result; #[derive(JSTraceable)] pub struct PerformanceTimelineTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); diff --git a/components/script/task_source/remote_event.rs b/components/script/task_source/remote_event.rs index c47b25ed0bf..e58f94d1645 100644 --- a/components/script/task_source/remote_event.rs +++ b/components/script/task_source/remote_event.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 msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; #[derive(JSTraceable)] pub struct RemoteEventTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs index 961b16ef4d6..fcf6a39e17b 100644 --- a/components/script/task_source/user_interaction.rs +++ b/components/script/task_source/user_interaction.rs @@ -7,15 +7,15 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::event::{EventBubbles, EventCancelable, EventTask}; use crate::dom::eventtarget::EventTarget; use crate::dom::window::Window; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; use crate::script_thread::MainThreadScriptMsg; +use crate::task::{TaskCanceller, TaskOnce}; +use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; use servo_atoms::Atom; use servo_channel::Sender; use std::fmt; use std::result::Result; -use crate::task::{TaskCanceller, TaskOnce}; -use crate::task_source::{TaskSource, TaskSourceName}; #[derive(Clone, JSTraceable)] pub struct UserInteractionTaskSource(pub Sender<MainThreadScriptMsg>, pub PipelineId); diff --git a/components/script/task_source/websocket.rs b/components/script/task_source/websocket.rs index 36a5dc965e1..9cb116155d1 100644 --- a/components/script/task_source/websocket.rs +++ b/components/script/task_source/websocket.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 msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; +use msg::constellation_msg::PipelineId; #[derive(JSTraceable)] pub struct WebsocketTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 52802a424bd..3bc95be171f 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -22,6 +22,7 @@ use crate::dom::htmliframeelement::HTMLIFrameElement; use crate::dom::htmlinputelement::HTMLInputElement; use crate::dom::htmloptionelement::HTMLOptionElement; use crate::dom::node::{Node, window_from_node}; +use crate::script_thread::Documents; use euclid::{Point2D, Rect, Size2D}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; @@ -33,7 +34,6 @@ use msg::constellation_msg::PipelineId; use net_traits::CookieSource::{HTTP, NonHTTP}; use net_traits::CoreResourceMsg::{GetCookiesDataForUrl, SetCookieForUrl}; use net_traits::IpcSend; -use crate::script_thread::Documents; use script_traits::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue}; use script_traits::webdriver_msg::WebDriverCookieError; use servo_url::ServoUrl; diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index ce8691a060a..326c6b04b75 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -2,8 +2,9 @@ * 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 crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress}; use app_units::Au; +use crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress}; +use crate::rpc::LayoutRPC; use euclid::{Point2D, Rect}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; @@ -11,7 +12,6 @@ use metrics::PaintTimeMetrics; use msg::constellation_msg::PipelineId; use net_traits::image_cache::ImageCache; use profile_traits::mem::ReportsChan; -use crate::rpc::LayoutRPC; use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData}; use script_traits::Painter; diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index 6cdd114fabd..fdb35f07333 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -4,12 +4,12 @@ #![allow(unsafe_code)] +use atomic_refcell::AtomicRef; use crate::HTMLCanvasData; use crate::HTMLMediaData; use crate::LayoutNodeType; use crate::OpaqueStyleAndLayoutData; use crate::SVGSVGData; -use atomic_refcell::AtomicRef; use gfx_traits::{ByteIndex, FragmentType, combine_id_with_fragment_type}; use html5ever::{Namespace, LocalName}; use msg::constellation_msg::{BrowsingContextId, PipelineId}; diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index c63481efc57..4dc483e8101 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -45,6 +45,7 @@ pub mod webdriver_msg; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; +use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId}; use euclid::{Length, Point2D, Vector2D, Rect, TypedSize2D, TypedScale}; use gfx_traits::Epoch; @@ -74,7 +75,6 @@ use std::sync::Arc; use style_traits::CSSPixel; use style_traits::SpeculativePainter; use style_traits::cursor::CursorKind; -use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use webrender_api::{DevicePixel, DeviceUintSize, DocumentId, ExternalScrollId, ImageKey, RenderApiSender}; use webvr_traits::{WebVREvent, WebVRMsg}; diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 5913525a8ab..b77524f448b 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -2,6 +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::canvas::{CanvasMsg, CanvasId}; use crate::AnimationState; use crate::AuxiliaryBrowsingContextLoadInfo; use crate::DocumentState; @@ -11,7 +12,6 @@ use crate::LayoutControlMsg; use crate::LoadData; use crate::WorkerGlobalScopeInit; use crate::WorkerScriptLoadOrigin; -use canvas_traits::canvas::{CanvasMsg, CanvasId}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::EmbedderMsg; use euclid::{Size2D, TypedSize2D}; diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 159a02899ad..e5724d64c63 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -30,11 +30,11 @@ extern crate webdriver; mod keys; +use crate::keys::keycodes_to_keys; use euclid::TypedSize2D; use hyper::Method; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; -use crate::keys::keycodes_to_keys; use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, TraversalDirection}; use net_traits::image::base::PixelFormat; use regex::Captures; diff --git a/components/webvr_traits/webvr_traits.rs b/components/webvr_traits/webvr_traits.rs index 743271831b6..e8d6b7330a6 100644 --- a/components/webvr_traits/webvr_traits.rs +++ b/components/webvr_traits/webvr_traits.rs @@ -2,9 +2,9 @@ * 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 crate::webvr::*; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use crate::webvr::*; pub type WebVRResult<T> = Result<T, String>; |