diff options
603 files changed, 1737 insertions, 1646 deletions
diff --git a/components/background_hang_monitor/background_hang_monitor.rs b/components/background_hang_monitor/background_hang_monitor.rs index 0889cba8b63..6b9ae3b6172 100644 --- a/components/background_hang_monitor/background_hang_monitor.rs +++ b/components/background_hang_monitor/background_hang_monitor.rs @@ -13,7 +13,7 @@ use background_hang_monitor_api::{ BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister, HangAlert, HangAnnotation, HangMonitorAlert, MonitoredComponentId, }; -use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, after, never, select, unbounded}; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use log::warn; diff --git a/components/background_hang_monitor/sampler_linux.rs b/components/background_hang_monitor/sampler_linux.rs index b392e49b06d..aebdbea3253 100644 --- a/components/background_hang_monitor/sampler_linux.rs +++ b/components/background_hang_monitor/sampler_linux.rs @@ -8,9 +8,9 @@ use std::cell::UnsafeCell; use std::sync::atomic::{AtomicPtr, Ordering}; use std::{cmp, io, mem, process, ptr, thread}; -use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal}; +use nix::sys::signal::{SaFlags, SigAction, SigHandler, SigSet, Signal, sigaction}; use unwind_sys::{ - unw_cursor_t, unw_get_reg, unw_init_local, unw_step, UNW_ESUCCESS, UNW_REG_IP, UNW_REG_SP, + UNW_ESUCCESS, UNW_REG_IP, UNW_REG_SP, unw_cursor_t, unw_get_reg, unw_init_local, unw_step, }; use crate::sampler::{NativeStack, Sampler}; diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 3d82701d469..92759b3056f 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -21,7 +21,7 @@ use std::time::Duration; use base::id::WebViewId; use bitflags::bitflags; -use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; +use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use bluetooth_traits::scanfilter::{ BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions, }; diff --git a/components/bluetooth/test.rs b/components/bluetooth/test.rs index 91f122950d9..846f43bbf18 100644 --- a/components/bluetooth/test.rs +++ b/components/bluetooth/test.rs @@ -10,11 +10,11 @@ use std::string::String; use uuid::Uuid; +use crate::BluetoothManager; use crate::bluetooth::{ BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService, }; -use crate::BluetoothManager; thread_local!(pub static CACHED_IDS: RefCell<HashSet<Uuid>> = RefCell::new(HashSet::new())); diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 1e2c88d5f53..ff93b969561 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -11,7 +11,7 @@ use euclid::default::{Box2D, Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::point2; use fonts::{ ByteIndex, FontBaseline, FontContext, FontGroup, FontMetrics, FontRef, GlyphInfo, GlyphStore, - ShapingFlags, ShapingOptions, LAST_RESORT_GLYPH_ADVANCE, + LAST_RESORT_GLYPH_ADVANCE, ShapingFlags, ShapingOptions, }; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; use log::warn; diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 673c151489d..5974efa8035 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -7,9 +7,9 @@ use std::collections::HashMap; use std::sync::Arc; use std::thread; -use canvas_traits::canvas::*; use canvas_traits::ConstellationCanvasMsg; -use crossbeam_channel::{select, unbounded, Sender}; +use canvas_traits::canvas::*; +use crossbeam_channel::{Sender, select, unbounded}; use euclid::default::Size2D; use fonts::{FontContext, SystemFontServiceProxy}; use ipc_channel::ipc::{self, IpcSender}; diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index 5f755bc36fa..4ee9a15dc55 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -7,8 +7,8 @@ use std::collections::HashMap; use canvas_traits::canvas::*; use cssparser::color::clamp_unit_f32; -use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::Angle; +use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use font_kit::font::Font; use fonts::{ByteIndex, FontIdentifier, FontTemplateRefMethods}; use log::warn; diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index 562b230391b..5a7e59ebaad 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -6,7 +6,7 @@ use std::default::Default; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use canvas_traits::webgl::{webgl_channel, GlType, WebGLContextId, WebGLMsg, WebGLThreads}; +use canvas_traits::webgl::{GlType, WebGLContextId, WebGLMsg, WebGLThreads, webgl_channel}; use euclid::default::Size2D; use fnv::FnvHashMap; use log::debug; diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 7c6b53d7579..aee5663c2a7 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -25,13 +25,13 @@ use canvas_traits::webgl::{ use euclid::default::Size2D; use fnv::FnvHashMap; use glow::{ - self as gl, bytes_per_type, components_per_format, ActiveTransformFeedback, Context as Gl, - HasContext, NativeTransformFeedback, NativeUniformLocation, NativeVertexArray, PixelUnpackData, - ShaderPrecisionFormat, + self as gl, ActiveTransformFeedback, Context as Gl, HasContext, NativeTransformFeedback, + NativeUniformLocation, NativeVertexArray, PixelUnpackData, ShaderPrecisionFormat, + bytes_per_type, components_per_format, }; use half::f16; use log::{debug, error, trace, warn}; -use pixels::{self, unmultiply_inplace, PixelFormat}; +use pixels::{self, PixelFormat, unmultiply_inplace}; use surfman::chains::{PreserveBuffer, SwapChains, SwapChainsAPI}; use surfman::{ self, Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device, diff --git a/components/canvas/webxr.rs b/components/canvas/webxr.rs index a5deb312183..d43303e7393 100644 --- a/components/canvas/webxr.rs +++ b/components/canvas/webxr.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use std::num::NonZeroU32; use canvas_traits::webgl::{ - webgl_channel, WebGLContextId, WebGLMsg, WebGLSender, WebXRCommand, WebXRLayerManagerId, + WebGLContextId, WebGLMsg, WebGLSender, WebXRCommand, WebXRLayerManagerId, webgl_channel, }; use fnv::FnvHashMap; use surfman::{Context, Device}; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 671a4cb2b63..b41f4411f5e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -5,7 +5,7 @@ use std::cell::Cell; use std::collections::HashMap; use std::env; -use std::fs::{create_dir_all, File}; +use std::fs::{File, create_dir_all}; use std::io::Write; use std::iter::once; use std::rc::Rc; @@ -58,10 +58,10 @@ use webrender_traits::{ CompositorHitTestResult, CrossProcessCompositorMessage, ImageUpdate, UntrustedNodeAddress, }; +use crate::InitialCompositorState; use crate::touch::{TouchHandler, TouchMoveAction, TouchMoveAllowed, TouchSequenceState}; use crate::webview::{UnknownWebView, WebView, WebViewManager}; use crate::windowing::{self, EmbedderCoordinates, WebRenderDebugOption, WindowMethods}; -use crate::InitialCompositorState; #[derive(Debug, PartialEq)] enum UnableToComposite { @@ -599,7 +599,7 @@ impl IOCompositor { Err(error) => { return warn!( "Could not receive WebRender display list items data: {error}" - ) + ); }, }; let cache_data = match display_list_receiver.recv() { @@ -607,7 +607,7 @@ impl IOCompositor { Err(error) => { return warn!( "Could not receive WebRender display list cache data: {error}" - ) + ); }, }; let spatial_tree = match display_list_receiver.recv() { @@ -615,7 +615,7 @@ impl IOCompositor { Err(error) => { return warn!( "Could not receive WebRender display list spatial tree: {error}." - ) + ); }, }; let built_display_list = BuiltDisplayList::from_data( diff --git a/components/compositing/webview.rs b/components/compositing/webview.rs index 8a58a2e20c4..fba469539d5 100644 --- a/components/compositing/webview.rs +++ b/components/compositing/webview.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 https://mozilla.org/MPL/2.0/. */ -use std::collections::hash_map::Entry; use std::collections::HashMap; +use std::collections::hash_map::Entry; use base::id::{PipelineId, WebViewId}; use webrender_api::units::DeviceRect; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 2576a10adf4..c1389e09e56 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -97,21 +97,21 @@ use background_hang_monitor::HangMonitorRegister; use background_hang_monitor_api::{ BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, }; +use base::Epoch; use base::id::{ BroadcastChannelRouterId, BrowsingContextGroupId, BrowsingContextId, HistoryStateId, MessagePortId, MessagePortRouterId, PipelineId, PipelineNamespace, PipelineNamespaceId, PipelineNamespaceRequest, TopLevelBrowsingContextId, WebViewId, }; -use base::Epoch; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; +use canvas_traits::ConstellationCanvasMsg; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use canvas_traits::webgl::WebGLThreads; -use canvas_traits::ConstellationCanvasMsg; use compositing_traits::{ CompositorMsg, CompositorProxy, ConstellationMsg as FromCompositorMsg, SendableFrameTree, }; -use crossbeam_channel::{select, unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, select, unbounded}; use devtools_traits::{ ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState, ScriptToDevtoolsControlMsg, @@ -122,12 +122,12 @@ use embedder_traits::{ MediaSessionEvent, MediaSessionPlaybackState, MouseButton, MouseButtonAction, MouseButtonEvent, Theme, TraversalDirection, WebDriverCommandMsg, WebDriverLoadStatus, }; -use euclid::default::Size2D as UntypedSize2D; use euclid::Size2D; +use euclid::default::Size2D as UntypedSize2D; use fonts::SystemFontServiceProxy; +use ipc_channel::Error as IpcError; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use ipc_channel::Error as IpcError; use keyboard_types::webdriver::Event as WebDriverInputEvent; use log::{debug, error, info, trace, warn}; use media::WindowGLContext; @@ -149,7 +149,7 @@ use script_traits::{ }; use serde::{Deserialize, Serialize}; use servo_config::{opts, pref}; -use servo_rand::{random, Rng, ServoRng, SliceRandom}; +use servo_rand::{Rng, ServoRng, SliceRandom, random}; use servo_url::{Host, ImmutableOrigin, ServoUrl}; use style_traits::CSSPixel; #[cfg(feature = "webgpu")] @@ -2027,7 +2027,9 @@ where Some(router_id) => router_id, None => { if !ports.is_empty() { - warn!("Constellation unable to process port transfer successes, since no router id was received"); + warn!( + "Constellation unable to process port transfer successes, since no router id was received" + ); } return; }, @@ -2251,7 +2253,7 @@ where return warn!( "Constellation asked to re-route msg to unknown messageport {:?}", port_id - ) + ); }, }; match &mut info.state { @@ -2357,14 +2359,16 @@ where return warn!( "Constellation asked to remove unknown entangled messageport {:?}", entangled_id - ) + ); }, }; let router_id = match info.state { - TransferState::EntangledRemoved => return warn!( - "Constellation asked to remove entangled messageport by a port that was already removed {:?}", - port_id - ), + TransferState::EntangledRemoved => { + return warn!( + "Constellation asked to remove entangled messageport by a port that was already removed {:?}", + port_id + ); + }, TransferState::TransferInProgress(_) | TransferState::CompletionInProgress(_) | TransferState::CompletionFailed(_) | @@ -2826,7 +2830,9 @@ where )] fn handle_focus_web_view(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) { if self.webviews.get(top_level_browsing_context_id).is_none() { - return warn!("{top_level_browsing_context_id}: FocusWebView on unknown top-level browsing context"); + return warn!( + "{top_level_browsing_context_id}: FocusWebView on unknown top-level browsing context" + ); } self.webviews.focus(top_level_browsing_context_id); self.embedder_proxy @@ -3223,7 +3229,9 @@ where // TODO(servo#30571) revert to debug_assert_eq!() once underlying bug is fixed #[cfg(debug_assertions)] if !(browsing_context_size == load_info.window_size.initial_viewport) { - log::warn!("debug assertion failed! browsing_context_size == load_info.window_size.initial_viewport"); + log::warn!( + "debug assertion failed! browsing_context_size == load_info.window_size.initial_viewport" + ); } // Create the new pipeline, attached to the parent and push to pending changes @@ -3271,7 +3279,7 @@ where return warn!( "{}: Script loaded url in closed iframe pipeline", parent_pipeline_id - ) + ); }, }; let (is_parent_private, is_parent_throttled, is_parent_secure) = @@ -4356,7 +4364,7 @@ where return warn!( "{}: Visibility change for closed browsing context", pipeline_id - ) + ); }, }; let parent_pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { @@ -5118,8 +5126,7 @@ where let pipeline_id = browsing_context.pipeline_id; trace!( "{}: Checking readiness of {}", - browsing_context.id, - pipeline_id + browsing_context.id, pipeline_id ); let pipeline = match self.pipelines.get(&pipeline_id) { @@ -5319,7 +5326,7 @@ where return warn!( "{}: Switched from fullscreen mode after closing", pipeline_id - ) + ); }, Some(pipeline) => pipeline, }; @@ -5637,7 +5644,7 @@ where return warn!( "{}: Got media session action request after closure", media_session_pipeline_id, - ) + ); }, Some(pipeline) => { let msg = diff --git a/components/constellation/event_loop.rs b/components/constellation/event_loop.rs index 828436b3b39..68afe8a278d 100644 --- a/components/constellation/event_loop.rs +++ b/components/constellation/event_loop.rs @@ -9,8 +9,8 @@ use std::marker::PhantomData; use std::rc::Rc; -use ipc_channel::ipc::IpcSender; use ipc_channel::Error; +use ipc_channel::ipc::IpcSender; use script_traits::ScriptThreadMessage; /// <https://html.spec.whatwg.org/multipage/#event-loop> diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs index 8b4577458f8..e00bc060cd5 100644 --- a/components/constellation/lib.rs +++ b/components/constellation/lib.rs @@ -20,4 +20,4 @@ mod webview; pub use crate::constellation::{Constellation, InitialConstellationState}; pub use crate::logging::{FromCompositorLogger, FromScriptLogger}; pub use crate::pipeline::UnprivilegedPipelineContent; -pub use crate::sandboxing::{content_process_sandbox_profile, UnprivilegedContent}; +pub use crate::sandboxing::{UnprivilegedContent, content_process_sandbox_profile}; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 3e5327451a4..9b0360a68ec 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -11,26 +11,26 @@ use background_hang_monitor::HangMonitorRegister; use background_hang_monitor_api::{ BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, }; +use base::Epoch; use base::id::{ BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespace, PipelineNamespaceId, PipelineNamespaceRequest, TopLevelBrowsingContextId, }; -use base::Epoch; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use compositing_traits::{CompositionPipeline, CompositorMsg, CompositorProxy}; -use crossbeam_channel::{unbounded, Sender}; +use crossbeam_channel::{Sender, unbounded}; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; use fonts::{SystemFontServiceProxy, SystemFontServiceProxySender}; +use ipc_channel::Error; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use ipc_channel::Error; use log::{debug, error, warn}; use media::WindowGLContext; use net::image_cache::ImageCacheImpl; -use net_traits::image_cache::ImageCache; use net_traits::ResourceThreads; +use net_traits::image_cache::ImageCache; use profile_traits::{mem as profile_mem, time}; use script_layout_interface::{LayoutFactory, ScriptThreadFactory}; use script_traits::{ @@ -46,7 +46,7 @@ use webrender_api::DocumentId; use webrender_traits::CrossProcessCompositorApi; use crate::event_loop::EventLoop; -use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent}; +use crate::sandboxing::{UnprivilegedContent, spawn_multiprocess}; /// A `Pipeline` is the constellation's view of a `Window`. Each pipeline has an event loop /// (executed by a script thread). A script thread may be responsible for many pipelines. diff --git a/components/constellation/serviceworker.rs b/components/constellation/serviceworker.rs index c4b13d7dbff..e3de4355fc9 100644 --- a/components/constellation/serviceworker.rs +++ b/components/constellation/serviceworker.rs @@ -10,7 +10,7 @@ use servo_config::prefs; use servo_config::prefs::Preferences; use servo_url::ImmutableOrigin; -use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent}; +use crate::sandboxing::{UnprivilegedContent, spawn_multiprocess}; /// Conceptually, this is glue to start an agent-cluster for a service worker agent. /// <https://html.spec.whatwg.org/multipage/#obtain-a-service-worker-agent> diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs index 3adf37aa4dc..54d1e8f2223 100644 --- a/components/devtools/actors/browsing_context.rs +++ b/components/devtools/actors/browsing_context.rs @@ -18,9 +18,9 @@ use serde::Serialize; use serde_json::{Map, Value}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; +use crate::actors::inspector::InspectorActor; use crate::actors::inspector::accessibility::AccessibilityActor; use crate::actors::inspector::css_properties::CssPropertiesActor; -use crate::actors::inspector::InspectorActor; use crate::actors::reflow::ReflowActor; use crate::actors::stylesheets::StyleSheetsActor; use crate::actors::tab::TabDescriptorActor; diff --git a/components/devtools/actors/device.rs b/components/devtools/actors/device.rs index 395825baedd..dc6826872c1 100644 --- a/components/devtools/actors/device.rs +++ b/components/devtools/actors/device.rs @@ -7,9 +7,9 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::{ActorDescription, JsonPacketStream, Method}; -use crate::StreamId; #[derive(Serialize)] struct GetDescriptionReply { diff --git a/components/devtools/actors/framerate.rs b/components/devtools/actors/framerate.rs index b9db3f743d1..6a3a59b791f 100644 --- a/components/devtools/actors/framerate.rs +++ b/components/devtools/actors/framerate.rs @@ -10,9 +10,9 @@ use devtools_traits::DevtoolScriptControlMsg; use ipc_channel::ipc::IpcSender; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::timeline::HighResolutionStamp; -use crate::StreamId; pub struct FramerateActor { name: String, diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index dfc13e3433d..0dd886ada9f 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -14,6 +14,7 @@ use ipc_channel::ipc::{self, IpcSender}; use serde::Serialize; use serde_json::{self, Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::browsing_context::BrowsingContextActor; use crate::actors::inspector::highlighter::{HighlighterActor, HighlighterMsg}; @@ -21,7 +22,6 @@ use crate::actors::inspector::node::NodeInfoToProtocol; use crate::actors::inspector::page_style::{PageStyleActor, PageStyleMsg}; use crate::actors::inspector::walker::{WalkerActor, WalkerMsg}; use crate::protocol::JsonPacketStream; -use crate::StreamId; pub mod accessibility; pub mod css_properties; diff --git a/components/devtools/actors/inspector/accessibility.rs b/components/devtools/actors/inspector/accessibility.rs index 2b4ccb0e33e..07ec8e24398 100644 --- a/components/devtools/actors/inspector/accessibility.rs +++ b/components/devtools/actors/inspector/accessibility.rs @@ -10,9 +10,9 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] struct BootstrapState { diff --git a/components/devtools/actors/inspector/css_properties.rs b/components/devtools/actors/inspector/css_properties.rs index cb7a939f224..6fae7bc86ce 100644 --- a/components/devtools/actors/inspector/css_properties.rs +++ b/components/devtools/actors/inspector/css_properties.rs @@ -12,9 +12,9 @@ use devtools_traits::CssDatabaseProperty; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; pub struct CssPropertiesActor { name: String, diff --git a/components/devtools/actors/inspector/layout.rs b/components/devtools/actors/inspector/layout.rs index ab848b6b8fb..41ba640ca69 100644 --- a/components/devtools/actors/inspector/layout.rs +++ b/components/devtools/actors/inspector/layout.rs @@ -10,9 +10,9 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] pub struct LayoutInspectorActorMsg { diff --git a/components/devtools/actors/inspector/page_style.rs b/components/devtools/actors/inspector/page_style.rs index a6d6e9c3be9..9ac1958406e 100644 --- a/components/devtools/actors/inspector/page_style.rs +++ b/components/devtools/actors/inspector/page_style.rs @@ -5,8 +5,8 @@ //! The page style actor is responsible of informing the DevTools client of the different style //! properties applied, including the attributes and layout of each element. -use std::collections::hash_map::Entry; use std::collections::HashMap; +use std::collections::hash_map::Entry; use std::iter::once; use std::net::TcpStream; @@ -17,12 +17,12 @@ use ipc_channel::ipc::{self, IpcSender}; use serde::Serialize; use serde_json::{self, Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::inspector::node::NodeActor; use crate::actors::inspector::style_rule::{AppliedRule, ComputedDeclaration, StyleRuleActor}; -use crate::actors::inspector::walker::{find_child, WalkerActor}; +use crate::actors::inspector::walker::{WalkerActor, find_child}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] struct GetAppliedReply { diff --git a/components/devtools/actors/inspector/style_rule.rs b/components/devtools/actors/inspector/style_rule.rs index 15c39e48903..c3b3c1afbb5 100644 --- a/components/devtools/actors/inspector/style_rule.rs +++ b/components/devtools/actors/inspector/style_rule.rs @@ -16,11 +16,11 @@ use ipc_channel::ipc; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::inspector::node::NodeActor; use crate::actors::inspector::walker::WalkerActor; use crate::protocol::JsonPacketStream; -use crate::StreamId; const ELEMENT_STYLE_TYPE: u32 = 100; diff --git a/components/devtools/actors/memory.rs b/components/devtools/actors/memory.rs index 846db4c1d65..c6e58aff50c 100644 --- a/components/devtools/actors/memory.rs +++ b/components/devtools/actors/memory.rs @@ -7,8 +7,8 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; -use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::StreamId; +use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs index ac931a9931f..fdfc5d7b581 100644 --- a/components/devtools/actors/network_event.rs +++ b/components/devtools/actors/network_event.rs @@ -11,14 +11,14 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use chrono::{Local, LocalResult, TimeZone}; use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse}; use headers::{ContentType, Cookie, HeaderMapExt}; -use http::{header, HeaderMap, Method}; +use http::{HeaderMap, Method, header}; use net_traits::http_status::HttpStatus; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; struct HttpRequest { url: String, diff --git a/components/devtools/actors/object.rs b/components/devtools/actors/object.rs index 909871564cf..2e0e47e74e7 100644 --- a/components/devtools/actors/object.rs +++ b/components/devtools/actors/object.rs @@ -6,8 +6,8 @@ use std::net::TcpStream; use serde_json::{Map, Value}; -use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::StreamId; +use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; pub struct ObjectActor { pub name: String, diff --git a/components/devtools/actors/performance.rs b/components/devtools/actors/performance.rs index 0644e2665ec..bf64b9a261c 100644 --- a/components/devtools/actors/performance.rs +++ b/components/devtools/actors/performance.rs @@ -10,9 +10,9 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::{ActorDescription, JsonPacketStream, Method}; -use crate::StreamId; pub struct PerformanceActor { name: String, diff --git a/components/devtools/actors/preference.rs b/components/devtools/actors/preference.rs index bb48057e0da..c66c910df60 100644 --- a/components/devtools/actors/preference.rs +++ b/components/devtools/actors/preference.rs @@ -9,9 +9,9 @@ use serde::Serialize; use serde_json::{Map, Value}; use servo_config::pref; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; pub struct PreferenceActor { name: String, diff --git a/components/devtools/actors/process.rs b/components/devtools/actors/process.rs index 6f9d0ca60f0..1a3f8fbb64f 100644 --- a/components/devtools/actors/process.rs +++ b/components/devtools/actors/process.rs @@ -11,10 +11,10 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::root::DescriptorTraits; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] struct ListWorkersReply { diff --git a/components/devtools/actors/reflow.rs b/components/devtools/actors/reflow.rs index 7df26826813..49e514c3ad5 100644 --- a/components/devtools/actors/reflow.rs +++ b/components/devtools/actors/reflow.rs @@ -8,8 +8,8 @@ use std::net::TcpStream; use serde_json::{Map, Value}; -use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::StreamId; +use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; pub struct ReflowActor { name: String, diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs index 2d22a631758..ee39bd337f4 100644 --- a/components/devtools/actors/root.rs +++ b/components/devtools/actors/root.rs @@ -12,8 +12,9 @@ use std::net::TcpStream; use serde::Serialize; -use serde_json::{json, Map, Value}; +use serde_json::{Map, Value, json}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::device::DeviceActor; use crate::actors::performance::PerformanceActor; @@ -21,7 +22,6 @@ use crate::actors::process::{ProcessActor, ProcessActorMsg}; use crate::actors::tab::{TabDescriptorActor, TabDescriptorActorMsg}; use crate::actors::worker::{WorkerActor, WorkerMsg}; use crate::protocol::{ActorDescription, JsonPacketStream}; -use crate::StreamId; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/components/devtools/actors/stylesheets.rs b/components/devtools/actors/stylesheets.rs index e5e8d873ecf..e6fd955295c 100644 --- a/components/devtools/actors/stylesheets.rs +++ b/components/devtools/actors/stylesheets.rs @@ -7,9 +7,9 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index 1d1e9ee19cf..d7d837fd12b 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -14,12 +14,12 @@ use std::net::TcpStream; use serde::Serialize; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg}; use crate::actors::root::{DescriptorTraits, RootActor}; use crate::actors::watcher::{WatcherActor, WatcherActorMsg}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 1a399bb8a5b..0ea9fbcd722 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -20,11 +20,11 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use serde::{Serialize, Serializer}; use serde_json::{Map, Value}; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::framerate::FramerateActor; use crate::actors::memory::{MemoryActor, TimelineMemoryReply}; use crate::protocol::JsonPacketStream; -use crate::StreamId; pub struct TimelineActor { name: String, @@ -163,20 +163,22 @@ impl TimelineActor { thread::Builder::new() .name("PullTimelineData".to_owned()) - .spawn(move || loop { - if !*is_recording.lock().unwrap() { - break; - } + .spawn(move || { + loop { + if !*is_recording.lock().unwrap() { + break; + } - let mut markers = vec![]; - while let Ok(Some(marker)) = receiver.try_recv() { - markers.push(emitter.marker(marker)); - } - if emitter.send(markers).is_err() { - break; - } + let mut markers = vec![]; + while let Ok(Some(marker)) = receiver.try_recv() { + markers.push(emitter.marker(marker)); + } + if emitter.send(markers).is_err() { + break; + } - thread::sleep(Duration::from_millis(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT)); + thread::sleep(Duration::from_millis(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT)); + } }) .expect("Thread spawning failed"); } diff --git a/components/devtools/actors/worker.rs b/components/devtools/actors/worker.rs index b5bcec23b54..01f15a6351c 100644 --- a/components/devtools/actors/worker.rs +++ b/components/devtools/actors/worker.rs @@ -14,9 +14,9 @@ use serde::Serialize; use serde_json::{Map, Value}; use servo_url::ServoUrl; +use crate::StreamId; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use crate::StreamId; #[derive(Clone, Copy)] #[allow(dead_code)] diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 3aec5a8d02c..b1c1f8cadf8 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -12,15 +12,15 @@ #![deny(unsafe_code)] use std::borrow::ToOwned; -use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::HashMap; +use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::io::Read; use std::net::{Shutdown, TcpListener, TcpStream}; use std::sync::{Arc, Mutex}; use std::thread; use base::id::{BrowsingContextId, PipelineId}; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use devtools_traits::{ ChromeToDevtoolsControlMsg, ConsoleMessage, ConsoleMessageBuilder, DevtoolScriptControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, LogLevel, NavigationState, NetworkEvent, PageError, diff --git a/components/domobject_derive/lib.rs b/components/domobject_derive/lib.rs index 10225fb2302..e6ff13b7206 100644 --- a/components/domobject_derive/lib.rs +++ b/components/domobject_derive/lib.rs @@ -4,7 +4,7 @@ #![recursion_limit = "128"] -use quote::{quote, TokenStreamExt}; +use quote::{TokenStreamExt, quote}; /// First field of DomObject must be either reflector or another dom_struct, /// all other fields must not implement DomObject diff --git a/components/fonts/font.rs b/components/fonts/font.rs index e0d6cd065d8..c33128b5581 100644 --- a/components/fonts/font.rs +++ b/components/fonts/font.rs @@ -619,10 +619,10 @@ impl FontGroup { // Do not select this font if it goes against our emoji preference. match options.presentation_preference { EmojiPresentationPreference::Text if font.has_color_bitmap_or_colr_table() => { - return false + return false; }, EmojiPresentationPreference::Emoji if !font.has_color_bitmap_or_colr_table() => { - return false + return false; }, _ => {}, } diff --git a/components/fonts/font_context.rs b/components/fonts/font_context.rs index df8c7785658..8af023d02bb 100644 --- a/components/fonts/font_context.rs +++ b/components/fonts/font_context.rs @@ -5,8 +5,8 @@ use std::collections::{HashMap, HashSet}; use std::default::Default; use std::hash::{BuildHasherDefault, Hash, Hasher}; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use app_units::Au; use base::id::WebViewId; @@ -16,10 +16,11 @@ use log::{debug, trace}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of_derive::MallocSizeOf; use net_traits::request::{Destination, Referrer, RequestBuilder}; -use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg, ResourceThreads}; +use net_traits::{CoreResourceThread, FetchResponseMsg, ResourceThreads, fetch_async}; use parking_lot::{Mutex, RwLock}; use servo_arc::Arc as ServoArc; use servo_url::ServoUrl; +use style::Atom; use style::computed_values::font_variant_caps::T as FontVariantCaps; use style::font_face::{ FontFaceSourceFormat, FontFaceSourceFormatKeyword, Source, SourceList, UrlSource, @@ -29,7 +30,6 @@ use style::properties::style_structs::Font as FontStyleStruct; use style::shared_lock::SharedRwLockReadGuard; use style::stylesheets::{CssRule, DocumentStyleSheet, FontFaceRule, StylesheetInDocument}; use style::values::computed::font::{FamilyName, FontFamilyNameSyntax, SingleFontFamily}; -use style::Atom; use url::Url; use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey}; use webrender_traits::CrossProcessCompositorApi; @@ -502,7 +502,7 @@ pub trait FontContextWebFontMethods { ); fn remove_all_web_fonts_from_stylesheet(&self, stylesheet: &DocumentStyleSheet); fn collect_unused_webrender_resources(&self, all: bool) - -> (Vec<FontKey>, Vec<FontInstanceKey>); + -> (Vec<FontKey>, Vec<FontInstanceKey>); } impl FontContextWebFontMethods for Arc<FontContext> { @@ -915,8 +915,7 @@ impl RemoteWebFontDownloader { FetchResponseMsg::ProcessResponseChunk(_, new_bytes) => { trace!( "@font-face {} chunk={:?}", - self.web_font_family_name, - new_bytes + self.web_font_family_name, new_bytes ); if self.response_valid { self.response_data.extend(new_bytes) @@ -926,8 +925,7 @@ impl RemoteWebFontDownloader { FetchResponseMsg::ProcessResponseEOF(_, response) => { trace!( "@font-face {} EOF={:?}", - self.web_font_family_name, - response + self.web_font_family_name, response ); if response.is_err() || !self.response_valid { return DownloaderResponseResult::Failure; diff --git a/components/fonts/lib.rs b/components/fonts/lib.rs index 1b48ef1f953..3abe9558af9 100644 --- a/components/fonts/lib.rs +++ b/components/fonts/lib.rs @@ -25,7 +25,7 @@ use ipc_channel::ipc::IpcSharedMemory; pub use platform::LocalFontIdentifier; pub use shaper::*; pub use system_font_service::*; -use unicode_properties::{emoji, EmojiStatus, UnicodeEmoji}; +use unicode_properties::{EmojiStatus, UnicodeEmoji, emoji}; /// A data structure to store data for fonts. Data is stored internally in an /// [`IpcSharedMemory`] handle, so that it can be send without serialization diff --git a/components/fonts/platform/freetype/android/font_list.rs b/components/fonts/platform/freetype/android/font_list.rs index 557425bdb25..cfa86b5f91a 100644 --- a/components/fonts/platform/freetype/android/font_list.rs +++ b/components/fonts/platform/freetype/android/font_list.rs @@ -5,13 +5,13 @@ use std::path::Path; use std::sync::LazyLock; -use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod}; +use base::text::{UnicodeBlock, UnicodeBlockMethod, is_cjk}; use log::warn; +use style::Atom; use style::values::computed::font::GenericFontFamily; use style::values::computed::{ FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight, }; -use style::Atom; use super::xml::{Attribute, Node}; use crate::{ diff --git a/components/fonts/platform/freetype/font.rs b/components/fonts/platform/freetype/font.rs index 3a60459739e..efa86fc3d64 100644 --- a/components/fonts/platform/freetype/font.rs +++ b/components/fonts/platform/freetype/font.rs @@ -9,30 +9,30 @@ use std::{mem, ptr}; use app_units::Au; use euclid::default::{Point2D, Rect, Size2D}; use freetype_sys::{ - ft_sfnt_head, ft_sfnt_os2, FT_Byte, FT_Done_Face, FT_Error, FT_F26Dot6, FT_Face, FT_Fixed, - FT_Get_Char_Index, FT_Get_Kerning, FT_Get_Sfnt_Table, FT_GlyphSlot, FT_Int32, FT_Load_Glyph, - FT_Long, FT_MulFix, FT_New_Face, FT_New_Memory_Face, FT_Pos, FT_Select_Size, FT_Set_Char_Size, - FT_Short, FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_ULong, FT_UShort, FT_Vector, - FT_FACE_FLAG_COLOR, FT_FACE_FLAG_FIXED_SIZES, FT_FACE_FLAG_SCALABLE, FT_KERNING_DEFAULT, - FT_LOAD_COLOR, FT_LOAD_DEFAULT, FT_LOAD_NO_HINTING, FT_STYLE_FLAG_ITALIC, TT_OS2, + FT_Byte, FT_Done_Face, FT_Error, FT_F26Dot6, FT_FACE_FLAG_COLOR, FT_FACE_FLAG_FIXED_SIZES, + FT_FACE_FLAG_SCALABLE, FT_Face, FT_Fixed, FT_Get_Char_Index, FT_Get_Kerning, FT_Get_Sfnt_Table, + FT_GlyphSlot, FT_Int32, FT_KERNING_DEFAULT, FT_LOAD_COLOR, FT_LOAD_DEFAULT, FT_LOAD_NO_HINTING, + FT_Load_Glyph, FT_Long, FT_MulFix, FT_New_Face, FT_New_Memory_Face, FT_Pos, + FT_STYLE_FLAG_ITALIC, FT_Select_Size, FT_Set_Char_Size, FT_Short, FT_Size_Metrics, FT_SizeRec, + FT_UInt, FT_ULong, FT_UShort, FT_Vector, TT_OS2, ft_sfnt_head, ft_sfnt_os2, }; use log::debug; use parking_lot::ReentrantMutex; +use style::Zero; 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 style::Zero; use webrender_api::FontInstanceFlags; -use super::library_handle::FreeTypeLibraryHandle; use super::LocalFontIdentifier; +use super::library_handle::FreeTypeLibraryHandle; +use crate::FontData; use crate::font::{ FontMetrics, FontTableMethods, FontTableTag, FractionalPixel, PlatformFontMethods, }; use crate::font_template::FontTemplateDescriptor; use crate::glyph::GlyphId; use crate::system_font_service::FontIdentifier; -use crate::FontData; // This constant is not present in the freetype // bindings due to bindgen not handling the way diff --git a/components/fonts/platform/freetype/font_list.rs b/components/fonts/platform/freetype/font_list.rs index 2387aedf5b8..ce65933b312 100644 --- a/components/fonts/platform/freetype/font_list.rs +++ b/components/fonts/platform/freetype/font_list.rs @@ -21,9 +21,9 @@ use fontconfig_sys::{ }; use libc::{c_char, c_int}; use log::debug; +use style::Atom; use style::values::computed::font::GenericFontFamily; use style::values::computed::{FontStretch, FontStyle, FontWeight}; -use style::Atom; use unicode_script::Script; use super::LocalFontIdentifier; diff --git a/components/fonts/platform/freetype/library_handle.rs b/components/fonts/platform/freetype/library_handle.rs index 13a7ee2389f..4c162cfac96 100644 --- a/components/fonts/platform/freetype/library_handle.rs +++ b/components/fonts/platform/freetype/library_handle.rs @@ -4,8 +4,8 @@ use std::os::raw::{c_long, c_void}; use std::ptr; -use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::OnceLock; +use std::sync::atomic::{AtomicUsize, Ordering}; use freetype_sys::{ FT_Add_Default_Modules, FT_Done_Library, FT_Library, FT_Memory, FT_MemoryRec, FT_New_Library, diff --git a/components/fonts/platform/freetype/ohos/font_list.rs b/components/fonts/platform/freetype/ohos/font_list.rs index 0c6d217b1ba..13b703a28a6 100644 --- a/components/fonts/platform/freetype/ohos/font_list.rs +++ b/components/fonts/platform/freetype/ohos/font_list.rs @@ -10,11 +10,11 @@ use std::{fs, io}; use base::text::{UnicodeBlock, UnicodeBlockMethod}; use log::{debug, error, warn}; +use style::Atom; use style::values::computed::font::GenericFontFamily; use style::values::computed::{ FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight, }; -use style::Atom; use unicode_script::Script; use crate::{ diff --git a/components/fonts/platform/macos/core_text_font_cache.rs b/components/fonts/platform/macos/core_text_font_cache.rs index 7f8f7f62899..23c03833551 100644 --- a/components/fonts/platform/macos/core_text_font_cache.rs +++ b/components/fonts/platform/macos/core_text_font_cache.rs @@ -8,7 +8,7 @@ use std::sync::{Arc, OnceLock}; use app_units::Au; use core_foundation::base::TCFType; use core_foundation::string::CFString; -use core_foundation::url::{kCFURLPOSIXPathStyle, CFURL}; +use core_foundation::url::{CFURL, kCFURLPOSIXPathStyle}; use core_graphics::data_provider::CGDataProvider; use core_graphics::display::CFDictionary; use core_graphics::font::CGFont; @@ -16,8 +16,8 @@ use core_text::font::CTFont; use core_text::font_descriptor::kCTFontURLAttribute; use parking_lot::RwLock; -use crate::system_font_service::FontIdentifier; use crate::FontData; +use crate::system_font_service::FontIdentifier; /// A cache of `CTFont` to avoid having to create `CTFont` instances over and over. It is /// always possible to create a `CTFont` using a `FontTemplate` even if it isn't in this diff --git a/components/fonts/platform/macos/font.rs b/components/fonts/platform/macos/font.rs index 7fe64473607..56eb8f4dd2c 100644 --- a/components/fonts/platform/macos/font.rs +++ b/components/fonts/platform/macos/font.rs @@ -14,7 +14,7 @@ use core_foundation::string::UniChar; use core_graphics::font::CGGlyph; use core_text::font::CTFont; use core_text::font_descriptor::{ - kCTFontDefaultOrientation, CTFontTraits, SymbolicTraitAccessors, TraitAccessors, + CTFontTraits, SymbolicTraitAccessors, TraitAccessors, kCTFontDefaultOrientation, }; use euclid::default::{Point2D, Rect, Size2D}; use log::debug; @@ -24,9 +24,9 @@ use webrender_api::FontInstanceFlags; use super::core_text_font_cache::CoreTextFontCache; use super::font_list::LocalFontIdentifier; use crate::{ - map_platform_values_to_style_values, FontData, FontIdentifier, FontMetrics, FontTableMethods, - FontTableTag, FontTemplateDescriptor, FractionalPixel, GlyphId, PlatformFontMethods, CBDT, - COLR, KERN, SBIX, + CBDT, COLR, FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTableTag, + FontTemplateDescriptor, FractionalPixel, GlyphId, KERN, PlatformFontMethods, SBIX, + map_platform_values_to_style_values, }; const KERN_PAIR_LEN: usize = 6; @@ -149,7 +149,7 @@ impl CachedKernTable { match key.cmp(&query) { Ordering::Less => start = i + 1, Ordering::Equal => { - return Some(BigEndian::read_i16(&pairs[i * KERN_PAIR_LEN + 4..])) + return Some(BigEndian::read_i16(&pairs[i * KERN_PAIR_LEN + 4..])); }, Ordering::Greater => end = i, } diff --git a/components/fonts/platform/macos/font_list.rs b/components/fonts/platform/macos/font_list.rs index fbab51a03ad..c7864084de6 100644 --- a/components/fonts/platform/macos/font_list.rs +++ b/components/fonts/platform/macos/font_list.rs @@ -5,13 +5,13 @@ use std::fs::File; use std::path::Path; -use base::text::{unicode_plane, UnicodeBlock, UnicodeBlockMethod}; +use base::text::{UnicodeBlock, UnicodeBlockMethod, unicode_plane}; use log::debug; use malloc_size_of_derive::MallocSizeOf; use memmap2::Mmap; use serde::{Deserialize, Serialize}; -use style::values::computed::font::GenericFontFamily; use style::Atom; +use style::values::computed::font::GenericFontFamily; use unicode_script::Script; use webrender_api::NativeFontHandle; diff --git a/components/fonts/platform/mod.rs b/components/fonts/platform/mod.rs index 3af6b034736..2c77d17d5d5 100644 --- a/components/fonts/platform/mod.rs +++ b/components/fonts/platform/mod.rs @@ -15,20 +15,20 @@ use base::text::{UnicodeBlock, UnicodeBlockMethod}; ))] use unicode_script::Script; +#[cfg(all( + any(target_os = "linux", target_os = "macos"), + not(target_os = "android"), + not(target_env = "ohos") +))] +use crate::FallbackFontSelectionOptions; #[cfg(any(target_os = "linux", target_os = "android"))] -pub use crate::platform::freetype::{font, font_list, LocalFontIdentifier}; +pub use crate::platform::freetype::{LocalFontIdentifier, font, font_list}; #[cfg(target_os = "macos")] pub use crate::platform::macos::{ core_text_font_cache, font, font_list, font_list::LocalFontIdentifier, }; #[cfg(target_os = "windows")] pub use crate::platform::windows::{font, font_list, font_list::LocalFontIdentifier}; -#[cfg(all( - any(target_os = "linux", target_os = "macos"), - not(target_os = "android"), - not(target_env = "ohos") -))] -use crate::FallbackFontSelectionOptions; #[cfg(any(target_os = "linux", target_os = "android"))] pub mod freetype; diff --git a/components/fonts/platform/windows/font.rs b/components/fonts/platform/windows/font.rs index 435c9b8ebde..e33b2ad9d3e 100644 --- a/components/fonts/platform/windows/font.rs +++ b/components/fonts/platform/windows/font.rs @@ -15,18 +15,18 @@ use app_units::Au; use dwrote::{FontCollection, FontFace, FontFile}; use euclid::default::{Point2D, Rect, Size2D}; use log::{debug, warn}; +use style::Zero; use style::computed_values::font_stretch::T as StyleFontStretch; use style::computed_values::font_weight::T as StyleFontWeight; use style::values::computed::font::FontStyle as StyleFontStyle; -use style::Zero; use truetype::tables::WindowsMetrics; use truetype::value::Read; use webrender_api::FontInstanceFlags; use super::font_list::LocalFontIdentifier; use crate::{ - ot_tag, FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTableTag, - FontTemplateDescriptor, FractionalPixel, GlyphId, PlatformFontMethods, + FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTableTag, FontTemplateDescriptor, + FractionalPixel, GlyphId, PlatformFontMethods, ot_tag, }; // 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch diff --git a/components/fonts/platform/windows/font_list.rs b/components/fonts/platform/windows/font_list.rs index 266693a2f3f..d1aa19e178a 100644 --- a/components/fonts/platform/windows/font_list.rs +++ b/components/fonts/platform/windows/font_list.rs @@ -5,7 +5,7 @@ use std::hash::Hash; use std::sync::Arc; -use base::text::{unicode_plane, UnicodeBlock, UnicodeBlockMethod}; +use base::text::{UnicodeBlock, UnicodeBlockMethod, unicode_plane}; use dwrote::{Font, FontCollection, FontDescriptor, FontStretch, FontStyle}; use malloc_size_of_derive::MallocSizeOf; use serde::{Deserialize, Serialize}; diff --git a/components/fonts/shaper.rs b/components/fonts/shaper.rs index 3425fff257c..f39fd2aa8af 100644 --- a/components/fonts/shaper.rs +++ b/components/fonts/shaper.rs @@ -14,6 +14,8 @@ use euclid::default::Point2D; // Eventually we would like the shaper to be pluggable, as many operating systems have their own // shapers. For now, however, HarfBuzz is a hard dependency. use harfbuzz_sys::{ + HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY, HB_OT_LAYOUT_BASELINE_TAG_HANGING, + HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT, HB_OT_LAYOUT_BASELINE_TAG_ROMAN, hb_blob_create, hb_blob_t, hb_bool_t, hb_buffer_add_utf8, hb_buffer_create, hb_buffer_destroy, hb_buffer_get_glyph_infos, hb_buffer_get_glyph_positions, hb_buffer_get_length, hb_buffer_set_direction, hb_buffer_set_script, hb_buffer_t, hb_codepoint_t, @@ -21,17 +23,15 @@ use harfbuzz_sys::{ hb_font_destroy, hb_font_funcs_create, hb_font_funcs_set_glyph_h_advance_func, hb_font_funcs_set_nominal_glyph_func, hb_font_funcs_t, hb_font_set_funcs, hb_font_set_ppem, hb_font_set_scale, hb_font_t, hb_glyph_info_t, hb_glyph_position_t, hb_ot_layout_get_baseline, - hb_position_t, hb_shape, hb_tag_t, HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY, - HB_OT_LAYOUT_BASELINE_TAG_HANGING, HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT, - HB_OT_LAYOUT_BASELINE_TAG_ROMAN, + hb_position_t, hb_shape, hb_tag_t, }; use log::debug; use num_traits::Zero; use crate::platform::font::FontTable; use crate::{ - fixed_to_float, float_to_fixed, ot_tag, ByteIndex, Font, FontBaseline, FontTableMethods, - FontTableTag, GlyphData, GlyphId, GlyphStore, ShapingFlags, ShapingOptions, BASE, KERN, + BASE, ByteIndex, Font, FontBaseline, FontTableMethods, FontTableTag, GlyphData, GlyphId, + GlyphStore, KERN, ShapingFlags, ShapingOptions, fixed_to_float, float_to_fixed, ot_tag, }; const NO_GLYPH: i32 = -1; diff --git a/components/fonts/system_font_service.rs b/components/fonts/system_font_service.rs index e50b3144f54..6cbd5390122 100644 --- a/components/fonts/system_font_service.rs +++ b/components/fonts/system_font_service.rs @@ -30,10 +30,10 @@ use webrender_traits::CrossProcessCompositorApi; use crate::font::FontDescriptor; use crate::font_store::FontStore; use crate::font_template::{FontTemplate, FontTemplateRef}; +use crate::platform::LocalFontIdentifier; use crate::platform::font_list::{ default_system_generic_font_family, for_each_available_family, for_each_variation, }; -use crate::platform::LocalFontIdentifier; #[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] pub enum FontIdentifier { diff --git a/components/fonts/tests/font_context.rs b/components/fonts/tests/font_context.rs index e6afab2e725..e4473b800d1 100644 --- a/components/fonts/tests/font_context.rs +++ b/components/fonts/tests/font_context.rs @@ -9,23 +9,24 @@ mod font_context { use std::collections::HashMap; use std::ffi::OsStr; use std::path::PathBuf; - use std::sync::atomic::{AtomicI32, Ordering}; use std::sync::Arc; + use std::sync::atomic::{AtomicI32, Ordering}; use std::thread; use app_units::Au; use fonts::platform::font::PlatformFont; use fonts::{ - fallback_font_families, FallbackFontSelectionOptions, FontContext, FontDescriptor, - FontFamilyDescriptor, FontIdentifier, FontSearchScope, FontTemplate, FontTemplates, - LocalFontIdentifier, PlatformFontMethods, SystemFontServiceMessage, SystemFontServiceProxy, - SystemFontServiceProxySender, + FallbackFontSelectionOptions, FontContext, FontDescriptor, FontFamilyDescriptor, + FontIdentifier, FontSearchScope, FontTemplate, FontTemplates, LocalFontIdentifier, + PlatformFontMethods, SystemFontServiceMessage, SystemFontServiceProxy, + SystemFontServiceProxySender, fallback_font_families, }; use ipc_channel::ipc::{self, IpcReceiver}; use net_traits::ResourceThreads; use parking_lot::Mutex; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; + use style::ArcSlice; use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps; use style::properties::style_structs::Font as FontStyleStruct; use style::values::computed::font::{ @@ -34,7 +35,6 @@ mod font_context { }; use style::values::computed::{FontLanguageOverride, XLang}; use style::values::generics::font::LineHeight; - use style::ArcSlice; use webrender_api::{FontInstanceKey, FontKey, IdNamespace}; use webrender_traits::CrossProcessCompositorApi; diff --git a/components/hyper_serde/tests/tokens.rs b/components/hyper_serde/tests/tokens.rs index dc0b51bb901..05fb3e1b7ed 100644 --- a/components/hyper_serde/tests/tokens.rs +++ b/components/hyper_serde/tests/tokens.rs @@ -12,11 +12,11 @@ use std::time::Duration; use cookie::{Cookie, CookieBuilder}; use headers::ContentType; -use http::header::{self, HeaderMap, HeaderValue}; use http::StatusCode; +use http::header::{self, HeaderMap, HeaderValue}; use hyper::{Method, Uri}; use hyper_serde::{De, Ser}; -use serde_test::{assert_de_tokens, assert_ser_tokens, Token}; +use serde_test::{Token, assert_de_tokens, assert_ser_tokens}; #[test] fn test_content_type() { diff --git a/components/layout/block.rs b/components/layout/block.rs index df1f9b8085d..e14aaf9a2c8 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -793,10 +793,11 @@ impl BlockFlow { viewport_size: &Size2D<Au>, descendant: OpaqueFlow, ) -> LogicalSize<Au> { - debug_assert!(self - .base - .flags - .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)); + debug_assert!( + self.base + .flags + .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) + ); if self.is_fixed() || self.is_root() { // Initial containing block is the CB for the root LogicalSize::from_physical(self.base.writing_mode, *viewport_size) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index c73c534e50d..ce25d23ecc8 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -14,8 +14,8 @@ use std::collections::LinkedList; use std::marker::PhantomData; use std::mem; -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use html5ever::{local_name, namespace_url, ns}; use log::debug; @@ -24,6 +24,7 @@ use script_layout_interface::wrapper_traits::{ }; use script_layout_interface::{LayoutElementType, LayoutNodeType}; use servo_url::ServoUrl; +use style::LocalName; use style::computed_values::caption_side::T as CaptionSide; use style::computed_values::display::T as Display; use style::computed_values::empty_cells::T as EmptyCells; @@ -38,7 +39,6 @@ use style::selector_parser::{PseudoElement, RestyleDamage}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::Image; use style::values::generics::counters::ContentItem; -use style::LocalName; use crate::block::BlockFlow; use crate::context::LayoutContext; @@ -71,7 +71,7 @@ use crate::table_wrapper::TableWrapperFlow; use crate::text::TextRunScanner; use crate::traversal::PostorderNodeMutTraversal; use crate::wrapper::{TextContent, ThreadSafeLayoutNodeHelpers}; -use crate::{parallel, ServoArc}; +use crate::{ServoArc, parallel}; /// The results of flow construction for a DOM node. #[derive(Clone, Default)] diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs index a77c6516155..0b098717a65 100644 --- a/components/layout/display_list/border.rs +++ b/components/layout/display_list/border.rs @@ -11,8 +11,8 @@ use style::values::computed::{ BorderCornerRadius, BorderImageSideWidth, BorderImageWidth, NonNegativeLengthOrNumber, NumberOrPercentage, }; -use style::values::generics::rect::Rect as StyleRect; use style::values::generics::NonNegative; +use style::values::generics::rect::Rect as StyleRect; use webrender_api::units::{LayoutSideOffsets, LayoutSize}; use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder}; diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 9ed59e15f94..314a3c20db5 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -12,13 +12,13 @@ use std::default::Default; use std::sync::Arc; use std::{f32, mem}; -use app_units::{Au, AU_PER_PX}; +use app_units::{AU_PER_PX, Au}; use base::id::PipelineId; use bitflags::bitflags; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use embedder_traits::Cursor; use euclid::default::{Point2D, Rect, SideOffsets2D as UntypedSideOffsets2D, Size2D}; -use euclid::{rect, Scale, SideOffsets2D}; +use euclid::{Scale, SideOffsets2D, rect}; use fnv::FnvHashMap; use fonts::ByteIndex; use ipc_channel::ipc; @@ -26,7 +26,7 @@ use log::{debug, warn}; use net_traits::image_cache::UsePlaceholder; use range::Range; use script_layout_interface::{ - combine_id_with_fragment_type, FragmentType, IFrameSize, IFrameSizes, + FragmentType, IFrameSize, IFrameSizes, combine_id_with_fragment_type, }; use servo_geometry::{self, MaxRect}; use style::color::AbsoluteColor; @@ -36,7 +36,7 @@ use style::computed_values::pointer_events::T as PointerEvents; use style::computed_values::position::T as StylePosition; use style::computed_values::visibility::T as Visibility; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect}; -use style::properties::{style_structs, ComputedValues}; +use style::properties::{ComputedValues, style_structs}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::effects::SimpleShadow; use style::values::computed::image::Image; @@ -64,7 +64,7 @@ use crate::display_list::items::{ PushTextShadowDisplayItem, StackingContext, StackingContextType, StickyFrameData, TextOrientation, WebRenderImageInfo, }; -use crate::display_list::{border, gradient, FilterToLayout, ToLayout}; +use crate::display_list::{FilterToLayout, ToLayout, border, gradient}; use crate::flow::{BaseFlow, Flow, FlowFlags}; use crate::flow_ref::FlowRef; use crate::fragment::{ diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs index edfb3265329..d18cf1f62c7 100644 --- a/components/layout/display_list/webrender_helpers.rs +++ b/components/layout/display_list/webrender_helpers.rs @@ -7,8 +7,8 @@ // This might be achieved by sharing types between WR and Servo display lists, or // completely converting layout to directly generate WebRender display lists, for example. -use base::id::PipelineId; use base::WebRenderEpochToU16; +use base::id::PipelineId; use log::trace; use webrender_api::units::{LayoutPoint, LayoutSize, LayoutVector2D}; use webrender_api::{ diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 7e422078967..9c7601ee789 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -847,14 +847,7 @@ impl FlexFlow { } let self_align = { - let self_align = block - .fragment - .style() - .get_position() - .align_self - .0 - .0 - .value(); + let self_align = block.fragment.style().get_position().align_self.0.0.value(); match self_align { AlignFlags::AUTO | AlignFlags::NORMAL => align_items, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index ac167aad890..c3b2df15d43 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -27,17 +27,17 @@ use std::fmt; use std::slice::IterMut; -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use app_units::Au; use base::print_tree::PrintTree; use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use log::debug; -use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; -use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect}; +use serde::ser::{SerializeStruct, Serializer}; +use servo_geometry::{MaxRect, au_rect_to_f32_rect, f32_rect_to_au_rect}; use style::computed_values::overflow_x::T as StyleOverflow; use style::computed_values::position::T as Position; use style::computed_values::text_align::T as TextAlign; diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index eceed09028c..ba32830f4a6 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_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 https://mozilla.org/MPL/2.0/. */ -use std::collections::{linked_list, LinkedList}; +use std::collections::{LinkedList, linked_list}; use std::ops::Deref; use std::sync::Arc; use serde::ser::{Serialize, SerializeSeq, Serializer}; -use serde_json::{to_value, Map, Value}; +use serde_json::{Map, Value, to_value}; use crate::flow::{Flow, FlowClass}; use crate::flow_ref::FlowRef; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index b697c7da395..3d818045203 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -5,7 +5,7 @@ //! The `Fragment` type, which represents the leaves of the layout tree. use std::borrow::ToOwned; -use std::cmp::{max, min, Ordering}; +use std::cmp::{Ordering, max, min}; use std::collections::LinkedList; use std::sync::{Arc, Mutex}; use std::{f32, fmt}; @@ -57,7 +57,7 @@ use webrender_api::units::LayoutTransform; use webrender_api::{self, ImageKey}; use crate::context::LayoutContext; -use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR}; +use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode}; use crate::display_list::{StackingContextId, ToLayout}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; @@ -67,12 +67,12 @@ use crate::inline::{ LineMetrics, }; use crate::model::{ - self, style_length, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint, + self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint, style_length, }; use crate::text::TextRunScanner; use crate::text_run::{TextRun, TextRunSlice}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use crate::{text, ServoArc}; +use crate::{ServoArc, text}; // From gfxFontConstants.h in Firefox. static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20; @@ -1649,7 +1649,7 @@ impl Fragment { }, SpecificFragmentInfo::TruncatedFragment(_) => { - return IntrinsicISizesContribution::new() + return IntrinsicISizesContribution::new(); }, SpecificFragmentInfo::UnscannedText(..) => { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index e72a0d1524a..87984165f44 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -13,7 +13,7 @@ use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D}; use fonts::{FontContext, FontMetrics}; use log::debug; -use range::{int_range_index, Range, RangeIndex}; +use range::{Range, RangeIndex, int_range_index}; use script_layout_interface::wrapper_traits::PseudoElementType; use serde::Serialize; use servo_geometry::MaxRect; @@ -50,7 +50,7 @@ use crate::fragment::{ }; use crate::model::IntrinsicISizesContribution; use crate::traversal::PreorderFlowTraversal; -use crate::{text, ServoArc}; +use crate::{ServoArc, text}; /// `Line`s are represented as offsets into the child list, rather than /// as an object that "owns" fragments. Choosing a different set of line diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index b143c1215ca..3ef3d6c6d80 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -19,13 +19,13 @@ use style::values::computed::length::{ }; use style::values::generics::column::ColumnCount; +use crate::ServoArc; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use crate::ServoArc; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for MulticolFlow {} diff --git a/components/layout/query.rs b/components/layout/query.rs index b86c156d1db..212e37856f0 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -23,8 +23,8 @@ use style::dom::TElement; use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode}; use style::properties::style_structs::{self, Font}; use style::properties::{ - parse_one_declaration_into, ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, - PropertyDeclarationId, PropertyId, ShorthandId, SourcePropertyDeclaration, + ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, PropertyDeclarationId, + PropertyId, ShorthandId, SourcePropertyDeclaration, parse_one_declaration_into, }; use style::selector_parser::PseudoElement; use style::shared_lock::SharedRwLock; @@ -32,8 +32,8 @@ use style::stylesheets::{CssRuleType, Origin, UrlExtraData}; use style_traits::{ParsingMode, ToCss}; use crate::construct::ConstructionResult; -use crate::display_list::items::OpaqueNode; use crate::display_list::IndexableText; +use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, FragmentFlags, SpecificFragmentInfo}; use crate::inline::InlineFragmentNodeFlags; diff --git a/components/layout/table.rs b/components/layout/table.rs index 02f8fe9231c..f0f792daaeb 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -16,8 +16,8 @@ use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::Size; use style::values::CSSFloat; +use style::values::computed::Size; use crate::block::{ BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer, ISizeConstraintInput, diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 21313e47c4e..72a30969b63 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -24,8 +24,8 @@ use style::computed_values::{position, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::{LogicalRect, LogicalSize}; use style::properties::ComputedValues; -use style::values::computed::Size; use style::values::CSSFloat; +use style::values::computed::Size; use crate::block::{ AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, diff --git a/components/layout/text.rs b/components/layout/text.rs index c8bde51f635..8a74a2d14e6 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -11,8 +11,8 @@ use std::sync::Arc; use app_units::Au; use base::text::is_bidi_control; use fonts::{ - self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, RunMetrics, ShapingFlags, - ShapingOptions, LAST_RESORT_GLYPH_ADVANCE, + self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, LAST_RESORT_GLYPH_ADVANCE, + RunMetrics, ShapingFlags, ShapingOptions, }; use log::{debug, warn}; use range::Range; @@ -20,8 +20,8 @@ use style::computed_values::text_rendering::T as TextRendering; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; use style::computed_values::word_break::T as WordBreak; use style::logical_geometry::{LogicalSize, WritingMode}; -use style::properties::style_structs::Font as FontStyleStruct; use style::properties::ComputedValues; +use style::properties::style_structs::Font as FontStyleStruct; use style::values::generics::font::LineHeight; use style::values::specified::text::{TextTransform, TextTransformCase}; use unicode_bidi as bidi; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index f045cc9d856..4cc785aa477 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -12,14 +12,14 @@ use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; -use style::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData}; +use style::traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at}; +use crate::LayoutData; use crate::construct::FlowConstructor; use crate::context::LayoutContext; use crate::display_list::DisplayListBuildState; use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use crate::LayoutData; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, diff --git a/components/layout_2020/construct_modern.rs b/components/layout_2020/construct_modern.rs index 07b8c6e983f..e66082234ee 100644 --- a/components/layout_2020/construct_modern.rs +++ b/components/layout_2020/construct_modern.rs @@ -8,6 +8,7 @@ use std::borrow::Cow; use rayon::iter::{IntoParallelIterator, ParallelIterator}; +use crate::PropagatedBoxTreeData; use crate::context::LayoutContext; use crate::dom::{BoxSlot, NodeExt}; use crate::dom_traversal::{Contents, NodeAndStyleInfo, TraversalHandler}; @@ -19,7 +20,6 @@ use crate::formatting_contexts::{ }; use crate::layout_box_base::LayoutBoxBase; use crate::style_ext::DisplayGeneratingBox; -use crate::PropagatedBoxTreeData; /// A builder used for both flex and grid containers. pub(crate) struct ModernContainerBuilder<'a, 'dom, Node> { diff --git a/components/layout_2020/display_list/background.rs b/components/layout_2020/display_list/background.rs index 24ae9024523..f49ddfbe6ce 100644 --- a/components/layout_2020/display_list/background.rs +++ b/components/layout_2020/display_list/background.rs @@ -8,14 +8,14 @@ use style::computed_values::background_attachment::SingleComputedValue as Backgr use style::computed_values::background_clip::single_value::T as Clip; use style::computed_values::background_origin::single_value::T as Origin; use style::properties::ComputedValues; -use style::values::computed::background::BackgroundSize as Size; use style::values::computed::LengthPercentage; +use style::values::computed::background::BackgroundSize as Size; use style::values::specified::background::{ BackgroundRepeat as RepeatXY, BackgroundRepeatKeyword as Repeat, }; use webrender_api::{self as wr, units}; -use wr::units::LayoutSize; use wr::ClipChainId; +use wr::units::LayoutSize; use crate::replaced::NaturalSizes; diff --git a/components/layout_2020/display_list/clip_path.rs b/components/layout_2020/display_list/clip_path.rs index 819b98e83b7..8b5ee9175f6 100644 --- a/components/layout_2020/display_list/clip_path.rs +++ b/components/layout_2020/display_list/clip_path.rs @@ -8,11 +8,11 @@ use style::values::computed::length_percentage::NonNegativeLengthPercentage; use style::values::computed::position::Position; use style::values::generics::basic_shape::{GenericShapeRadius, ShapeBox, ShapeGeometryBox}; use style::values::generics::position::GenericPositionOrAuto; -use webrender_api::units::{LayoutRect, LayoutSideOffsets, LayoutSize}; use webrender_api::ClipChainId; +use webrender_api::units::{LayoutRect, LayoutSideOffsets, LayoutSize}; use webrender_traits::display_list::ScrollTreeNodeId; -use super::{compute_margin_box_radius, normalize_radii, BuilderForBoxFragment, DisplayList}; +use super::{BuilderForBoxFragment, DisplayList, compute_margin_box_radius, normalize_radii}; pub(super) fn build_clip_path_clip_chain_if_necessary( clip_path: ClipPath, diff --git a/components/layout_2020/display_list/conversions.rs b/components/layout_2020/display_list/conversions.rs index 79f2ec5f63f..6d78a17e886 100644 --- a/components/layout_2020/display_list/conversions.rs +++ b/components/layout_2020/display_list/conversions.rs @@ -11,7 +11,7 @@ use style::computed_values::transform_style::T as ComputedTransformStyle; use style::values::computed::Filter as ComputedFilter; use style::values::specified::border::BorderImageRepeatKeyword; use webrender_api::{ - units, FilterOp, ImageRendering, LineStyle, MixBlendMode, RepeatMode, Shadow, TransformStyle, + FilterOp, ImageRendering, LineStyle, MixBlendMode, RepeatMode, Shadow, TransformStyle, units, }; use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize}; diff --git a/components/layout_2020/display_list/gradient.rs b/components/layout_2020/display_list/gradient.rs index 71b6ec1f47c..26f6882f49c 100644 --- a/components/layout_2020/display_list/gradient.rs +++ b/components/layout_2020/display_list/gradient.rs @@ -4,6 +4,7 @@ use app_units::Au; use euclid::Size2D; +use style::Zero; use style::color::mix::ColorInterpolationMethod; use style::properties::ComputedValues; use style::values::computed::image::{EndingShape, Gradient, LineDirection}; @@ -11,11 +12,10 @@ use style::values::computed::{Angle, AngleOrPercentage, Color, LengthPercentage, use style::values::generics::image::{ Circle, ColorStop, Ellipse, GradientFlags, GradientItem, ShapeExtent, }; -use style::Zero; use webrender_api::units::LayoutPixel; use webrender_api::{ - self as wr, units, ConicGradient as WebRenderConicGradient, - Gradient as WebRenderLinearGradient, RadialGradient as WebRenderRadialGradient, + self as wr, ConicGradient as WebRenderConicGradient, Gradient as WebRenderLinearGradient, + RadialGradient as WebRenderRadialGradient, units, }; use wr::ColorF; diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 6bd08ad9f1a..5f2e709530a 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -13,27 +13,27 @@ use fonts::GlyphStore; use gradient::WebRenderGradient; use net_traits::image_cache::UsePlaceholder; use servo_geometry::MaxRect; +use style::Zero; use style::color::{AbsoluteColor, ColorSpace}; use style::computed_values::border_image_outset::T as BorderImageOutset; use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle; use style::dom::OpaqueNode; +use style::properties::ComputedValues; use style::properties::longhands::visibility::computed_value::T as Visibility; use style::properties::style_structs::Border; -use style::properties::ComputedValues; use style::values::computed::image::Image; use style::values::computed::{ BorderImageSideWidth, BorderImageWidth, BorderStyle, LengthPercentage, NonNegativeLengthOrNumber, NumberOrPercentage, OutlineStyle, }; -use style::values::generics::rect::Rect; use style::values::generics::NonNegative; +use style::values::generics::rect::Rect; use style::values::specified::text::TextDecorationLine; use style::values::specified::ui::CursorKind; -use style::Zero; use webrender_api::units::{DevicePixel, LayoutPixel, LayoutRect, LayoutSize}; use webrender_api::{ - self as wr, units, BorderDetails, BoxShadowClipMode, ClipChainId, CommonItemProperties, - ImageRendering, NinePatchBorder, NinePatchBorderSource, + self as wr, BorderDetails, BoxShadowClipMode, ClipChainId, CommonItemProperties, + ImageRendering, NinePatchBorder, NinePatchBorderSource, units, }; use webrender_traits::display_list::{ AxesScrollSensitivity, CompositorDisplayListInfo, ScrollTreeNodeId, @@ -1074,7 +1074,7 @@ impl<'a> BuilderForBoxFragment<'a> { } }, Image::CrossFade(_) | Image::ImageSet(_) | Image::None | Image::PaintWorklet(_) => { - return false + return false; }, }; diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs index be0f46769b5..a0d8a9f12e0 100644 --- a/components/layout_2020/display_list/stacking_context.rs +++ b/components/layout_2020/display_list/stacking_context.rs @@ -8,11 +8,12 @@ use std::mem; use app_units::Au; use base::print_tree::PrintTree; -use euclid::default::{Point2D, Rect, Size2D}; use euclid::SideOffsets2D; +use euclid::default::{Point2D, Rect, Size2D}; use log::warn; use servo_arc::Arc as ServoArc; use servo_config::opts::DebugOptions; +use style::Zero; use style::computed_values::float::T as ComputedFloat; use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode; use style::computed_values::overflow_x::T as ComputedOverflow; @@ -23,17 +24,16 @@ use style::values::computed::{ClipRectOrAuto, Length}; use style::values::generics::box_::Perspective; use style::values::generics::transform; use style::values::specified::box_::DisplayOutside; -use style::Zero; use webrender_api::units::{LayoutPoint, LayoutRect, LayoutTransform, LayoutVector2D}; use webrender_api::{self as wr, BorderRadius}; use webrender_traits::display_list::{AxesScrollSensitivity, ScrollTreeNodeId, ScrollableNodeInfo}; use wr::units::{LayoutPixel, LayoutSize}; use wr::{ClipChainId, SpatialTreeItemKey, StickyOffsetBounds}; -use super::clip_path::build_clip_path_clip_chain_if_necessary; use super::DisplayList; +use super::clip_path::build_clip_path_clip_chain_if_necessary; use crate::display_list::conversions::{FilterToWebRender, ToWebRender}; -use crate::display_list::{offset_radii, BuilderForBoxFragment, DisplayListBuilder}; +use crate::display_list::{BuilderForBoxFragment, DisplayListBuilder, offset_radii}; use crate::fragment_tree::{ BoxFragment, ContainingBlockManager, Fragment, FragmentFlags, FragmentTree, PositioningFragment, SpecificLayoutInfo, @@ -486,28 +486,31 @@ impl StackingContext { self.real_stacking_contexts_and_positioned_stacking_containers .sort_by_key(|a| a.z_index()); - debug_assert!(self - .real_stacking_contexts_and_positioned_stacking_containers - .iter() - .all(|c| matches!( - c.context_type, - StackingContextType::RealStackingContext | - StackingContextType::PositionedStackingContainer - ))); - debug_assert!(self - .float_stacking_containers - .iter() - .all( - |c| c.context_type == StackingContextType::FloatStackingContainer && - c.z_index() == 0 - )); - debug_assert!(self - .atomic_inline_stacking_containers - .iter() - .all( - |c| c.context_type == StackingContextType::AtomicInlineStackingContainer && - c.z_index() == 0 - )); + debug_assert!( + self.real_stacking_contexts_and_positioned_stacking_containers + .iter() + .all(|c| matches!( + c.context_type, + StackingContextType::RealStackingContext | + StackingContextType::PositionedStackingContainer + )) + ); + debug_assert!( + self.float_stacking_containers + .iter() + .all( + |c| c.context_type == StackingContextType::FloatStackingContainer && + c.z_index() == 0 + ) + ); + debug_assert!( + self.atomic_inline_stacking_containers + .iter() + .all( + |c| c.context_type == StackingContextType::AtomicInlineStackingContainer && + c.z_index() == 0 + ) + ); } fn push_webrender_stacking_context_if_necessary( @@ -1056,9 +1059,10 @@ impl BoxFragment { // but all fragments that establish reference frames also establish // containing blocks for absolute and fixed descendants, so those // properties will be replaced before recursing into children. - assert!(self - .style - .establishes_containing_block_for_all_descendants(self.base.flags)); + assert!( + self.style + .establishes_containing_block_for_all_descendants(self.base.flags) + ); let adjusted_containing_block = ContainingBlock::new( containing_block .rect diff --git a/components/layout_2020/dom.rs b/components/layout_2020/dom.rs index 570226c88bd..6722b0c400d 100644 --- a/components/layout_2020/dom.rs +++ b/components/layout_2020/dom.rs @@ -22,8 +22,8 @@ use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom_traversal::WhichPseudoElement; use crate::flexbox::FlexLevelBox; -use crate::flow::inline::InlineItem; use crate::flow::BlockLevelBox; +use crate::flow::inline::InlineItem; use crate::geom::PhysicalSize; use crate::replaced::{CanvasInfo, CanvasSource}; use crate::taffy::TaffyItemBox; diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index 4383987404a..eca173ff838 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -5,7 +5,7 @@ use std::borrow::Cow; use std::iter::FusedIterator; -use html5ever::{local_name, LocalName}; +use html5ever::{LocalName, local_name}; use log::warn; use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use script_layout_interface::{LayoutElementType, LayoutNodeType}; diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout_2020/flexbox/layout.rs index cd05aa62d77..470f8d0b744 100644 --- a/components/layout_2020/flexbox/layout.rs +++ b/components/layout_2020/flexbox/layout.rs @@ -11,18 +11,18 @@ use itertools::izip; use rayon::iter::{ IndexedParallelIterator, IntoParallelRefIterator, ParallelDrainRange, ParallelIterator, }; +use style::Zero; use style::computed_values::position::T as Position; use style::logical_geometry::Direction; +use style::properties::ComputedValues; use style::properties::longhands::align_items::computed_value::T as AlignItems; use style::properties::longhands::box_sizing::computed_value::T as BoxSizing; use style::properties::longhands::flex_direction::computed_value::T as FlexDirection; use style::properties::longhands::flex_wrap::computed_value::T as FlexWrap; -use style::properties::ComputedValues; use style::values::computed::LengthPercentage; use style::values::generics::flex::GenericFlexBasis as FlexBasis; use style::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrNormal}; use style::values::specified::align::AlignFlags; -use style::Zero; use super::geom::{FlexAxis, FlexRelativeRect, FlexRelativeSides, FlexRelativeVec2}; use super::{ @@ -36,7 +36,7 @@ use crate::formatting_contexts::{ use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags}; use crate::geom::{AuOrAuto, LogicalRect, LogicalSides, LogicalVec2, Size, Sizes}; use crate::positioned::{ - relative_adjustement, AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, + AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, relative_adjustement, }; use crate::sizing::{ ComputeInlineContentSizes, ContentSizes, InlineContentSizesResult, IntrinsicSizingMode, @@ -2160,7 +2160,7 @@ impl FlexItem<'_> { cross_end, main_start, main_end, - } + }; }, (AuOrAuto::Auto, AuOrAuto::Auto) => 2, _ => 1, diff --git a/components/layout_2020/flexbox/mod.rs b/components/layout_2020/flexbox/mod.rs index 8583d26c88b..fbe2786d078 100644 --- a/components/layout_2020/flexbox/mod.rs +++ b/components/layout_2020/flexbox/mod.rs @@ -6,10 +6,10 @@ use app_units::Au; use geom::{FlexAxis, MainStartCrossStart}; use servo_arc::Arc as ServoArc; use style::logical_geometry::WritingMode; +use style::properties::ComputedValues; use style::properties::longhands::align_items::computed_value::T as AlignItems; use style::properties::longhands::flex_direction::computed_value::T as FlexDirection; use style::properties::longhands::flex_wrap::computed_value::T as FlexWrap; -use style::properties::ComputedValues; use style::values::computed::{AlignContent, JustifyContent}; use style::values::specified::align::AlignFlags; diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index 6c52d23a20d..0fcd1ce16f6 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -7,15 +7,16 @@ use std::convert::TryFrom; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use servo_arc::Arc; -use style::properties::longhands::list_style_position::computed_value::T as ListStylePosition; use style::properties::ComputedValues; +use style::properties::longhands::list_style_position::computed_value::T as ListStylePosition; use style::selector_parser::PseudoElement; use style::str::char_is_whitespace; +use super::OutsideMarker; +use super::inline::InlineFormattingContext; use super::inline::construct::InlineFormattingContextBuilder; use super::inline::inline_box::InlineBox; -use super::inline::InlineFormattingContext; -use super::OutsideMarker; +use crate::PropagatedBoxTreeData; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom::{BoxSlot, LayoutBox, NodeExt}; @@ -30,7 +31,6 @@ use crate::layout_box_base::LayoutBoxBase; use crate::positioned::AbsolutelyPositionedBox; use crate::style_ext::{ComputedValuesExt, DisplayGeneratingBox, DisplayInside, DisplayOutside}; use crate::table::{AnonymousTableContent, Table}; -use crate::PropagatedBoxTreeData; impl BlockFormattingContext { pub(crate) fn construct<'dom, Node>( @@ -204,9 +204,11 @@ where } pub(crate) fn finish(mut self) -> BlockContainer { - debug_assert!(!self - .inline_formatting_context_builder - .currently_processing_inline_box()); + debug_assert!( + !self + .inline_formatting_context_builder + .currently_processing_inline_box() + ); self.finish_anonymous_table_if_needed(); diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index a3a978f282d..f07c6a91594 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -26,7 +26,7 @@ use crate::dom_traversal::{Contents, NodeAndStyleInfo}; use crate::formatting_contexts::IndependentFormattingContext; use crate::fragment_tree::{BoxFragment, CollapsedMargin}; use crate::geom::{LogicalRect, LogicalVec2, ToLogical}; -use crate::positioned::{relative_adjustement, PositioningContext}; +use crate::positioned::{PositioningContext, relative_adjustement}; use crate::style_ext::{DisplayInside, PaddingBorderMargin}; use crate::{ContainingBlock, PropagatedBoxTreeData}; diff --git a/components/layout_2020/flow/inline/construct.rs b/components/layout_2020/flow/inline/construct.rs index 2e05e2f0056..9452d3ffb33 100644 --- a/components/layout_2020/flow/inline/construct.rs +++ b/components/layout_2020/flow/inline/construct.rs @@ -13,6 +13,7 @@ use unicode_bidi::Level; use super::text_run::TextRun; use super::{InlineBox, InlineBoxIdentifier, InlineBoxes, InlineFormattingContext, InlineItem}; +use crate::PropagatedBoxTreeData; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom::NodeExt; @@ -21,7 +22,6 @@ use crate::flow::float::FloatBox; use crate::formatting_contexts::IndependentFormattingContext; use crate::positioned::AbsolutelyPositionedBox; use crate::style_ext::ComputedValuesExt; -use crate::PropagatedBoxTreeData; #[derive(Default)] pub(crate) struct InlineFormattingContextBuilder { diff --git a/components/layout_2020/flow/inline/inline_box.rs b/components/layout_2020/flow/inline/inline_box.rs index 74bedba891b..8550a076184 100644 --- a/components/layout_2020/flow/inline/inline_box.rs +++ b/components/layout_2020/flow/inline/inline_box.rs @@ -9,14 +9,14 @@ use fonts::FontMetrics; use servo_arc::Arc; use style::properties::ComputedValues; -use super::{inline_container_needs_strut, InlineContainerState, InlineContainerStateFlags}; +use super::{InlineContainerState, InlineContainerStateFlags, inline_container_needs_strut}; +use crate::ContainingBlock; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom::NodeExt; use crate::dom_traversal::NodeAndStyleInfo; use crate::fragment_tree::BaseFragmentInfo; use crate::style_ext::{LayoutStyle, PaddingBorderMargin}; -use crate::ContainingBlock; #[derive(Debug)] pub(crate) struct InlineBox { diff --git a/components/layout_2020/flow/inline/line.rs b/components/layout_2020/flow/inline/line.rs index ebe9b95c7c3..88ba145fe42 100644 --- a/components/layout_2020/flow/inline/line.rs +++ b/components/layout_2020/flow/inline/line.rs @@ -7,6 +7,7 @@ use bitflags::bitflags; use fonts::{FontMetrics, GlyphStore}; use itertools::Either; use servo_arc::Arc; +use style::Zero; use style::computed_values::position::T as Position; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; use style::properties::ComputedValues; @@ -15,7 +16,6 @@ use style::values::generics::font::LineHeight; use style::values::specified::align::AlignFlags; use style::values::specified::box_::DisplayOutside; use style::values::specified::text::TextDecorationLine; -use style::Zero; use unicode_bidi::{BidiInfo, Level}; use webrender_api::FontInstanceKey; @@ -27,7 +27,7 @@ use crate::fragment_tree::{ }; use crate::geom::{LogicalRect, LogicalVec2, PhysicalRect, ToLogical}; use crate::positioned::{ - relative_adjustement, AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, + AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, relative_adjustement, }; use crate::{ContainingBlock, ContainingBlockSize}; diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs index 828d490db82..18a076227b5 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/components/layout_2020/flow/inline/mod.rs @@ -89,28 +89,28 @@ use line::{ }; use line_breaker::LineBreaker; use servo_arc::Arc; +use style::Zero; use style::computed_values::text_wrap_mode::T as TextWrapMode; use style::computed_values::vertical_align::T as VerticalAlign; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; use style::context::QuirksMode; -use style::properties::style_structs::InheritedText; use style::properties::ComputedValues; +use style::properties::style_structs::InheritedText; use style::values::generics::box_::VerticalAlignKeyword; use style::values::generics::font::LineHeight; use style::values::specified::box_::BaselineSource; use style::values::specified::text::{TextAlignKeyword, TextDecorationLine}; use style::values::specified::{TextAlignLast, TextJustify}; -use style::Zero; use text_run::{ - add_or_get_font, get_font_for_first_font_for_style, TextRun, XI_LINE_BREAKING_CLASS_GL, - XI_LINE_BREAKING_CLASS_WJ, XI_LINE_BREAKING_CLASS_ZWJ, + TextRun, XI_LINE_BREAKING_CLASS_GL, XI_LINE_BREAKING_CLASS_WJ, XI_LINE_BREAKING_CLASS_ZWJ, + add_or_get_font, get_font_for_first_font_for_style, }; use unicode_bidi::{BidiInfo, Level}; use webrender_api::FontInstanceKey; use xi_unicode::linebreak_property; -use super::float::{Clear, PlacementAmongFloats}; use super::IndependentFormattingContextContents; +use super::float::{Clear, PlacementAmongFloats}; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::flow::float::{FloatBox, SequentialLayoutState}; diff --git a/components/layout_2020/flow/inline/text_run.rs b/components/layout_2020/flow/inline/text_run.rs index a10664ee672..ead6c394131 100644 --- a/components/layout_2020/flow/inline/text_run.rs +++ b/components/layout_2020/flow/inline/text_run.rs @@ -8,7 +8,7 @@ use std::ops::Range; use app_units::Au; use base::text::is_bidi_control; use fonts::{ - FontContext, FontRef, GlyphRun, ShapingFlags, ShapingOptions, LAST_RESORT_GLYPH_ADVANCE, + FontContext, FontRef, GlyphRun, LAST_RESORT_GLYPH_ADVANCE, ShapingFlags, ShapingOptions, }; use fonts_traits::ByteIndex; use log::warn; diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 09561114cda..d57d60da8d1 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -9,6 +9,7 @@ use app_units::{Au, MAX_AU}; use inline::InlineFormattingContext; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use servo_arc::Arc; +use style::Zero; use style::computed_values::clear::T as StyleClear; use style::logical_geometry::Direction; use style::properties::ComputedValues; @@ -16,7 +17,6 @@ use style::servo::selector_parser::PseudoElement; use style::values::computed::Size as StyleSize; use style::values::specified::align::AlignFlags; use style::values::specified::{Display, TextAlignKeyword}; -use style::Zero; use crate::cell::ArcRefCell; use crate::context::LayoutContext; @@ -815,10 +815,10 @@ impl BlockLevelBox { BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => &box_.borrow().context, BlockLevelBox::OutOfFlowFloatBox(float_box) => &float_box.contents, BlockLevelBox::OutsideMarker(outside_marker) => { - return outside_marker.inline_content_sizes(layout_context, constraint_space) + return outside_marker.inline_content_sizes(layout_context, constraint_space); }, BlockLevelBox::SameFormattingContextBlock { base, contents, .. } => { - return base.inline_content_sizes(layout_context, constraint_space, contents) + return base.inline_content_sizes(layout_context, constraint_space, contents); }, }; independent_formatting_context.inline_content_sizes(layout_context, constraint_space) diff --git a/components/layout_2020/flow/root.rs b/components/layout_2020/flow/root.rs index 55c47589a4d..5b7cf077bab 100644 --- a/components/layout_2020/flow/root.rs +++ b/components/layout_2020/flow/root.rs @@ -18,7 +18,7 @@ use webrender_traits::display_list::AxesScrollSensitivity; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom::{LayoutBox, NodeExt}; -use crate::dom_traversal::{iter_child_nodes, Contents, NodeAndStyleInfo, NonReplacedContents}; +use crate::dom_traversal::{Contents, NodeAndStyleInfo, NonReplacedContents, iter_child_nodes}; use crate::flexbox::FlexLevelBox; use crate::flow::float::FloatBox; use crate::flow::inline::InlineItem; diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout_2020/fragment_tree/base_fragment.rs index 6404c340c00..39d06ca121a 100644 --- a/components/layout_2020/fragment_tree/base_fragment.rs +++ b/components/layout_2020/fragment_tree/base_fragment.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use bitflags::bitflags; -use script_layout_interface::{combine_id_with_fragment_type, FragmentType}; +use script_layout_interface::{FragmentType, combine_id_with_fragment_type}; use style::dom::OpaqueNode; use style::selector_parser::PseudoElement; diff --git a/components/layout_2020/fragment_tree/box_fragment.rs b/components/layout_2020/fragment_tree/box_fragment.rs index 50353677ff8..1c8862b0822 100644 --- a/components/layout_2020/fragment_tree/box_fragment.rs +++ b/components/layout_2020/fragment_tree/box_fragment.rs @@ -6,12 +6,12 @@ use app_units::Au; use atomic_refcell::AtomicRefCell; use base::print_tree::PrintTree; use servo_arc::Arc as ServoArc; +use style::Zero; use style::computed_values::border_collapse::T as BorderCollapse; use style::computed_values::overflow_x::T as ComputedOverflow; use style::computed_values::position::T as ComputedPosition; use style::logical_geometry::WritingMode; use style::properties::ComputedValues; -use style::Zero; use super::{BaseFragment, BaseFragmentInfo, CollapsedBlockMargins, Fragment}; use crate::formatting_contexts::Baselines; diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout_2020/fragment_tree/fragment.rs index fdc8f75bb9a..ba52f28bc3b 100644 --- a/components/layout_2020/fragment_tree/fragment.rs +++ b/components/layout_2020/fragment_tree/fragment.rs @@ -9,9 +9,9 @@ use base::id::PipelineId; use base::print_tree::PrintTree; use fonts::{FontMetrics, GlyphStore}; use servo_arc::Arc as ServoArc; +use style::Zero; use style::properties::ComputedValues; use style::values::specified::text::TextDecorationLine; -use style::Zero; use webrender_api::{FontInstanceKey, ImageKey}; use super::{ diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs index 8b389a524f0..eeaf95c8c5d 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout_2020/geom.rs @@ -8,17 +8,17 @@ use std::fmt; use std::ops::{Add, AddAssign, Neg, Sub, SubAssign}; use app_units::{Au, MAX_AU}; +use style::Zero; use style::logical_geometry::{BlockFlowDirection, Direction, InlineBaseDirection, WritingMode}; use style::values::computed::{ CSSPixelLength, LengthPercentage, MaxSize as StyleMaxSize, Percentage, Size as StyleSize, }; use style::values::generics::length::GenericLengthPercentageOrAuto as AutoOr; -use style::Zero; use style_traits::CSSPixel; +use crate::ContainingBlock; use crate::sizing::ContentSizes; use crate::style_ext::Clamp; -use crate::ContainingBlock; pub type PhysicalPoint<U> = euclid::Point2D<U, CSSPixel>; pub type PhysicalSize<U> = euclid::Size2D<U, CSSPixel>; diff --git a/components/layout_2020/layout_box_base.rs b/components/layout_2020/layout_box_base.rs index 4bd2e9c83af..0de9987bde7 100644 --- a/components/layout_2020/layout_box_base.rs +++ b/components/layout_2020/layout_box_base.rs @@ -6,11 +6,11 @@ use atomic_refcell::AtomicRefCell; use servo_arc::Arc; use style::properties::ComputedValues; +use crate::ConstraintSpace; use crate::context::LayoutContext; use crate::fragment_tree::BaseFragmentInfo; use crate::geom::SizeConstraint; use crate::sizing::{ComputeInlineContentSizes, InlineContentSizesResult}; -use crate::ConstraintSpace; /// A box tree node that handles containing information about style and the original DOM /// node or pseudo-element that it is based on. This also handles caching of layout values diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 614dea8c882..635d2a23ae5 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -7,11 +7,11 @@ use std::mem; use app_units::Au; use rayon::iter::IntoParallelRefMutIterator; use rayon::prelude::{IndexedParallelIterator, ParallelIterator}; +use style::Zero; use style::computed_values::position::T as Position; use style::logical_geometry::{Direction, WritingMode}; use style::properties::ComputedValues; use style::values::specified::align::AlignFlags; -use style::Zero; use crate::cell::ArcRefCell; use crate::context::LayoutContext; @@ -488,7 +488,7 @@ impl HoistedAbsolutelyPositionedBox { end: box_offset.inline_end, }; let inline_alignment = match inline_box_offsets.either_specified() { - true => style.clone_justify_self().0 .0, + true => style.clone_justify_self().0.0, false => shared_fragment.resolved_alignment.inline, }; @@ -515,7 +515,7 @@ impl HoistedAbsolutelyPositionedBox { end: box_offset.block_end, }; let block_alignment = match block_box_offsets.either_specified() { - true => style.clone_align_self().0 .0, + true => style.clone_align_self().0.0, false => shared_fragment.resolved_alignment.block, }; let mut block_axis_solver = AbsoluteAxisSolver { @@ -938,7 +938,7 @@ impl AbsoluteAxisSolver<'_> { // Therefore the free space is zero and the alignment value is irrelevant. (Some(start), None) => return start.to_used_value(self.containing_size), (None, Some(end)) => { - return self.containing_size - size - end.to_used_value(self.containing_size) + return self.containing_size - size - end.to_used_value(self.containing_size); }, }; diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index a8cade847c5..13f7f82b15c 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -24,8 +24,8 @@ use style::context::{QuirksMode, SharedStyleContext, StyleContext, ThreadLocalSt use style::dom::{OpaqueNode, TElement}; use style::properties::style_structs::Font; use style::properties::{ - parse_one_declaration_into, ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, - PropertyDeclarationId, PropertyId, ShorthandId, SourcePropertyDeclaration, + ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, PropertyDeclarationId, + PropertyId, ShorthandId, SourcePropertyDeclaration, parse_one_declaration_into, }; use style::selector_parser::PseudoElement; use style::shared_lock::SharedRwLock; @@ -34,8 +34,8 @@ use style::stylist::RuleInclusion; use style::traversal::resolve_style; use style::values::computed::Float; use style::values::generics::font::LineHeight; -use style::values::specified::box_::DisplayInside; use style::values::specified::GenericGridTemplateComponent; +use style::values::specified::box_::DisplayInside; use style_traits::{ParsingMode, ToCss}; use crate::flow::inline::construct::{TextTransformation, WhitespaceCollapse}; @@ -200,13 +200,13 @@ pub fn process_resolved_style_request<'dom>( match longhand_id { LonghandId::Top => return Some(resolved_insets().top.to_css_string()), LonghandId::Right => { - return Some(resolved_insets().right.to_css_string()) + return Some(resolved_insets().right.to_css_string()); }, LonghandId::Bottom => { - return Some(resolved_insets().bottom.to_css_string()) + return Some(resolved_insets().bottom.to_css_string()); }, LonghandId::Left => { - return Some(resolved_insets().left.to_css_string()) + return Some(resolved_insets().left.to_css_string()); }, _ => {}, } diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index b4ee3fd4a51..3ac8fa8f103 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -16,13 +16,13 @@ use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use pixels::Image; use script_layout_interface::IFrameSize; use servo_arc::Arc as ServoArc; +use style::Zero; use style::computed_values::object_fit::T as ObjectFit; use style::logical_geometry::{Direction, WritingMode}; use style::properties::ComputedValues; use style::servo::url::ComputedUrl; -use style::values::computed::image::Image as ComputedImage; use style::values::CSSFloat; -use style::Zero; +use style::values::computed::image::Image as ComputedImage; use url::Url; use webrender_api::ImageKey; diff --git a/components/layout_2020/sizing.rs b/components/layout_2020/sizing.rs index 1e53eb251eb..310816207bc 100644 --- a/components/layout_2020/sizing.rs +++ b/components/layout_2020/sizing.rs @@ -8,8 +8,8 @@ use std::cell::LazyCell; use std::ops::{Add, AddAssign}; use app_units::Au; -use style::values::computed::LengthPercentage; use style::Zero; +use style::values::computed::LengthPercentage; use crate::context::LayoutContext; use crate::geom::Size; diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index faf1b142109..06a9a49e8c3 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; +use style::Zero; use style::color::AbsoluteColor; use style::computed_values::direction::T as Direction; use style::computed_values::isolation::T as ComputedIsolation; @@ -11,21 +12,20 @@ use style::computed_values::position::T as ComputedPosition; use style::computed_values::transform_style::T as ComputedTransformStyle; use style::computed_values::unicode_bidi::T as UnicodeBidi; use style::logical_geometry::{Direction as AxisDirection, WritingMode}; +use style::properties::ComputedValues; use style::properties::longhands::backface_visibility::computed_value::T as BackfaceVisiblity; use style::properties::longhands::box_sizing::computed_value::T as BoxSizing; use style::properties::longhands::column_span::computed_value::T as ColumnSpan; use style::properties::style_structs::Border; -use style::properties::ComputedValues; use style::servo::selector_parser::PseudoElement; +use style::values::CSSFloat; use style::values::computed::basic_shape::ClipPath; use style::values::computed::image::Image as ComputedImageLayer; use style::values::computed::{AlignItems, BorderStyle, Color, Inset, LengthPercentage, Margin}; use style::values::generics::box_::Perspective; use style::values::generics::position::{GenericAspectRatio, PreferredRatio}; use style::values::specified::align::AlignFlags; -use style::values::specified::{box_ as stylo, Overflow}; -use style::values::CSSFloat; -use style::Zero; +use style::values::specified::{Overflow, box_ as stylo}; use webrender_api as wr; use crate::dom_traversal::Contents; @@ -802,7 +802,7 @@ impl ComputedValuesExt for ComputedValues { resolved_auto_value: AlignItems, resolved_normal_value: AlignItems, ) -> AlignItems { - match self.clone_align_self().0 .0 { + match self.clone_align_self().0.0 { AlignFlags::AUTO => resolved_auto_value, AlignFlags::NORMAL => resolved_normal_value, value => AlignItems(value), @@ -1033,7 +1033,7 @@ impl From<stylo::Display> for Display { // This should not be a value of DisplayInside, but oh well // special-case display: contents because we still want it to work despite the early return stylo::DisplayOutside::None if inside == stylo::DisplayInside::Contents => { - return Display::Contents + return Display::Contents; }, stylo::DisplayOutside::None => return Display::None, }; diff --git a/components/layout_2020/table/construct.rs b/components/layout_2020/table/construct.rs index ccf09687085..f6578033043 100644 --- a/components/layout_2020/table/construct.rs +++ b/components/layout_2020/table/construct.rs @@ -9,8 +9,8 @@ use std::iter::repeat; use log::warn; use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use servo_arc::Arc; -use style::properties::style_structs::Font; use style::properties::ComputedValues; +use style::properties::style_structs::Font; use style::selector_parser::PseudoElement; use style::str::char_is_whitespace; @@ -18,6 +18,7 @@ use super::{ Table, TableCaption, TableSlot, TableSlotCell, TableSlotCoordinates, TableSlotOffset, TableTrack, TableTrackGroup, TableTrackGroupType, }; +use crate::PropagatedBoxTreeData; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::dom::{BoxSlot, NodeExt}; @@ -30,7 +31,6 @@ use crate::formatting_contexts::{ use crate::fragment_tree::BaseFragmentInfo; use crate::layout_box_base::LayoutBoxBase; use crate::style_ext::{DisplayGeneratingBox, DisplayLayoutInternal}; -use crate::PropagatedBoxTreeData; /// A reference to a slot and its coordinates in the table #[derive(Clone, Copy, Debug)] @@ -187,7 +187,9 @@ impl TableSlot { pub fn push_spanned(&mut self, new_offset: TableSlotOffset) { match *self { TableSlot::Cell { .. } => { - panic!("Should never have a table model error with an originating cell slot overlapping a spanned slot") + panic!( + "Should never have a table model error with an originating cell slot overlapping a spanned slot" + ) }, TableSlot::Spanned(ref mut vec) => vec.insert(0, new_offset), TableSlot::Empty => { diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index b581f1ce8dc..acb24445b28 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -10,6 +10,7 @@ use app_units::Au; use log::warn; use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator}; use servo_arc::Arc; +use style::Zero; use style::computed_values::border_collapse::T as BorderCollapse; use style::computed_values::box_sizing::T as BoxSizing; use style::computed_values::caption_side::T as CaptionSide; @@ -22,7 +23,6 @@ use style::values::computed::{ BorderStyle, LengthPercentage as ComputedLengthPercentage, Percentage, }; use style::values::generics::box_::{GenericVerticalAlign as VerticalAlign, VerticalAlignKeyword}; -use style::Zero; use super::{ ArcRefCell, CollapsedBorder, CollapsedBorderLine, SpecificTableGridInfo, Table, TableCaption, @@ -38,7 +38,7 @@ use crate::geom::{ LogicalRect, LogicalSides, LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalVec, Size, SizeConstraint, ToLogical, ToLogicalWithContainingBlock, }; -use crate::positioned::{relative_adjustement, PositioningContext, PositioningContextLength}; +use crate::positioned::{PositioningContext, PositioningContextLength, relative_adjustement}; use crate::sizing::{ComputeInlineContentSizes, ContentSizes, InlineContentSizesResult}; use crate::style_ext::{ BorderStyleColor, Clamp, ComputedValuesExt, LayoutStyle, PaddingBorderMargin, diff --git a/components/layout_2020/table/mod.rs b/components/layout_2020/table/mod.rs index 25c0decebad..81bc9285b5a 100644 --- a/components/layout_2020/table/mod.rs +++ b/components/layout_2020/table/mod.rs @@ -75,8 +75,8 @@ pub(crate) use construct::AnonymousTableContent; pub use construct::TableBuilder; use euclid::{Point2D, Size2D, UnknownUnit, Vector2D}; use servo_arc::Arc; -use style::properties::style_structs::Font; use style::properties::ComputedValues; +use style::properties::style_structs::Font; use style_traits::dom::OpaqueNode; use super::flow::BlockFormattingContext; diff --git a/components/layout_2020/taffy/layout.rs b/components/layout_2020/taffy/layout.rs index 217a2a7f5de..2bee4c590f8 100644 --- a/components/layout_2020/taffy/layout.rs +++ b/components/layout_2020/taffy/layout.rs @@ -4,10 +4,10 @@ use app_units::Au; use atomic_refcell::{AtomicRef, AtomicRefCell}; +use style::Zero; use style::properties::ComputedValues; use style::values::specified::align::AlignFlags; use style::values::specified::box_::DisplayInside; -use style::Zero; use taffy::style_helpers::{TaffyMaxContent, TaffyMinContent}; use taffy::{AvailableSpace, MaybeMath, RequestedAxis, RunMode}; @@ -619,11 +619,11 @@ impl TaffyContainer { )), LogicalVec2 { inline: resolve_alignment( - child.style.clone_align_self().0 .0, + child.style.clone_align_self().0.0, align_items.0, ), block: resolve_alignment( - child.style.clone_justify_self().0 .0, + child.style.clone_justify_self().0.0, justify_items.computed.0, ), }, diff --git a/components/layout_2020/taffy/mod.rs b/components/layout_2020/taffy/mod.rs index e163fdfaac8..626704874d2 100644 --- a/components/layout_2020/taffy/mod.rs +++ b/components/layout_2020/taffy/mod.rs @@ -10,6 +10,7 @@ use servo_arc::Arc; use style::properties::ComputedValues; use stylo_taffy::TaffyStyloStyle; +use crate::PropagatedBoxTreeData; use crate::cell::ArcRefCell; use crate::construct_modern::{ModernContainerBuilder, ModernItemKind}; use crate::context::LayoutContext; @@ -18,7 +19,6 @@ use crate::dom_traversal::{NodeAndStyleInfo, NonReplacedContents}; use crate::formatting_contexts::IndependentFormattingContext; use crate::fragment_tree::Fragment; use crate::positioned::{AbsolutelyPositionedBox, PositioningContext}; -use crate::PropagatedBoxTreeData; #[derive(Debug)] pub(crate) struct TaffyContainer { diff --git a/components/layout_2020/taffy/stylo_taffy/convert.rs b/components/layout_2020/taffy/stylo_taffy/convert.rs index ec80ef8603a..9baf026793c 100644 --- a/components/layout_2020/taffy/stylo_taffy/convert.rs +++ b/components/layout_2020/taffy/stylo_taffy/convert.rs @@ -8,11 +8,11 @@ mod stylo { pub(crate) use style::properties::longhands::aspect_ratio::computed_value::T as AspectRatio; pub(crate) use style::properties::longhands::position::computed_value::T as Position; pub(crate) use style::values::computed::{LengthPercentage, Percentage}; + pub(crate) use style::values::generics::NonNegative; pub(crate) use style::values::generics::length::{ GenericLengthPercentageOrNormal, GenericMargin, GenericMaxSize, GenericSize, }; pub(crate) use style::values::generics::position::{Inset as GenericInset, PreferredRatio}; - pub(crate) use style::values::generics::NonNegative; pub(crate) use style::values::specified::align::{AlignFlags, ContentDistribution}; pub(crate) use style::values::specified::box_::{ Display, DisplayInside, DisplayOutside, Overflow, @@ -157,7 +157,7 @@ pub fn overflow(input: stylo::Overflow) -> taffy::Overflow { pub fn aspect_ratio(input: stylo::AspectRatio) -> Option<f32> { match input.ratio { stylo::PreferredRatio::None => None, - stylo::PreferredRatio::Ratio(val) => Some(val.0 .0 / val.1 .0), + stylo::PreferredRatio::Ratio(val) => Some(val.0.0 / val.1.0), } } diff --git a/components/layout_2020/taffy/stylo_taffy/wrapper.rs b/components/layout_2020/taffy/stylo_taffy/wrapper.rs index ec0575121c4..35b19aa7838 100644 --- a/components/layout_2020/taffy/stylo_taffy/wrapper.rs +++ b/components/layout_2020/taffy/stylo_taffy/wrapper.rs @@ -216,11 +216,11 @@ impl<T: Deref<Target = ComputedValues>> taffy::GridItemStyle for TaffyStyloStyle #[inline] fn align_self(&self) -> Option<taffy::AlignSelf> { - convert::item_alignment(self.0.get_position().align_self.0 .0) + convert::item_alignment(self.0.get_position().align_self.0.0) } #[inline] fn justify_self(&self) -> Option<taffy::AlignSelf> { - convert::item_alignment(self.0.get_position().justify_self.0 .0) + convert::item_alignment(self.0.get_position().justify_self.0.0) } } diff --git a/components/layout_2020/traversal.rs b/components/layout_2020/traversal.rs index 0ce4cbae418..40281b640c9 100644 --- a/components/layout_2020/traversal.rs +++ b/components/layout_2020/traversal.rs @@ -6,7 +6,7 @@ use script_layout_interface::wrapper_traits::LayoutNode; use style::context::{SharedStyleContext, StyleContext}; use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; -use style::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData}; +use style::traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at}; use crate::context::LayoutContext; use crate::dom::DOMLayoutData; diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 8c275230b23..98637f7e96c 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -14,15 +14,15 @@ use std::process; use std::sync::{Arc, LazyLock, Mutex}; use app_units::Au; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::{PipelineId, WebViewId}; -use base::Epoch; use embedder_traits::resources::{self, Resource}; use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D}; use euclid::{Point2D, Rect, Scale, Size2D}; use fnv::FnvHashMap; use fonts::{ - get_and_reset_text_shaping_performance_counter, FontContext, FontContextWebFontMethods, + FontContext, FontContextWebFontMethods, get_and_reset_text_shaping_performance_counter, }; use fonts_traits::StylesheetWebFontLoadFinishedCallback; use fxhash::{FxHashMap, FxHashSet}; @@ -41,8 +41,8 @@ use layout::query::{ process_scrolling_area_request, }; use layout::traversal::{ - construct_flows_at_ancestors, ComputeStackingRelativePositions, PreorderFlowTraversal, - RecalcStyleAndConstructFlows, + ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows, + construct_flows_at_ancestors, }; use layout::wrapper::ThreadSafeLayoutNodeHelpers; use layout::{parallel, sequential}; @@ -103,7 +103,7 @@ use style_traits::{CSSPixel, SpeculativePainter}; use time::Duration; use url::Url; use webrender_api::units::DevicePixel; -use webrender_api::{units, ColorF, HitTestFlags}; +use webrender_api::{ColorF, HitTestFlags, units}; use webrender_traits::CrossProcessCompositorApi; // This mutex is necessary due to syncronisation issues between two different types of thread-local storage diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index 80d98ebb7d6..ab709bce7c8 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -15,9 +15,9 @@ use std::process; use std::sync::{Arc, LazyLock}; use app_units::Au; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::{PipelineId, WebViewId}; -use base::Epoch; use embedder_traits::resources::{self, Resource}; use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D}; use euclid::{Point2D, Scale, Size2D, Vector2D}; @@ -85,11 +85,11 @@ use style::traversal_flags::TraversalFlags; use style::values::computed::font::GenericFontFamily; use style::values::computed::{CSSPixelLength, FontSize, Length, NonNegativeLength}; use style::values::specified::font::KeywordInfo; -use style::{driver, Zero}; +use style::{Zero, driver}; use style_traits::{CSSPixel, SpeculativePainter}; use url::Url; use webrender_api::units::{DevicePixel, LayoutPixel}; -use webrender_api::{units, ExternalScrollId, HitTestFlags}; +use webrender_api::{ExternalScrollId, HitTestFlags, units}; use webrender_traits::CrossProcessCompositorApi; // This mutex is necessary due to syncronisation issues between two different types of thread-local storage diff --git a/components/media/lib.rs b/components/media/lib.rs index 7de19cb6121..69b60b62275 100644 --- a/components/media/lib.rs +++ b/components/media/lib.rs @@ -10,7 +10,7 @@ mod media_thread; use std::sync::{Arc, Mutex}; use euclid::default::Size2D; -use ipc_channel::ipc::{channel, IpcReceiver, IpcSender}; +use ipc_channel::ipc::{IpcReceiver, IpcSender, channel}; use log::warn; use serde::{Deserialize, Serialize}; use servo_config::pref; diff --git a/components/media/media_thread.rs b/components/media/media_thread.rs index 7780323345c..7972ac9e70c 100644 --- a/components/media/media_thread.rs +++ b/components/media/media_thread.rs @@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use fnv::FnvHashMap; -use ipc_channel::ipc::{channel, IpcSender}; +use ipc_channel::ipc::{IpcSender, channel}; use log::{trace, warn}; use webrender_api::ExternalImageId; use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType}; diff --git a/components/metrics/lib.rs b/components/metrics/lib.rs index 222b0cfa000..8b09e06bd16 100644 --- a/components/metrics/lib.rs +++ b/components/metrics/lib.rs @@ -7,13 +7,13 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::time::Duration; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::PipelineId; -use base::Epoch; use ipc_channel::ipc::IpcSender; use log::warn; use malloc_size_of_derive::MallocSizeOf; -use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan, TimerMetadata}; +use profile_traits::time::{ProfilerCategory, ProfilerChan, TimerMetadata, send_profile_data}; use script_traits::{LayoutMsg, ProgressiveWebMetricType, ScriptThreadMessage}; use servo_config::opts; use servo_url::ServoUrl; diff --git a/components/net/connector.rs b/components/net/connector.rs index dffa14ae7eb..12d0638d84d 100644 --- a/components/net/connector.rs +++ b/components/net/connector.rs @@ -6,15 +6,15 @@ use std::collections::hash_map::HashMap; use std::convert::TryFrom; use std::sync::{Arc, Mutex}; -use futures::task::{Context, Poll}; use futures::Future; +use futures::task::{Context, Poll}; use http::uri::{Authority, Uri as Destination}; use http_body_util::combinators::BoxBody; use hyper::body::Bytes; use hyper::rt::Executor; use hyper_rustls::HttpsConnector as HyperRustlsHttpsConnector; -use hyper_util::client::legacy::connect::HttpConnector as HyperHttpConnector; use hyper_util::client::legacy::Client; +use hyper_util::client::legacy::connect::HttpConnector as HyperHttpConnector; use log::warn; use rustls::client::WebPkiServerVerifier; use rustls::{ClientConfig, RootCertStore}; diff --git a/components/net/cookie.rs b/components/net/cookie.rs index d39d1b3b2a7..58780e4132e 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -10,8 +10,8 @@ use std::net::{Ipv4Addr, Ipv6Addr}; use std::time::SystemTime; use cookie::Cookie; -use net_traits::pub_domains::is_pub_domain; use net_traits::CookieSource; +use net_traits::pub_domains::is_pub_domain; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs index 7c116734e23..6a9c88b0756 100644 --- a/components/net/cookie_storage.rs +++ b/components/net/cookie_storage.rs @@ -6,13 +6,13 @@ //! <http://tools.ietf.org/html/rfc6265> use std::cmp::Ordering; -use std::collections::hash_map::Entry; use std::collections::HashMap; +use std::collections::hash_map::Entry; use std::time::SystemTime; use log::{debug, info}; -use net_traits::pub_domains::reg_suffix; use net_traits::CookieSource; +use net_traits::pub_domains::reg_suffix; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; diff --git a/components/net/decoder.rs b/components/net/decoder.rs index 4b4fcb18e24..65399cc2bbc 100644 --- a/components/net/decoder.rs +++ b/components/net/decoder.rs @@ -29,9 +29,9 @@ use futures::{Future, Stream}; use futures_util::StreamExt; use headers::{ContentLength, HeaderMapExt}; use http_body_util::BodyExt; -use hyper::body::Body; -use hyper::header::{HeaderValue, CONTENT_ENCODING, TRANSFER_ENCODING}; use hyper::Response; +use hyper::body::Body; +use hyper::header::{CONTENT_ENCODING, HeaderValue, TRANSFER_ENCODING}; use tokio_util::codec::{BytesCodec, FramedRead}; use tokio_util::io::StreamReader; diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index 246be69b351..8d9ecc9529c 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -11,8 +11,8 @@ use std::time::{Duration, Instant}; -use http::header::HeaderName; use http::Method; +use http::header::HeaderName; use net_traits::request::{CredentialsMode, Origin, Request}; use servo_url::ServoUrl; diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index cd23e61d60d..4d40cb78b15 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -7,8 +7,8 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; use std::{io, mem, str}; -use base64::engine::general_purpose; use base64::Engine as _; +use base64::engine::general_purpose; use content_security_policy as csp; use crossbeam_channel::Sender; use devtools_traits::DevtoolsControlMsg; @@ -22,14 +22,14 @@ use net_traits::filemanager_thread::{FileTokenCheck, RelativePos}; use net_traits::http_status::HttpStatus; use net_traits::policy_container::{PolicyContainer, RequestPolicyContainer}; use net_traits::request::{ - is_cors_safelisted_method, is_cors_safelisted_request_header, BodyChunkRequest, - BodyChunkResponse, CredentialsMode, Destination, Initiator, InsecureRequestsPolicy, Origin, - RedirectMode, Referrer, Request, RequestMode, ResponseTainting, Window, + BodyChunkRequest, BodyChunkResponse, CredentialsMode, Destination, Initiator, + InsecureRequestsPolicy, Origin, RedirectMode, Referrer, Request, RequestMode, ResponseTainting, + Window, is_cors_safelisted_method, is_cors_safelisted_request_header, }; use net_traits::response::{Response, ResponseBody, ResponseType}; use net_traits::{ - set_default_accept_language, FetchTaskTarget, NetworkError, ReferrerPolicy, ResourceAttribute, - ResourceFetchTiming, ResourceTimeValue, ResourceTimingType, + FetchTaskTarget, NetworkError, ReferrerPolicy, ResourceAttribute, ResourceFetchTiming, + ResourceTimeValue, ResourceTimingType, set_default_accept_language, }; use rustls_pki_types::CertificateDer; use serde::{Deserialize, Serialize}; @@ -41,7 +41,7 @@ use super::fetch_params::FetchParams; use crate::fetch::cors_cache::CorsCache; use crate::fetch::headers::determine_nosniff; use crate::filemanager_thread::FileManager; -use crate::http_loader::{determine_requests_referrer, http_fetch, set_default_accept, HttpState}; +use crate::http_loader::{HttpState, determine_requests_referrer, http_fetch, set_default_accept}; use crate::protocols::ProtocolRegistry; use crate::request_interceptor::RequestInterceptor; use crate::subresource_integrity::is_response_integrity_valid; diff --git a/components/net/hsts.rs b/components/net/hsts.rs index da57051790f..04282be2340 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.rs @@ -11,8 +11,8 @@ use embedder_traits::resources::{self, Resource}; use headers::{HeaderMapExt, StrictTransportSecurity}; use http::HeaderMap; use log::{error, info}; -use net_traits::pub_domains::reg_suffix; use net_traits::IncludeSubdomains; +use net_traits::pub_domains::reg_suffix; use serde::{Deserialize, Serialize}; use servo_config::pref; use servo_url::{Host, ServoUrl}; diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs index 4a606671554..b6cd741f3ed 100644 --- a/components/net/http_cache.rs +++ b/components/net/http_cache.rs @@ -9,15 +9,15 @@ use std::collections::HashMap; use std::ops::Bound; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; +use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant, SystemTime}; use headers::{ CacheControl, ContentRange, Expires, HeaderMapExt, LastModified, Pragma, Range, Vary, }; use http::header::HeaderValue; -use http::{header, HeaderMap, Method, StatusCode}; +use http::{HeaderMap, Method, StatusCode, header}; use log::debug; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalSizeOf}; use malloc_size_of_derive::MallocSizeOf; @@ -28,7 +28,7 @@ use net_traits::{FetchMetadata, Metadata, ResourceFetchTiming}; use servo_arc::Arc; use servo_config::pref; use servo_url::ServoUrl; -use tokio::sync::mpsc::{unbounded_channel as unbounded, UnboundedSender as TokioSender}; +use tokio::sync::mpsc::{UnboundedSender as TokioSender, unbounded_channel as unbounded}; use crate::fetch::methods::{Data, DoneChannel}; diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 68b386dd77f..7080c2d7501 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -16,7 +16,7 @@ use devtools_traits::{ HttpResponse as DevtoolsHttpResponse, NetworkEvent, }; use embedder_traits::{AuthenticationResponse, EmbedderMsg, EmbedderProxy}; -use futures::{future, TryFutureExt, TryStreamExt}; +use futures::{TryFutureExt, TryStreamExt, future}; use headers::authorization::Basic; use headers::{ AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods, @@ -25,16 +25,16 @@ use headers::{ IfModifiedSince, LastModified, Pragma, Referer, UserAgent, }; use http::header::{ - self, HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LOCATION, - CONTENT_TYPE, + self, ACCEPT, AUTHORIZATION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LOCATION, + CONTENT_TYPE, HeaderValue, }; use http::{HeaderMap, Method, Request as HyperRequest, StatusCode}; use http_body_util::combinators::BoxBody; use http_body_util::{BodyExt, Full}; +use hyper::Response as HyperResponse; use hyper::body::{Bytes, Frame}; use hyper::ext::ReasonPhrase; use hyper::header::{HeaderName, TRANSFER_ENCODING}; -use hyper::Response as HyperResponse; use hyper_serde::Serde; use hyper_util::client::legacy::Client; use ipc_channel::ipc::{self, IpcSender}; @@ -44,23 +44,22 @@ use net_traits::http_status::HttpStatus; use net_traits::pub_domains::reg_suffix; use net_traits::request::Origin::Origin as SpecificOrigin; use net_traits::request::{ - get_cors_unsafe_header_names, is_cors_non_wildcard_request_header_name, - is_cors_safelisted_method, is_cors_safelisted_request_header, BodyChunkRequest, - BodyChunkResponse, CacheMode, CredentialsMode, Destination, Initiator, Origin, RedirectMode, - Referrer, Request, RequestBuilder, RequestMode, ResponseTainting, ServiceWorkersMode, - Window as RequestWindow, + BodyChunkRequest, BodyChunkResponse, CacheMode, CredentialsMode, Destination, Initiator, + Origin, RedirectMode, Referrer, Request, RequestBuilder, RequestMode, ResponseTainting, + ServiceWorkersMode, Window as RequestWindow, get_cors_unsafe_header_names, + is_cors_non_wildcard_request_header_name, is_cors_safelisted_method, + is_cors_safelisted_request_header, }; use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType}; use net_traits::{ - CookieSource, FetchMetadata, NetworkError, RedirectEndValue, RedirectStartValue, - ReferrerPolicy, ResourceAttribute, ResourceFetchTiming, ResourceTimeValue, - DOCUMENT_ACCEPT_HEADER_VALUE, + CookieSource, DOCUMENT_ACCEPT_HEADER_VALUE, FetchMetadata, NetworkError, RedirectEndValue, + RedirectStartValue, ReferrerPolicy, ResourceAttribute, ResourceFetchTiming, ResourceTimeValue, }; use servo_arc::Arc; use servo_url::{ImmutableOrigin, ServoUrl}; use tokio::sync::mpsc::{ - channel, unbounded_channel, Receiver as TokioReceiver, Sender as TokioSender, - UnboundedReceiver, UnboundedSender, + Receiver as TokioReceiver, Sender as TokioSender, UnboundedReceiver, UnboundedSender, channel, + unbounded_channel, }; use tokio_stream::wrappers::ReceiverStream; @@ -72,7 +71,7 @@ use crate::decoder::Decoder; use crate::fetch::cors_cache::CorsCache; use crate::fetch::fetch_params::FetchParams; use crate::fetch::headers::{SecFetchDest, SecFetchMode, SecFetchSite, SecFetchUser}; -use crate::fetch::methods::{main_fetch, Data, DoneChannel, FetchContext, Target}; +use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target, main_fetch}; use crate::hsts::HstsList; use crate::http_cache::{CacheKey, HttpCache}; use crate::resource_thread::{AuthCache, AuthCacheEntry}; diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs index 28ca66dea21..97999bc6d4d 100644 --- a/components/net/image_cache.rs +++ b/components/net/image_cache.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 https://mozilla.org/MPL/2.0/. */ -use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::HashMap; +use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::sync::{Arc, Mutex}; use std::{mem, thread}; @@ -16,7 +16,7 @@ use net_traits::image_cache::{ }; use net_traits::request::CorsSettings; use net_traits::{FetchMetadata, FetchResponseMsg, FilteredMetadata, NetworkError}; -use pixels::{load_from_memory, CorsStatus, Image, ImageMetadata, PixelFormat}; +use pixels::{CorsStatus, Image, ImageMetadata, PixelFormat, load_from_memory}; use servo_config::pref; use servo_url::{ImmutableOrigin, ServoUrl}; use webrender_api::units::DeviceIntSize; diff --git a/components/net/local_directory_listing.rs b/components/net/local_directory_listing.rs index ab89e054b20..773ed929492 100644 --- a/components/net/local_directory_listing.rs +++ b/components/net/local_directory_listing.rs @@ -6,7 +6,7 @@ use std::fs::{DirEntry, Metadata, ReadDir}; use std::path::PathBuf; use chrono::{DateTime, Local}; -use embedder_traits::resources::{read_string, Resource}; +use embedder_traits::resources::{Resource, read_string}; use headers::{ContentType, HeaderMapExt}; use net_traits::request::Request; use net_traits::response::{Response, ResponseBody}; diff --git a/components/net/protocols/blob.rs b/components/net/protocols/blob.rs index ac751f80c38..991cc2a6453 100644 --- a/components/net/protocols/blob.rs +++ b/components/net/protocols/blob.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::future::{ready, Future}; +use std::future::{Future, ready}; use std::pin::Pin; use headers::{HeaderMapExt, Range}; use http::Method; use log::debug; -use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError}; +use net_traits::blob_url_store::{BlobURLStoreError, parse_blob_url}; use net_traits::http_status::HttpStatus; use net_traits::request::Request; use net_traits::response::{Response, ResponseBody}; @@ -16,7 +16,7 @@ use net_traits::{NetworkError, ResourceFetchTiming}; use tokio::sync::mpsc::unbounded_channel; use crate::fetch::methods::{Data, DoneChannel, FetchContext}; -use crate::protocols::{partial_content, range_not_satisfiable_error, ProtocolHandler}; +use crate::protocols::{ProtocolHandler, partial_content, range_not_satisfiable_error}; #[derive(Default)] pub struct BlobProtocolHander {} diff --git a/components/net/protocols/file.rs b/components/net/protocols/file.rs index df5cdfc3274..403669179dd 100644 --- a/components/net/protocols/file.rs +++ b/components/net/protocols/file.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::fs::File; -use std::future::{ready, Future}; +use std::future::{Future, ready}; use std::io::{BufReader, Seek, SeekFrom}; use std::pin::Pin; @@ -18,7 +18,7 @@ use crate::fetch::methods::{DoneChannel, FetchContext}; use crate::filemanager_thread::FILE_CHUNK_SIZE; use crate::local_directory_listing; use crate::protocols::{ - get_range_request_bounds, partial_content, range_not_satisfiable_error, ProtocolHandler, + ProtocolHandler, get_range_request_bounds, partial_content, range_not_satisfiable_error, }; #[derive(Default)] diff --git a/components/net/protocols/mod.rs b/components/net/protocols/mod.rs index 51d43ab9d2a..f8b989b9623 100644 --- a/components/net/protocols/mod.rs +++ b/components/net/protocols/mod.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 https://mozilla.org/MPL/2.0/. */ -use std::collections::hash_map::Entry; use std::collections::HashMap; +use std::collections::hash_map::Entry; use std::future::Future; use std::ops::Bound; use std::pin::Pin; diff --git a/components/net/request_interceptor.rs b/components/net/request_interceptor.rs index 366f5cd26d0..eaab3d1eb9b 100644 --- a/components/net/request_interceptor.rs +++ b/components/net/request_interceptor.rs @@ -6,10 +6,10 @@ use content_security_policy::Destination; use embedder_traits::{EmbedderMsg, EmbedderProxy, WebResourceRequest, WebResourceResponseMsg}; use ipc_channel::ipc; use log::error; +use net_traits::NetworkError; use net_traits::http_status::HttpStatus; use net_traits::request::Request; use net_traits::response::{Response, ResponseBody}; -use net_traits::NetworkError; use crate::fetch::methods::FetchContext; diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 8306e4049f1..4aa79d49a96 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -42,17 +42,17 @@ use servo_url::{ImmutableOrigin, ServoUrl}; use crate::async_runtime::HANDLE; use crate::connector::{ - create_http_client, create_tls_config, CACertificates, CertificateErrorOverrideManager, + CACertificates, CertificateErrorOverrideManager, create_http_client, create_tls_config, }; use crate::cookie::ServoCookie; use crate::cookie_storage::CookieStorage; use crate::fetch::cors_cache::CorsCache; use crate::fetch::fetch_params::FetchParams; -use crate::fetch::methods::{fetch, CancellationListener, FetchContext}; +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::{http_redirect_fetch, HttpState}; +use crate::http_loader::{HttpState, http_redirect_fetch}; use crate::protocols::ProtocolRegistry; use crate::request_interceptor::RequestInterceptor; use crate::storage_thread::StorageThreadFactory; @@ -676,7 +676,10 @@ impl CoreResourceThreadPool { if still_active == 0 || rounds == 10 { if still_active > 0 { - debug!("Exiting CoreResourceThreadPool with {:?} still working(should be zero)", still_active); + debug!( + "Exiting CoreResourceThreadPool with {:?} still working(should be zero)", + still_active + ); } break; } diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs index 27fff40e897..55d2241fb02 100644 --- a/components/net/tests/fetch.rs +++ b/components/net/tests/fetch.rs @@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex, Weak}; use std::time::{Duration, SystemTime}; use base::id::TEST_PIPELINE_ID; -use crossbeam_channel::{unbounded, Sender}; +use crossbeam_channel::{Sender, unbounded}; use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse}; use headers::{ AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods, @@ -48,9 +48,9 @@ use uuid::Uuid; use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response}; use crate::{ - create_embedder_proxy, create_embedder_proxy_and_receiver, create_http_state, fetch, - fetch_with_context, fetch_with_cors_cache, make_body, make_server, make_ssl_server, - new_fetch_context, DEFAULT_USER_AGENT, + DEFAULT_USER_AGENT, create_embedder_proxy, create_embedder_proxy_and_receiver, + create_http_state, fetch, fetch_with_context, fetch_with_cors_cache, make_body, make_server, + make_ssl_server, new_fetch_context, }; // TODO write a struct that impls Handler for storing test values @@ -298,19 +298,25 @@ fn test_cors_preflight_fetch() { if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0 { - assert!(request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)); - assert!(!request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)); - assert!(!request - .headers() - .get(header::REFERER) - .unwrap() - .to_str() - .unwrap() - .contains("a.html")); + assert!( + request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD) + ); + assert!( + !request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS) + ); + assert!( + !request + .headers() + .get(header::REFERER) + .unwrap() + .to_str() + .unwrap() + .contains("a.html") + ); response .headers_mut() .typed_insert(AccessControlAllowOrigin::ANY); @@ -356,12 +362,16 @@ fn test_cors_preflight_cache_fetch() { if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0 { - assert!(request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)); - assert!(!request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)); + assert!( + request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD) + ); + assert!( + !request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS) + ); response .headers_mut() .typed_insert(AccessControlAllowOrigin::ANY); @@ -424,12 +434,16 @@ fn test_cors_preflight_fetch_network_error() { if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0 { - assert!(request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)); - assert!(!request - .headers() - .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)); + assert!( + request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD) + ); + assert!( + !request + .headers() + .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS) + ); response .headers_mut() .typed_insert(AccessControlAllowOrigin::ANY); @@ -488,9 +502,11 @@ fn test_fetch_response_is_basic_filtered() { let headers = fetch_response.headers; assert!(!headers.contains_key(header::SET_COOKIE)); - assert!(headers - .get(HeaderName::from_static("set-cookie2")) - .is_none()); + assert!( + headers + .get(HeaderName::from_static("set-cookie2")) + .is_none() + ); } #[test] @@ -560,9 +576,11 @@ fn test_fetch_response_is_cors_filtered() { assert!(!headers.contains_key(header::ACCESS_CONTROL_ALLOW_ORIGIN)); assert!(!headers.contains_key(header::SET_COOKIE)); - assert!(headers - .get(HeaderName::from_static("set-cookie2")) - .is_none()); + assert!( + headers + .get(HeaderName::from_static("set-cookie2")) + .is_none() + ); } #[test] @@ -794,18 +812,22 @@ fn test_load_adds_host_to_hsts_list_when_url_is_https() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); - assert!(context - .state - .hsts_list - .read() - .unwrap() - .is_host_secure(url.host_str().unwrap())); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); + assert!( + context + .state + .hsts_list + .read() + .unwrap() + .is_host_secure(url.host_str().unwrap()) + ); } #[test] diff --git a/components/net/tests/hsts.rs b/components/net/tests/hsts.rs index 771e057e715..863cbc56fe1 100644 --- a/components/net/tests/hsts.rs +++ b/components/net/tests/hsts.rs @@ -106,12 +106,14 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() { let mut entries_map = HashMap::new(); entries_map.insert( "mozilla.org".to_owned(), - vec![HstsEntry::new( - "mozilla.org".to_owned(), - IncludeSubdomains::NotIncluded, - Some(StdDuration::from_secs(500000)), - ) - .unwrap()], + vec![ + HstsEntry::new( + "mozilla.org".to_owned(), + IncludeSubdomains::NotIncluded, + Some(StdDuration::from_secs(500000)), + ) + .unwrap(), + ], ); let mut list = HstsList { entries_map: entries_map, @@ -182,12 +184,14 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() { let mut entries_map = HashMap::new(); entries_map.insert( "mozilla.org".to_owned(), - vec![HstsEntry::new( - "mozilla.org".to_owned(), - IncludeSubdomains::NotIncluded, - None, - ) - .unwrap()], + vec![ + HstsEntry::new( + "mozilla.org".to_owned(), + IncludeSubdomains::NotIncluded, + None, + ) + .unwrap(), + ], ); let mut list = HstsList { entries_map: entries_map, @@ -286,12 +290,14 @@ fn test_hsts_list_with_exact_domain_entry_is_is_host_secure() { let mut entries_map = HashMap::new(); entries_map.insert( "mozilla.org".to_owned(), - vec![HstsEntry::new( - "mozilla.org".to_owned(), - IncludeSubdomains::NotIncluded, - None, - ) - .unwrap()], + vec![ + HstsEntry::new( + "mozilla.org".to_owned(), + IncludeSubdomains::NotIncluded, + None, + ) + .unwrap(), + ], ); let hsts_list = HstsList { @@ -320,12 +326,14 @@ fn test_hsts_list_with_subdomain_when_include_subdomains_is_false_is_not_is_host let mut entries_map = HashMap::new(); entries_map.insert( "mozilla.org".to_owned(), - vec![HstsEntry::new( - "mozilla.org".to_owned(), - IncludeSubdomains::NotIncluded, - None, - ) - .unwrap()], + vec![ + HstsEntry::new( + "mozilla.org".to_owned(), + IncludeSubdomains::NotIncluded, + None, + ) + .unwrap(), + ], ); let hsts_list = HstsList { entries_map: entries_map, diff --git a/components/net/tests/http_cache.rs b/components/net/tests/http_cache.rs index 57d2d5f0dba..e37455c5d73 100644 --- a/components/net/tests/http_cache.rs +++ b/components/net/tests/http_cache.rs @@ -3,8 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use base::id::TEST_PIPELINE_ID; -use http::header::{HeaderValue, EXPIRES}; use http::StatusCode; +use http::header::{EXPIRES, HeaderValue}; use net::http_cache::HttpCache; use net_traits::request::{Referrer, RequestBuilder}; use net_traits::response::{Response, ResponseBody}; diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index b95166d8ee2..b3afe11852c 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -12,14 +12,14 @@ use std::time::Duration; use base::id::{TEST_PIPELINE_ID, TEST_WEBVIEW_ID}; use cookie::Cookie as CookiePair; -use crossbeam_channel::{unbounded, Receiver}; +use crossbeam_channel::{Receiver, unbounded}; use devtools_traits::{ ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse, NetworkEvent, }; use embedder_traits::AuthenticationResponse; -use flate2::write::{GzEncoder, ZlibEncoder}; use flate2::Compression; +use flate2::write::{GzEncoder, ZlibEncoder}; use headers::authorization::Basic; use headers::{ Authorization, ContentLength, Date, HeaderMapExt, Host, StrictTransportSecurity, UserAgent, @@ -37,7 +37,7 @@ use net::cookie_storage::CookieStorage; use net::fetch::methods::{self}; use net::http_loader::{determine_requests_referrer, serialize_origin}; use net::resource_thread::AuthCacheEntry; -use net::test::{replace_host_table, DECODER_BUFFER_SIZE}; +use net::test::{DECODER_BUFFER_SIZE, replace_host_table}; use net_traits::http_status::HttpStatus; use net_traits::request::{ BodyChunkRequest, BodyChunkResponse, BodySource, CredentialsMode, Destination, Referrer, @@ -184,12 +184,14 @@ fn test_check_default_headers_loaded_in_every_request() { .build(); let response = dbg!(fetch(request, None)); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); // Testing for method.POST let mut post_headers = headers.clone(); @@ -210,19 +212,21 @@ fn test_check_default_headers_loaded_in_every_request() { .build(); let response = fetch(request, None); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); let _ = server.close(); } #[test] -fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length_should_be_set_to_0( -) { +fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length_should_be_set_to_0() + { let handler = move |request: HyperRequest<Incoming>, _: &mut HyperResponse<BoxBody<Bytes, hyper::Error>>| { assert_eq!( @@ -241,12 +245,14 @@ fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length .build(); let response = fetch(request, None); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); let _ = server.close(); } @@ -276,12 +282,14 @@ fn test_request_and_response_data_with_network_messages() { let (devtools_chan, devtools_port) = unbounded(); let response = fetch(request, Some(devtools_chan)); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); let _ = server.close(); @@ -487,8 +495,8 @@ fn test_load_when_redirecting_from_a_post_should_rewrite_next_request_as_get() { } #[test] -fn test_load_should_decode_the_response_as_deflate_when_response_headers_have_content_encoding_deflate( -) { +fn test_load_should_decode_the_response_as_deflate_when_response_headers_have_content_encoding_deflate() + { let handler = move |_: HyperRequest<Incoming>, response: &mut HyperResponse<BoxBody<Bytes, hyper::Error>>| { @@ -628,12 +636,14 @@ fn test_load_doesnt_add_host_to_hsts_list_when_url_is_http_even_if_hsts_headers_ let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); assert_eq!( context .state @@ -675,12 +685,14 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_ let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); assert_cookie_for_domain( &context.state.cookie_jar, @@ -728,12 +740,14 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -775,12 +789,14 @@ fn test_load_sends_cookie_if_nonhttp() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -814,12 +830,14 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl( let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); assert_cookie_for_domain( &context.state.cookie_jar, @@ -827,9 +845,11 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl( Some("mozillaIs=theBest"), ); let mut cookie_jar = context.state.cookie_jar.write().unwrap(); - assert!(cookie_jar - .cookies_for_url(&url, CookieSource::NonHTTP) - .is_none()); + assert!( + cookie_jar + .cookies_for_url(&url, CookieSource::NonHTTP) + .is_none() + ); } #[test] @@ -897,12 +917,14 @@ fn test_load_sets_content_length_to_length_of_request_body() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -937,12 +959,14 @@ fn test_load_uses_explicit_accept_from_headers_in_load_data() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -974,12 +998,14 @@ fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1014,12 +1040,14 @@ fn test_load_uses_explicit_accept_encoding_from_load_data_headers() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1051,12 +1079,14 @@ fn test_load_sets_default_accept_encoding_to_gzip_and_deflate() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1397,12 +1427,14 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1593,12 +1625,14 @@ fn test_user_credentials_prompt_when_proxy_authentication_is_required() { let _ = server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1643,12 +1677,14 @@ fn test_prompt_credentials_when_client_receives_unauthorized_response() { server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_success()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_success() + ); } #[test] @@ -1687,12 +1723,14 @@ fn test_prompt_credentials_user_cancels_dialog_input() { server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_client_error()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_client_error() + ); } #[test] @@ -1737,12 +1775,14 @@ fn test_prompt_credentials_user_input_incorrect_credentials() { server.close(); - assert!(response - .internal_response - .unwrap() - .status - .code() - .is_client_error()); + assert!( + response + .internal_response + .unwrap() + .status + .code() + .is_client_error() + ); } #[test] diff --git a/components/net/tests/main.rs b/components/net/tests/main.rs index 531fefb1eb0..504fea09777 100644 --- a/components/net/tests/main.rs +++ b/components/net/tests/main.rs @@ -26,7 +26,7 @@ use std::net::TcpListener as StdTcpListener; use std::path::{Path, PathBuf}; use std::sync::{Arc, LazyLock, Mutex, RwLock, Weak}; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use devtools_traits::DevtoolsControlMsg; use embedder_traits::{AuthenticationResponse, EmbedderMsg, EmbedderProxy, EventLoopWaker}; use futures::future::ready; @@ -127,15 +127,17 @@ fn receive_credential_prompt_msgs( embedder_receiver: Receiver<EmbedderMsg>, response: Option<AuthenticationResponse>, ) -> std::thread::JoinHandle<()> { - std::thread::spawn(move || loop { - let embedder_msg = embedder_receiver.recv().unwrap(); - match embedder_msg { - embedder_traits::EmbedderMsg::RequestAuthentication(_, _, _, response_sender) => { - let _ = response_sender.send(response); - break; - }, - embedder_traits::EmbedderMsg::WebResourceRequested(..) => {}, - _ => unreachable!(), + std::thread::spawn(move || { + loop { + let embedder_msg = embedder_receiver.recv().unwrap(); + match embedder_msg { + embedder_traits::EmbedderMsg::RequestAuthentication(_, _, _, response_sender) => { + let _ = response_sender.send(response); + break; + }, + embedder_traits::EmbedderMsg::WebResourceRequested(..) => {}, + _ => unreachable!(), + } } }) } diff --git a/components/net/tests/subresource_integrity.rs b/components/net/tests/subresource_integrity.rs index b6063a7528d..c3c40a95154 100644 --- a/components/net/tests/subresource_integrity.rs +++ b/components/net/tests/subresource_integrity.rs @@ -3,8 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use net::subresource_integrity::{ - get_prioritized_hash_function, get_strongest_metadata, is_response_integrity_valid, - parsed_metadata, SriEntry, + SriEntry, get_prioritized_hash_function, get_strongest_metadata, is_response_integrity_valid, + parsed_metadata, }; use net_traits::response::{Response, ResponseBody}; use net_traits::{ResourceFetchTiming, ResourceTimingType}; diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs index d601644a125..63f3da1cef3 100644 --- a/components/net/websocket_loader.rs +++ b/components/net/websocket_loader.rs @@ -11,11 +11,11 @@ //! over events from the network and events from the DOM, using async/await to avoid //! the need for a dedicated thread per websocket. -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; -use async_tungstenite::tokio::{client_async_tls_with_connector_and_config, ConnectStream}; use async_tungstenite::WebSocketStream; +use async_tungstenite::tokio::{ConnectStream, client_async_tls_with_connector_and_config}; use base64::Engine; use futures::future::TryFutureExt; use futures::stream::StreamExt; @@ -28,16 +28,16 @@ use net_traits::{CookieSource, MessageData, WebSocketDomAction, WebSocketNetwork use servo_url::ServoUrl; use tokio::net::TcpStream; use tokio::select; -use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver}; +use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel}; use tokio_rustls::TlsConnector; +use tungstenite::Message; use tungstenite::error::{Error, ProtocolError, Result as WebSocketResult, UrlError}; use tungstenite::handshake::client::{Request, Response}; use tungstenite::protocol::CloseFrame; -use tungstenite::Message; use url::Url; use crate::async_runtime::HANDLE; -use crate::connector::{create_tls_config, CACertificates, TlsConfig}; +use crate::connector::{CACertificates, TlsConfig, create_tls_config}; use crate::cookie::ServoCookie; use crate::fetch::methods::should_request_be_blocked_due_to_a_bad_port; use crate::hosts::replace_host; @@ -358,7 +358,7 @@ fn connect( return Err( "Received a RequestBuilder with a non-websocket mode in websocket_loader" .to_string(), - ) + ); }, }; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index ecca666fa09..5890b3dbef5 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -49,16 +49,18 @@ impl Profiler { let chan = chan.clone(); thread::Builder::new() .name("MemoryProfTimer".to_owned()) - .spawn(move || loop { - thread::sleep(Duration::from_secs_f64(period)); - let (mutex, cvar) = &*notifier; - let mut done = mutex.lock(); - *done = false; - if chan.send(ProfilerMsg::Print).is_err() { - break; - } - if !*done { - cvar.wait(&mut done); + .spawn(move || { + loop { + thread::sleep(Duration::from_secs_f64(period)); + let (mutex, cvar) = &*notifier; + let mut done = mutex.lock(); + *done = false; + if chan.send(ProfilerMsg::Print).is_err() { + break; + } + if !*done { + cvar.wait(&mut done); + } } }) .expect("Thread spawning failed"); @@ -623,8 +625,8 @@ mod system_reporter { #[cfg(target_os = "linux")] fn resident_segments() -> Vec<(String, usize)> { - use std::collections::hash_map::Entry; use std::collections::HashMap; + use std::collections::hash_map::Entry; use std::fs::File; use std::io::{BufRead, BufReader}; diff --git a/components/profile/time.rs b/components/profile/time.rs index c6afff4e7b5..1e7629a48f7 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -174,10 +174,12 @@ impl Profiler { let chan = chan.clone(); thread::Builder::new() .name("TimeProfTimer".to_owned()) - .spawn(move || loop { - thread::sleep(std::time::Duration::from_secs_f64(period)); - if chan.send(ProfilerMsg::Print).is_err() { - break; + .spawn(move || { + loop { + thread::sleep(std::time::Duration::from_secs_f64(period)); + if chan.send(ProfilerMsg::Print).is_err() { + break; + } } }) .expect("Thread spawning failed"); @@ -200,14 +202,16 @@ impl Profiler { // No-op to handle messages when the time profiler is not printing: thread::Builder::new() .name("TimeProfiler".to_owned()) - .spawn(move || loop { - match port.recv() { - Err(_) => break, - Ok(ProfilerMsg::Exit(chan)) => { - let _ = chan.send(()); - break; - }, - _ => {}, + .spawn(move || { + loop { + match port.recv() { + Err(_) => break, + Ok(ProfilerMsg::Exit(chan)) => { + let _ = chan.send(()); + break; + }, + _ => {}, + } } }) .expect("Thread spawning failed"); diff --git a/components/rand/lib.rs b/components/rand/lib.rs index 89af575c0f3..cf579d8ca31 100644 --- a/components/rand/lib.rs +++ b/components/rand/lib.rs @@ -18,8 +18,8 @@ use malloc_size_of_derive::MallocSizeOf; /// This crate fixes that, by only using one `OsRng`, which is just /// used to seed and re-seed an `ServoRng`. use rand::distributions::{Distribution, Standard}; -use rand::rngs::adapter::ReseedingRng; use rand::rngs::OsRng; +use rand::rngs::adapter::ReseedingRng; pub use rand::seq::SliceRandom; pub use rand::{Rng, RngCore, SeedableRng}; use rand_isaac::isaac::IsaacCore; diff --git a/components/script/animations.rs b/components/script/animations.rs index f73400c343a..51eb949b4f1 100644 --- a/components/script/animations.rs +++ b/components/script/animations.rs @@ -30,7 +30,7 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::NoTrace; use crate::dom::event::Event; -use crate::dom::node::{from_untrusted_node_address, Node, NodeDamage, NodeTraits}; +use crate::dom::node::{Node, NodeDamage, NodeTraits, from_untrusted_node_address}; use crate::dom::transitionevent::TransitionEvent; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/body.rs b/components/script/body.rs index 4c2c84cc31f..6738d8128b1 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -8,10 +8,10 @@ use std::{ptr, slice, str}; use encoding_rs::{Encoding, UTF_8}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use js::jsapi::{Heap, JSObject, JS_ClearPendingException, Value as JSValue}; +use js::jsapi::{Heap, JS_ClearPendingException, JSObject, Value as JSValue}; use js::jsval::{JSVal, UndefinedValue}; -use js::rust::wrappers::{JS_GetPendingException, JS_ParseJSON}; use js::rust::HandleValue; +use js::rust::wrappers::{JS_GetPendingException, JS_ParseJSON}; use js::typedarray::{ArrayBufferU8, Uint8}; use mime::{self, Mime}; use net_traits::request::{ @@ -31,15 +31,15 @@ use crate::dom::bindings::reflector::{DomGlobal, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; -use crate::dom::blob::{normalize_type_string, Blob}; +use crate::dom::blob::{Blob, normalize_type_string}; use crate::dom::formdata::FormData; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlformelement::{encode_multipart_form_data, generate_boundary}; use crate::dom::promise::Promise; use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; -use crate::dom::readablestream::{get_read_promise_bytes, get_read_promise_done, ReadableStream}; +use crate::dom::readablestream::{ReadableStream, get_read_promise_bytes, get_read_promise_done}; use crate::dom::urlsearchparams::URLSearchParams; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext}; use crate::task_source::SendableTaskSource; diff --git a/components/script/canvas_state.rs b/components/script/canvas_state.rs index fcd7104b56f..a950b5909e4 100644 --- a/components/script/canvas_state.rs +++ b/components/script/canvas_state.rs @@ -49,7 +49,7 @@ use crate::dom::bindings::str::DOMString; use crate::dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use crate::dom::canvaspattern::CanvasPattern; use crate::dom::dommatrix::DOMMatrix; -use crate::dom::element::{cors_setting_for_element, Element}; +use crate::dom::element::{Element, cors_setting_for_element}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement}; use crate::dom::imagedata::ImageData; diff --git a/components/script/devtools.rs b/components/script/devtools.rs index d657e6ffd06..c6ada055e75 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -27,7 +27,7 @@ use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeConstants; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use crate::dom::bindings::conversions::{jsstring_to_str, ConversionResult, FromJSValConvertible}; +use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; diff --git a/components/script/document_collection.rs b/components/script/document_collection.rs index 846efe1d44d..b9b474cfd50 100644 --- a/components/script/document_collection.rs +++ b/components/script/document_collection.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::collections::{hash_map, HashMap}; +use std::collections::{HashMap, hash_map}; use base::id::{BrowsingContextId, PipelineId}; diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index e73a793ce6a..422652272b6 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -7,7 +7,7 @@ //! <https://html.spec.whatwg.org/multipage/#the-end> use net_traits::request::RequestBuilder; -use net_traits::{fetch_async, BoxedFetchCallback, ResourceThreads}; +use net_traits::{BoxedFetchCallback, ResourceThreads, fetch_async}; use servo_url::ServoUrl; use crate::dom::bindings::cell::DomRefCell; diff --git a/components/script/dom/abortcontroller.rs b/components/script/dom/abortcontroller.rs index 448e1654158..3813cfdd51a 100644 --- a/components/script/dom/abortcontroller.rs +++ b/components/script/dom/abortcontroller.rs @@ -7,7 +7,7 @@ use js::jsapi::Value; use js::rust::{Handle, HandleObject}; use crate::dom::bindings::codegen::Bindings::AbortControllerBinding::AbortControllerMethods; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::{CanGc, JSContext}; diff --git a/components/script/dom/abstractrange.rs b/components/script/dom/abstractrange.rs index 9aa7d799ea9..c31750cf7dc 100644 --- a/components/script/dom/abstractrange.rs +++ b/components/script/dom/abstractrange.rs @@ -10,7 +10,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::AbstractRangeBinding::AbstractRangeMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutDom}; use crate::dom::document::Document; use crate::dom::node::{Node, ShadowIncluding}; diff --git a/components/script/dom/abstractworkerglobalscope.rs b/components/script/dom/abstractworkerglobalscope.rs index c5c5f3b6b0e..8282d586993 100644 --- a/components/script/dom/abstractworkerglobalscope.rs +++ b/components/script/dom/abstractworkerglobalscope.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crossbeam_channel::{select, Receiver}; +use crossbeam_channel::{Receiver, select}; use devtools_traits::DevtoolScriptControlMsg; use crate::dom::bindings::conversions::DerivedFrom; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index b6593196d5f..40dbb31e653 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -8,7 +8,7 @@ use std::mem; use devtools_traits::AttrInfo; use dom_struct::dom_struct; -use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix}; +use html5ever::{LocalName, Namespace, Prefix, namespace_url, ns}; use servo_atoms::Atom; use style::attr::{AttrIdentifier, AttrValue}; use style::values::GenericAtomIdent; diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index dbd3e9cf8a7..830daae3946 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{ }; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 0b30142e016..97b2c27c92f 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -22,7 +22,7 @@ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::htmlmediaelement::HTMLMediaElement; use crate::dom::mediaelementaudiosourcenode::MediaElementAudioSourceNode; diff --git a/components/script/dom/audiolistener.rs b/components/script/dom/audiolistener.rs index eec4ae5a634..a832560c06f 100644 --- a/components/script/dom/audiolistener.rs +++ b/components/script/dom/audiolistener.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index 3c5adb7ab46..23edd78d39a 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ }; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/audiotrack.rs b/components/script/dom/audiotrack.rs index 5980cf48d0f..919d6d98060 100644 --- a/components/script/dom/audiotrack.rs +++ b/components/script/dom/audiotrack.rs @@ -9,7 +9,7 @@ use dom_struct::dom_struct; use crate::dom::audiotracklist::AudioTrackList; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AudioTrackBinding::AudioTrackMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/audiotracklist.rs b/components/script/dom/audiotracklist.rs index f3a676a447b..570ca9f8644 100644 --- a/components/script/dom/audiotracklist.rs +++ b/components/script/dom/audiotracklist.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AudioTrackListBinding::AudioTrackListMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs index 0536f97f5d3..3e5a6101f0f 100644 --- a/components/script/dom/bindings/buffer_source.rs +++ b/components/script/dom/bindings/buffer_source.rs @@ -16,9 +16,8 @@ use std::sync::Arc; #[cfg(feature = "webgpu")] use js::jsapi::NewExternalArrayBuffer; use js::jsapi::{ - GetArrayBufferByteLength, Heap, IsDetachedArrayBufferObject, JSObject, - JS_GetArrayBufferViewBuffer, JS_GetArrayBufferViewByteLength, JS_IsArrayBufferViewObject, - JS_IsTypedArrayObject, + GetArrayBufferByteLength, Heap, IsDetachedArrayBufferObject, JS_GetArrayBufferViewBuffer, + JS_GetArrayBufferViewByteLength, JS_IsArrayBufferViewObject, JS_IsTypedArrayObject, JSObject, }; use js::rust::wrappers::DetachArrayBuffer; use js::rust::{CustomAutoRooterGuard, Handle, MutableHandleObject}; diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index bd73ec37d52..b5e32dc97a5 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -16,17 +16,17 @@ use js::jsval::{JSVal, ObjectValue, UndefinedValue}; use js::rust::wrappers::{JS_GetProperty, JS_WrapObject}; use js::rust::{MutableHandleValue, Runtime}; +use crate::DomTypes; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; -use crate::dom::bindings::error::{report_pending_exception, Error, Fallible}; +use crate::dom::bindings::error::{Error, Fallible, report_pending_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::settings_stack::{GenericAutoEntryScript, GenericAutoIncumbentScript}; use crate::dom::bindings::utils::AsCCharPtrPtr; use crate::dom::document::DocumentHelpers; use crate::dom::globalscope::GlobalScopeHelpers; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext}; -use crate::DomTypes; /// The exception handling used for a call. #[derive(Clone, Copy, PartialEq)] diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index f0f630672c1..6c987270911 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -9,7 +9,7 @@ use std::cell::{BorrowError, BorrowMutError}; pub(crate) use std::cell::{Ref, RefCell, RefMut}; #[cfg(feature = "refcell_backtrace")] -pub(crate) use accountable_refcell::{ref_filter_map, Ref, RefCell, RefMut}; +pub(crate) use accountable_refcell::{Ref, RefCell, RefMut, ref_filter_map}; #[cfg(not(feature = "refcell_backtrace"))] pub(crate) use ref_filter_map::ref_filter_map; diff --git a/components/script/dom/bindings/constructor.rs b/components/script/dom/bindings/constructor.rs index 0fd6e0427bd..a5874ed4397 100644 --- a/components/script/dom/bindings/constructor.rs +++ b/components/script/dom/bindings/constructor.rs @@ -5,7 +5,7 @@ use std::ptr; use html5ever::interface::QualName; -use html5ever::{local_name, namespace_url, ns, LocalName}; +use html5ever::{LocalName, local_name, namespace_url, ns}; use js::conversions::ToJSValConvertible; use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic}; use js::jsapi::{CallArgs, CurrentGlobalOrNull, JSAutoRealm, JSObject}; @@ -40,7 +40,7 @@ use crate::dom::bindings::codegen::Bindings::{ }; use crate::dom::bindings::codegen::PrototypeList; use crate::dom::bindings::conversions::DerivedFrom; -use crate::dom::bindings::error::{throw_constructor_without_new, throw_dom_exception, Error}; +use crate::dom::bindings::error::{Error, throw_constructor_without_new, throw_dom_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::interface::get_desired_proto; use crate::dom::bindings::reflector::DomObject; diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 11d838230d3..f2359ecbd21 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -39,7 +39,7 @@ pub(crate) use js::conversions::{ }; use js::error::throw_type_error; use js::glue::GetProxyReservedSlot; -use js::jsapi::{Heap, IsWindowProxy, JSContext, JSObject, JS_IsExceptionPending}; +use js::jsapi::{Heap, IsWindowProxy, JS_IsExceptionPending, JSContext, JSObject}; use js::jsval::UndefinedValue; use js::rust::wrappers::{IsArrayObject, JS_GetProperty, JS_HasProperty}; use js::rust::{HandleId, HandleObject, HandleValue, MutableHandleValue}; diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 8d09a4ad8d9..4c594efbb0f 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -22,7 +22,7 @@ pub(crate) use script_bindings::error::*; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name; use crate::dom::bindings::conversions::{ - root_from_object, ConversionResult, FromJSValConvertible, ToJSValConvertible, + ConversionResult, FromJSValConvertible, ToJSValConvertible, root_from_object, }; use crate::dom::bindings::str::USVString; use crate::dom::domexception::{DOMErrorName, DOMException}; diff --git a/components/script/dom/bindings/finalize.rs b/components/script/dom/bindings/finalize.rs index dd379431af3..03d4950e1c7 100644 --- a/components/script/dom/bindings/finalize.rs +++ b/components/script/dom/bindings/finalize.rs @@ -12,7 +12,7 @@ use js::jsapi::JSObject; use js::jsval::UndefinedValue; use crate::dom::bindings::utils::finalize_global as do_finalize_global; -use crate::dom::bindings::weakref::{WeakBox, WeakReferenceable, DOM_WEAK_SLOT}; +use crate::dom::bindings::weakref::{DOM_WEAK_SLOT, WeakBox, WeakReferenceable}; pub(crate) unsafe fn finalize_common<T>(this: *const T) { if !this.is_null() { diff --git a/components/script/dom/bindings/import.rs b/components/script/dom/bindings/import.rs index 2afe1b0e534..b67268437ae 100644 --- a/components/script/dom/bindings/import.rs +++ b/components/script/dom/bindings/import.rs @@ -10,7 +10,7 @@ pub(crate) mod base { pub(crate) use js::error::throw_type_error; pub(crate) use js::jsapi::{ CurrentGlobalOrNull, HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable, - JSContext, JSObject, JS_NewObject, + JS_NewObject, JSContext, JSObject, }; pub(crate) use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue}; pub(crate) use js::panic::maybe_resume_unwind; @@ -18,8 +18,8 @@ pub(crate) mod base { pub(crate) use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue}; pub(crate) use crate::dom::bindings::callback::{ - wrap_call_this_value, CallSetup, CallbackContainer, CallbackFunction, CallbackInterface, - CallbackObject, ExceptionHandling, ThisReflector, + CallSetup, CallbackContainer, CallbackFunction, CallbackInterface, CallbackObject, + ExceptionHandling, ThisReflector, wrap_call_this_value, }; pub(crate) use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelCountModeValues, ChannelInterpretation, @@ -28,11 +28,11 @@ pub(crate) mod base { pub(crate) use crate::dom::bindings::codegen::DomTypes::DomTypes; pub(crate) use crate::dom::bindings::codegen::{GenericUnionTypes, UnionTypes}; pub(crate) use crate::dom::bindings::conversions::{ - root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible, - StringificationBehavior, ToJSValConvertible, + ConversionBehavior, ConversionResult, FromJSValConvertible, StringificationBehavior, + ToJSValConvertible, root_from_handlevalue, }; pub(crate) use crate::dom::bindings::error::Error::JSFailed; - pub(crate) use crate::dom::bindings::error::{throw_dom_exception, Fallible}; + pub(crate) use crate::dom::bindings::error::{Fallible, throw_dom_exception}; pub(crate) use crate::dom::bindings::num::Finite; pub(crate) use crate::dom::bindings::proxyhandler::CrossOriginProperties; pub(crate) use crate::dom::bindings::reflector::{DomGlobalGeneric, DomObject}; @@ -40,7 +40,7 @@ pub(crate) mod base { pub(crate) use crate::dom::bindings::str::{ByteString, DOMString, USVString}; pub(crate) use crate::dom::bindings::trace::RootedTraceableBox; pub(crate) use crate::dom::bindings::utils::{ - get_dictionary_property, set_dictionary_property, DomHelpers, ThreadUnsafeOnceLock, + DomHelpers, ThreadUnsafeOnceLock, get_dictionary_property, set_dictionary_property, }; pub(crate) use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers}; pub(crate) use crate::dom::promise::PromiseHelpers; @@ -58,44 +58,45 @@ pub(crate) mod module { SetProxyReservedSlot, }; pub(crate) use js::jsapi::{ - JSJitInfo_OpType, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2, - JSJitInfo__bindgen_ty_3, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper, - JSPropertySpec, JSPropertySpec_Accessor, JSPropertySpec_AccessorsOrValue, - JSPropertySpec_AccessorsOrValue_Accessors, JSPropertySpec_Kind, JSPropertySpec_Name, - JSPropertySpec_ValueWrapper, JSPropertySpec_ValueWrapper_Type, - JSPropertySpec_ValueWrapper__bindgen_ty_1, JSTracer, JSTypedMethodJitInfo, JSValueType, - JS_AtomizeAndPinString, JS_ForwardGetPropertyTo, JS_GetPropertyDescriptorById, - JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot, - MutableHandle as RawMutableHandle, MutableHandleIdVector as RawMutableHandleIdVector, - MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue, - ObjectOpResult, PropertyDescriptor, SymbolCode, UndefinedHandleValue, - __BindgenBitfieldUnit, jsid, CallArgs, GCContext, GetRealmErrorPrototype, + __BindgenBitfieldUnit, CallArgs, GCContext, GetRealmErrorPrototype, GetRealmFunctionPrototype, GetRealmIteratorPrototype, GetRealmObjectPrototype, GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId, - HandleObject as RawHandleObject, JSAutoRealm, JSClass, JSClassOps, JSFunctionSpec, - JSJitGetterCallArgs, JSJitInfo, JSJitInfo_AliasSet, JSJitInfo_ArgType, - JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY, - JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY, + HandleObject as RawHandleObject, JS_AtomizeAndPinString, JS_ForwardGetPropertyTo, + JS_GetPropertyDescriptorById, JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot, + JSAutoRealm, JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSClass, + JSClassOps, JSFunctionSpec, JSITER_HIDDEN, JSITER_OWNONLY, JSITER_SYMBOLS, + JSJitGetterCallArgs, JSJitInfo, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2, + JSJitInfo__bindgen_ty_3, JSJitInfo_AliasSet, JSJitInfo_ArgType, JSJitInfo_OpType, + JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper, JSPROP_ENUMERATE, + JSPROP_PERMANENT, JSPROP_READONLY, JSPropertySpec, JSPropertySpec_Accessor, + JSPropertySpec_AccessorsOrValue, JSPropertySpec_AccessorsOrValue_Accessors, + JSPropertySpec_Kind, JSPropertySpec_Name, JSPropertySpec_ValueWrapper, + JSPropertySpec_ValueWrapper__bindgen_ty_1, JSPropertySpec_ValueWrapper_Type, JSTracer, + JSTypedMethodJitInfo, JSValueType, MutableHandle as RawMutableHandle, + MutableHandleIdVector as RawMutableHandleIdVector, + MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue, + ObjectOpResult, PropertyDescriptor, SymbolCode, UndefinedHandleValue, jsid, }; pub(crate) use js::jsval::PrivateValue; pub(crate) use js::panic::wrap_panic; pub(crate) use js::rust::wrappers::{ - int_to_jsid, AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields, + AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields, JS_DefineProperty, JS_DefinePropertyById2, JS_GetProperty, JS_InitializePropertiesFromCompatibleNativeObject, JS_NewObjectWithGivenProto, JS_NewObjectWithoutMetadata, JS_SetImmutablePrototype, JS_SetProperty, JS_SetPrototype, JS_WrapObject, NewProxyObject, RUST_INTERNED_STRING_TO_JSID, RUST_SYMBOL_TO_JSID, + int_to_jsid, }; pub(crate) use js::rust::{ - get_context_realm, get_object_class, get_object_realm, CustomAutoRooterGuard, GCMethods, - Handle, MutableHandle, + CustomAutoRooterGuard, GCMethods, Handle, MutableHandle, get_context_realm, + get_object_class, get_object_realm, }; pub(crate) use js::typedarray::{ ArrayBuffer, ArrayBufferView, Float32Array, Float64Array, Uint8Array, Uint8ClampedArray, }; pub(crate) use js::{ - jsapi, typedarray, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, - JSCLASS_RESERVED_SLOTS_MASK, JS_CALLEE, + JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, + JSCLASS_RESERVED_SLOTS_MASK, jsapi, typedarray, }; pub(crate) use script_bindings::constant::{ConstantSpec, ConstantVal}; pub(crate) use servo_config::pref; @@ -115,11 +116,11 @@ pub(crate) mod module { push_new_element_queue, }; pub(crate) use crate::dom::bindings::conversions::{ - is_array_like, jsid_to_string, native_from_handlevalue, native_from_object_static, - IDLInterface, StringificationBehavior, ToJSValConvertible, DOM_OBJECT_SLOT, + DOM_OBJECT_SLOT, IDLInterface, StringificationBehavior, ToJSValConvertible, is_array_like, + jsid_to_string, native_from_handlevalue, native_from_object_static, }; pub(crate) use crate::dom::bindings::error::{ - throw_constructor_without_new, Error, ErrorResult, + Error, ErrorResult, throw_constructor_without_new, }; pub(crate) use crate::dom::bindings::finalize::{ finalize_common, finalize_global, finalize_weak_referenceable, @@ -127,16 +128,17 @@ pub(crate) mod module { pub(crate) use crate::dom::bindings::guard::{Condition, Guard}; pub(crate) use crate::dom::bindings::inheritance::Castable; pub(crate) use crate::dom::bindings::interface::{ - create_callback_interface_object, create_global_object, create_interface_prototype_object, - create_named_constructors, create_noncallback_interface_object, define_dom_interface, - define_guarded_methods, define_guarded_properties, get_desired_proto, - get_per_interface_object_handle, is_exposed_in, ConstructorClassHook, - InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass, ProtoOrIfaceIndex, + ConstructorClassHook, InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass, + ProtoOrIfaceIndex, create_callback_interface_object, create_global_object, + create_interface_prototype_object, create_named_constructors, + create_noncallback_interface_object, define_dom_interface, define_guarded_methods, + define_guarded_properties, get_desired_proto, get_per_interface_object_handle, + is_exposed_in, }; pub(crate) use crate::dom::bindings::iterable::{Iterable, IteratorType}; pub(crate) use crate::dom::bindings::like::{Maplike, Setlike}; pub(crate) use crate::dom::bindings::namespace::{ - create_namespace_object, NamespaceObjectClass, + NamespaceObjectClass, create_namespace_object, }; pub(crate) use crate::dom::bindings::proxyhandler; pub(crate) use crate::dom::bindings::proxyhandler::{ @@ -149,13 +151,13 @@ pub(crate) mod module { pub(crate) use crate::dom::bindings::root::{Dom, DomSlice, MaybeUnreflectedDom, Root}; pub(crate) use crate::dom::bindings::trace::JSTraceable; pub(crate) use crate::dom::bindings::utils::{ - enumerate_global, exception_to_promise, generic_getter, generic_lenient_getter, - generic_lenient_setter, generic_method, generic_setter, generic_static_promise_method, - get_array_index_from_id, get_property_on_prototype, has_property_on_prototype, - resolve_global, trace_global, AsVoidPtr, DOMClass, DOMJSClass, ProtoOrIfaceArray, - DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL, + AsVoidPtr, DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, DOMClass, DOMJSClass, JSCLASS_DOM_GLOBAL, + ProtoOrIfaceArray, enumerate_global, exception_to_promise, generic_getter, + generic_lenient_getter, generic_lenient_setter, generic_method, generic_setter, + generic_static_promise_method, get_array_index_from_id, get_property_on_prototype, + has_property_on_prototype, resolve_global, trace_global, }; - pub(crate) use crate::dom::bindings::weakref::{WeakReferenceable, DOM_WEAK_SLOT}; + pub(crate) use crate::dom::bindings::weakref::{DOM_WEAK_SLOT, WeakReferenceable}; pub(crate) use crate::dom::types::{AnalyserNode, AudioNode, BaseAudioContext, EventTarget}; pub(crate) use crate::mem::malloc_size_of_including_raw_self; pub(crate) use crate::realms::{AlreadyInRealm, InRealm}; diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 45a5b9ffbb7..c830d30d44d 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -12,14 +12,15 @@ use js::error::throw_type_error; use js::glue::UncheckedUnwrapObject; use js::jsapi::JS::CompartmentIterResult; use js::jsapi::{ - jsid, CallArgs, CheckedUnwrapStatic, Compartment, CompartmentSpecifier, CurrentGlobalOrNull, + CallArgs, CheckedUnwrapStatic, Compartment, CompartmentSpecifier, CurrentGlobalOrNull, GetFunctionRealm, GetNonCCWObjectGlobal, GetRealmGlobalOrNull, GetWellKnownSymbol, - HandleObject as RawHandleObject, IsSharableCompartment, IsSystemCompartment, JSAutoRealm, - JSClass, JSClassOps, JSContext, JSFunctionSpec, JSObject, JSPropertySpec, JSString, JSTracer, + HandleObject as RawHandleObject, IsSharableCompartment, IsSystemCompartment, JS_AtomizeAndPinString, JS_GetFunctionObject, JS_GetProperty, JS_IterateCompartments, JS_NewFunction, JS_NewGlobalObject, JS_NewObject, JS_NewPlainObject, JS_NewStringCopyN, - JS_SetReservedSlot, JS_WrapObject, ObjectOps, OnNewGlobalHookOption, SymbolCode, - TrueHandleValue, Value, JSFUN_CONSTRUCTOR, JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING, + JS_SetReservedSlot, JS_WrapObject, JSAutoRealm, JSClass, JSClassOps, JSContext, + JSFUN_CONSTRUCTOR, JSFunctionSpec, JSObject, JSPROP_PERMANENT, JSPROP_READONLY, + JSPROP_RESOLVING, JSPropertySpec, JSString, JSTracer, ObjectOps, OnNewGlobalHookOption, + SymbolCode, TrueHandleValue, Value, jsid, }; use js::jsval::{JSVal, NullValue, PrivateValue}; use js::rust::wrappers::{ @@ -28,19 +29,19 @@ use js::rust::wrappers::{ JS_NewObjectWithGivenProto, RUST_SYMBOL_TO_JSID, }; use js::rust::{ - define_methods, define_properties, get_object_class, is_dom_class, maybe_wrap_object, - HandleObject, HandleValue, MutableHandleObject, RealmOptions, + HandleObject, HandleValue, MutableHandleObject, RealmOptions, define_methods, + define_properties, get_object_class, is_dom_class, maybe_wrap_object, }; -use script_bindings::constant::{define_constants, ConstantSpec}; +use script_bindings::constant::{ConstantSpec, define_constants}; use servo_url::MutableOrigin; use crate::dom::bindings::codegen::InterfaceObjectMap::Globals; use crate::dom::bindings::codegen::PrototypeList; -use crate::dom::bindings::conversions::{get_dom_class, DOM_OBJECT_SLOT}; +use crate::dom::bindings::conversions::{DOM_OBJECT_SLOT, get_dom_class}; use crate::dom::bindings::guard::Guard; use crate::dom::bindings::principals::ServoJSPrincipals; use crate::dom::bindings::utils::{ - get_proto_or_iface_array, DOMJSClass, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT, JSCLASS_DOM_GLOBAL, + DOM_PROTOTYPE_SLOT, DOMJSClass, JSCLASS_DOM_GLOBAL, ProtoOrIfaceArray, get_proto_or_iface_array, }; use crate::script_runtime::JSContext as SafeJSContext; diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index ddb45348de3..1a7be20b3da 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -20,17 +20,17 @@ use script_bindings::conversions::IDLInterface; pub(crate) use script_bindings::iterable::*; use script_bindings::utils::DOMClass; +use crate::DomTypes; use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::{ IterableKeyAndValueResult, IterableKeyOrValueResult, }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::{ - reflect_dom_object, DomGlobalGeneric, DomObjectIteratorWrap, DomObjectWrap, Reflector, + DomGlobalGeneric, DomObjectIteratorWrap, DomObjectWrap, Reflector, reflect_dom_object, }; use crate::dom::bindings::root::{Dom, DomRoot, Root}; use crate::dom::bindings::trace::{JSTraceable, NoTrace, RootedTraceableBox}; use crate::script_runtime::{CanGc, JSContext}; -use crate::DomTypes; /// An iterator over the iterable entries of a given DOM interface. #[dom_struct] @@ -52,14 +52,14 @@ impl<D: DomTypes, T: DomObjectIteratorWrap<D> + JSTraceable + Iterable> Iterable } impl< - D: DomTypes, - T: DomObjectIteratorWrap<D> - + JSTraceable - + Iterable - + DomGlobalGeneric<D> - + IDLInterface - + IteratorDerives, - > IDLInterface for IterableIterator<D, T> + D: DomTypes, + T: DomObjectIteratorWrap<D> + + JSTraceable + + Iterable + + DomGlobalGeneric<D> + + IDLInterface + + IteratorDerives, +> IDLInterface for IterableIterator<D, T> { fn derives(class: &'static DOMClass) -> bool { <T as IteratorDerives>::derives(class) diff --git a/components/script/dom/bindings/principals.rs b/components/script/dom/bindings/principals.rs index d6f3e10981c..b037fcb0709 100644 --- a/components/script/dom/bindings/principals.rs +++ b/components/script/dom/bindings/principals.rs @@ -12,8 +12,8 @@ use js::glue::{ JSPrincipalsCallbacks, }; use js::jsapi::{ - JSContext, JSPrincipals, JSStructuredCloneReader, JSStructuredCloneWriter, JS_DropPrincipals, - JS_HoldPrincipals, JS_ReadUint32Pair, + JS_DropPrincipals, JS_HoldPrincipals, JS_ReadUint32Pair, JSContext, JSPrincipals, + JSStructuredCloneReader, JSStructuredCloneWriter, }; use js::rust::Runtime; use servo_url::MutableOrigin; @@ -111,7 +111,7 @@ impl ServoJSPrincipalsRef<'_> { impl Clone for ServoJSPrincipalsRef<'_> { #[inline] fn clone(&self) -> Self { - Self(ManuallyDrop::new(ServoJSPrincipals(self.0 .0)), PhantomData) + Self(ManuallyDrop::new(ServoJSPrincipals(self.0.0)), PhantomData) } } diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 581171b20b5..e4bd0875d54 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -17,27 +17,27 @@ use js::glue::{ }; use js::jsapi; use js::jsapi::{ - jsid, DOMProxyShadowsResult, GetObjectRealmOrNull, GetRealmPrincipals, GetStaticPrototype, + DOMProxyShadowsResult, GetObjectRealmOrNull, GetRealmPrincipals, GetStaticPrototype, GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId, - HandleObject as RawHandleObject, HandleValue as RawHandleValue, JSAutoRealm, JSContext, - JSErrNum, JSFunctionSpec, JSObject, JSPropertySpec, JS_AtomizeAndPinString, - JS_DefinePropertyById, JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending, + HandleObject as RawHandleObject, HandleValue as RawHandleValue, JS_AtomizeAndPinString, + JS_DefinePropertyById, JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending, JSAutoRealm, + JSContext, JSErrNum, JSFunctionSpec, JSObject, JSPropertySpec, MutableHandle as RawMutableHandle, MutableHandleIdVector as RawMutableHandleIdVector, MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue, - ObjectOpResult, PropertyDescriptor, SetDOMProxyInformation, SymbolCode, + ObjectOpResult, PropertyDescriptor, SetDOMProxyInformation, SymbolCode, jsid, }; use js::jsid::SymbolId; use js::jsval::{ObjectValue, UndefinedValue}; use js::rust::wrappers::{ AppendToIdVector, JS_AlreadyHasOwnPropertyById, JS_NewObjectWithGivenProto, - SetDataPropertyDescriptor, RUST_INTERNED_STRING_TO_JSID, + RUST_INTERNED_STRING_TO_JSID, SetDataPropertyDescriptor, }; use js::rust::{ - get_context_realm, Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject, + Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject, get_context_realm, }; use crate::dom::bindings::conversions::{is_dom_proxy, jsid_to_string, jsstring_to_str}; -use crate::dom::bindings::error::{throw_dom_exception, Error}; +use crate::dom::bindings::error::{Error, throw_dom_exception}; use crate::dom::bindings::principals::ServoJSPrincipalsRef; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::str::DOMString; diff --git a/components/script/dom/bindings/record.rs b/components/script/dom/bindings/record.rs index 32388c9e187..5d092e6c34c 100644 --- a/components/script/dom/bindings/record.rs +++ b/components/script/dom/bindings/record.rs @@ -13,8 +13,8 @@ use indexmap::IndexMap; use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; use js::jsapi::glue::JS_GetOwnPropertyDescriptorById; use js::jsapi::{ - HandleId as RawHandleId, JSContext, JS_NewPlainObject, PropertyDescriptor, JSITER_HIDDEN, - JSITER_OWNONLY, JSITER_SYMBOLS, JSPROP_ENUMERATE, + HandleId as RawHandleId, JS_NewPlainObject, JSContext, JSITER_HIDDEN, JSITER_OWNONLY, + JSITER_SYMBOLS, JSPROP_ENUMERATE, PropertyDescriptor, }; use js::jsval::{ObjectValue, UndefinedValue}; use js::rust::wrappers::{GetPropertyKeys, JS_DefineUCProperty2, JS_GetPropertyById, JS_IdToValue}; @@ -145,7 +145,7 @@ where let key = match K::from_id(cx, id.handle())? { ConversionResult::Success(key) => key, ConversionResult::Failure(message) => { - return Ok(ConversionResult::Failure(message)) + return Ok(ConversionResult::Failure(message)); }, }; @@ -157,7 +157,7 @@ where let property = match V::from_jsval(cx, property.handle(), config.clone())? { ConversionResult::Success(property) => property, ConversionResult::Failure(message) => { - return Ok(ConversionResult::Failure(message)) + return Ok(ConversionResult::Failure(message)); }, }; map.insert(key, property); diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 210eb5127d0..779a7a5bf81 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -6,6 +6,7 @@ use js::rust::HandleObject; +use crate::DomTypes; use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::iterable::{Iterable, IterableIterator}; use crate::dom::bindings::root::{Dom, DomRoot, Root}; @@ -13,7 +14,6 @@ use crate::dom::bindings::trace::JSTraceable; use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers}; use crate::realms::AlreadyInRealm; use crate::script_runtime::{CanGc, JSContext}; -use crate::DomTypes; /// Create the reflector for a new DOM object and yield ownership to the /// reflector. diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index 1f566a59052..1284931c349 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -9,12 +9,12 @@ use std::thread; use js::jsapi::{GetScriptedCallerGlobal, HideScriptedCaller, JSTracer, UnhideScriptedCaller}; use js::rust::Runtime; +use crate::DomTypes; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::trace::JSTraceable; use crate::dom::bindings::utils::DomHelpers; use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers}; use crate::script_runtime::CanGc; -use crate::DomTypes; thread_local!(pub(super) static STACK: RefCell<Vec<StackEntry<crate::DomTypeHolder>>> = const { RefCell::new(Vec::new()) diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 3b59eae311c..d2ce508ad93 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -420,13 +420,8 @@ impl FromInputValueString for &str { Done, Error, } - let next_state = |valid: bool, next: State| -> State { - if valid { - next - } else { - State::Error - } - }; + let next_state = + |valid: bool, next: State| -> State { if valid { next } else { State::Error } }; let state = self.chars().fold(State::HourHigh, |state, c| { match state { diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index b05abf2b9e9..7716110411f 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -14,20 +14,19 @@ use js::glue::{ NewJSAutoStructuredCloneBuffer, WriteBytesToJSStructuredCloneData, }; use js::jsapi::{ - CloneDataPolicy, HandleObject as RawHandleObject, JSContext, JSObject, + CloneDataPolicy, HandleObject as RawHandleObject, JS_ClearPendingException, JS_ReadUint32Pair, + JS_STRUCTURED_CLONE_VERSION, JS_WriteUint32Pair, JSContext, JSObject, JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter, - JS_ClearPendingException, JS_ReadUint32Pair, JS_WriteUint32Pair, MutableHandleObject as RawMutableHandleObject, StructuredCloneScope, TransferableOwnership, - JS_STRUCTURED_CLONE_VERSION, }; use js::jsval::UndefinedValue; use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone}; use js::rust::{CustomAutoRooterGuard, HandleValue, MutableHandleValue}; +use script_traits::StructuredSerializedData; use script_traits::serializable::BlobImpl; use script_traits::transferable::MessagePortImpl; -use script_traits::StructuredSerializedData; -use crate::dom::bindings::conversions::{root_from_object, ToJSValConvertible}; +use crate::dom::bindings::conversions::{ToJSValConvertible, root_from_object}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; @@ -36,7 +35,7 @@ use crate::dom::bindings::transferable::Transferable; use crate::dom::blob::Blob; use crate::dom::globalscope::GlobalScope; use crate::dom::messageport::MessagePort; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; // TODO: Should we add Min and Max const to https://github.com/servo/rust-mozjs/blob/master/src/consts.rs? diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 0497614c533..b53eef8eab7 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -30,8 +30,8 @@ //! `JSTraceable` to a datatype. use std::cell::OnceCell; -use std::collections::hash_map::RandomState; use std::collections::HashMap; +use std::collections::hash_map::RandomState; use std::fmt::Display; use std::hash::{BuildHasher, Hash}; use std::mem; @@ -53,9 +53,9 @@ use servo_arc::Arc as ServoArc; use smallvec::SmallVec; use style::author_styles::AuthorStyles; use style::stylesheet_set::{AuthorStylesheetSet, DocumentStylesheetSet}; +use tendril::TendrilSink; use tendril::fmt::UTF8; use tendril::stream::LossyDecoder; -use tendril::TendrilSink; #[cfg(feature = "webxr")] use webxr_api::{Finger, Hand}; diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 5eab6c6a701..36b81e6e884 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -12,19 +12,21 @@ use std::sync::OnceLock; use std::thread::LocalKey; use std::{ptr, slice, str}; +use js::JS_CALLEE; use js::conversions::ToJSValConvertible; use js::glue::{ CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper, JS_GetReservedSlot, - UnwrapObjectDynamic, UnwrapObjectStatic, RUST_FUNCTION_VALUE_TO_JITINFO, + RUST_FUNCTION_VALUE_TO_JITINFO, UnwrapObjectDynamic, UnwrapObjectStatic, }; use js::jsapi::{ AtomToLinearString, CallArgs, DOMCallbacks, ExceptionStackBehavior, GetLinearStringCharAt, GetLinearStringLength, GetNonCCWObjectGlobal, HandleId as RawHandleId, - HandleObject as RawHandleObject, Heap, JSAtom, JSContext, JSJitInfo, JSObject, JSTracer, - JS_ClearPendingException, JS_DeprecatedStringHasLatin1Chars, JS_EnumerateStandardClasses, - JS_FreezeObject, JS_GetLatin1StringCharsAndLength, JS_IsExceptionPending, JS_IsGlobalObject, - JS_ResolveStandardClass, MutableHandleIdVector as RawMutableHandleIdVector, - MutableHandleValue as RawMutableHandleValue, ObjectOpResult, StringIsArrayIndex, + HandleObject as RawHandleObject, Heap, JS_ClearPendingException, + JS_DeprecatedStringHasLatin1Chars, JS_EnumerateStandardClasses, JS_FreezeObject, + JS_GetLatin1StringCharsAndLength, JS_IsExceptionPending, JS_IsGlobalObject, + JS_ResolveStandardClass, JSAtom, JSContext, JSJitInfo, JSObject, JSTracer, + MutableHandleIdVector as RawMutableHandleIdVector, MutableHandleValue as RawMutableHandleValue, + ObjectOpResult, StringIsArrayIndex, }; use js::jsval::{JSVal, UndefinedValue}; use js::rust::wrappers::{ @@ -33,25 +35,24 @@ use js::rust::wrappers::{ JS_SetPendingException, JS_SetProperty, }; use js::rust::{ - get_object_class, is_dom_class, GCMethods, Handle, HandleId, HandleObject, HandleValue, - MutableHandleValue, ToString, + GCMethods, Handle, HandleId, HandleObject, HandleValue, MutableHandleValue, ToString, + get_object_class, is_dom_class, }; -use js::JS_CALLEE; +use crate::DomTypes; use crate::dom::bindings::codegen::InterfaceObjectMap; use crate::dom::bindings::codegen::PrototypeList::{self, PROTO_OR_IFACE_LENGTH}; use crate::dom::bindings::constructor::call_html_constructor; use crate::dom::bindings::conversions::{ - jsstring_to_str, private_from_proto_check, DerivedFrom, PrototypeCheck, + DerivedFrom, PrototypeCheck, jsstring_to_str, private_from_proto_check, }; -use crate::dom::bindings::error::{throw_dom_exception, throw_invalid_this, Error}; +use crate::dom::bindings::error::{Error, throw_dom_exception, throw_invalid_this}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::settings_stack::{self, StackEntry}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::trace_object; use crate::dom::windowproxy::WindowProxyHandler; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; -use crate::DomTypes; /// A OnceLock wrapping a type that is not considered threadsafe by the Rust compiler, but /// will be used in a threadsafe manner (it will not be mutated, after being initialized). diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs index fa72e7c4c92..31436278c12 100644 --- a/components/script/dom/bindings/xmlname.rs +++ b/components/script/dom/bindings/xmlname.rs @@ -4,7 +4,7 @@ //! Functions for validating and extracting qualified XML names. -use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix}; +use html5ever::{LocalName, Namespace, Prefix, namespace_url, ns}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::str::DOMString; diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index e6b1b57243e..a357fddfaa9 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -17,13 +17,13 @@ use net_traits::filemanager_thread::RelativePos; use script_traits::serializable::BlobImpl; use uuid::Uuid; -use crate::body::{run_array_buffer_data_algorithm, FetchedData}; +use crate::body::{FetchedData, run_array_buffer_data_algorithm}; use crate::dom::bindings::buffer_source::create_buffer_source; use crate::dom::bindings::codegen::Bindings::BlobBinding; use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::serializable::{Serializable, StorageKey}; use crate::dom::bindings::str::DOMString; diff --git a/components/script/dom/bluetooth/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetooth/bluetoothcharacteristicproperties.rs index 3c5daf575ac..d0d5ed23d15 100644 --- a/components/script/dom/bluetooth/bluetoothcharacteristicproperties.rs +++ b/components/script/dom/bluetooth/bluetoothcharacteristicproperties.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/bluetooth/bluetoothdevice.rs b/components/script/dom/bluetooth/bluetoothdevice.rs index d0839af23c9..b339a370290 100644 --- a/components/script/dom/bluetooth/bluetoothdevice.rs +++ b/components/script/dom/bluetooth/bluetoothdevice.rs @@ -20,10 +20,10 @@ use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDe use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; -use crate::dom::bluetooth::{response_async, AsyncBluetoothListener, Bluetooth}; +use crate::dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; use crate::dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use crate::dom::bluetoothremotegattcharacteristic::BluetoothRemoteGATTCharacteristic; use crate::dom::bluetoothremotegattdescriptor::BluetoothRemoteGATTDescriptor; diff --git a/components/script/dom/bluetooth/bluetoothpermissionresult.rs b/components/script/dom/bluetooth/bluetoothpermissionresult.rs index 583bc56febe..a9f80fec851 100644 --- a/components/script/dom/bluetooth/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetooth/bluetoothpermissionresult.rs @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{ }; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bluetooth::{AllowedBluetoothDevice, AsyncBluetoothListener, Bluetooth}; diff --git a/components/script/dom/bluetooth/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetooth/bluetoothremotegattcharacteristic.rs index 8eef9674919..caef9f3ac9b 100644 --- a/components/script/dom/bluetooth/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetooth/bluetoothremotegattcharacteristic.rs @@ -4,7 +4,7 @@ use std::rc::Rc; -use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; +use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType}; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; @@ -19,10 +19,10 @@ use crate::dom::bindings::error::Error::{ self, InvalidModification, Network, NotSupported, Security, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{ByteString, DOMString}; -use crate::dom::bluetooth::{get_gatt_children, response_async, AsyncBluetoothListener}; +use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use crate::dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use crate::dom::bluetoothremotegattservice::BluetoothRemoteGATTService; use crate::dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID}; diff --git a/components/script/dom/bluetooth/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetooth/bluetoothremotegattdescriptor.rs index 1962a23d74d..b6f6eafcf18 100644 --- a/components/script/dom/bluetooth/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetooth/bluetoothremotegattdescriptor.rs @@ -4,7 +4,7 @@ use std::rc::Rc; -use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; +use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; @@ -16,10 +16,10 @@ use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::B use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; use crate::dom::bindings::error::Error::{self, InvalidModification, Network, Security}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{ByteString, DOMString}; -use crate::dom::bluetooth::{response_async, AsyncBluetoothListener}; +use crate::dom::bluetooth::{AsyncBluetoothListener, response_async}; use crate::dom::bluetoothremotegattcharacteristic::{ BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH, }; diff --git a/components/script/dom/bluetooth/bluetoothremotegattserver.rs b/components/script/dom/bluetooth/bluetoothremotegattserver.rs index 3fb2f24ce39..eae54e37664 100644 --- a/components/script/dom/bluetooth/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetooth/bluetoothremotegattserver.rs @@ -12,9 +12,9 @@ use ipc_channel::ipc::IpcSender; use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use crate::dom::bindings::error::{Error, ErrorResult}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; -use crate::dom::bluetooth::{get_gatt_children, response_async, AsyncBluetoothListener}; +use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use crate::dom::bluetoothdevice::BluetoothDevice; use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/bluetooth/bluetoothremotegattservice.rs b/components/script/dom/bluetooth/bluetoothremotegattservice.rs index bb232f5f88a..7dffabaa012 100644 --- a/components/script/dom/bluetooth/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetooth/bluetoothremotegattservice.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::error::Error; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; -use crate::dom::bluetooth::{get_gatt_children, AsyncBluetoothListener}; +use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children}; use crate::dom::bluetoothdevice::BluetoothDevice; use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUID, BluetoothUUID}; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/bluetooth/bluetoothuuid.rs b/components/script/dom/bluetooth/bluetoothuuid.rs index 719625eb659..9d7423762d4 100644 --- a/components/script/dom/bluetooth/bluetoothuuid.rs +++ b/components/script/dom/bluetooth/bluetoothuuid.rs @@ -573,12 +573,10 @@ const VALID_UUID_REGEX: &str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4} const UUID_ERROR_MESSAGE: &str = "It must be a valid UUID alias (e.g. 0x1234), \ UUID (lowercase hex characters e.g. '00001234-0000-1000-8000-00805f9b34fb'),\nor recognized standard name from"; // https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/bluetooth/BluetoothUUID.cpp?l=321 -const SERVICES_ERROR_MESSAGE: &str = - "https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx\ +const SERVICES_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx\ \ne.g. 'alert_notification'."; // https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/bluetooth/BluetoothUUID.cpp?l=327 -const CHARACTERISTIC_ERROR_MESSAGE: &str = - "https://developer.bluetooth.org/gatt/characteristics/Pages/\ +const CHARACTERISTIC_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/characteristics/Pages/\ CharacteristicsHome.aspx\ne.g. 'aerobic_heart_rate_lower_limit'."; // https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/bluetooth/BluetoothUUID.cpp?l=333 const DESCRIPTOR_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/descriptors/Pages/\ diff --git a/components/script/dom/bluetooth/testrunner.rs b/components/script/dom/bluetooth/testrunner.rs index 6cd42efbbef..c26ca87d889 100644 --- a/components/script/dom/bluetooth/testrunner.rs +++ b/components/script/dom/bluetooth/testrunner.rs @@ -10,7 +10,7 @@ use profile_traits::ipc; use crate::conversions::Convert; use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use crate::dom::bindings::error::ErrorResult; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/broadcastchannel.rs b/components/script/dom/broadcastchannel.rs index 84e61aae25b..2d7d6740589 100644 --- a/components/script/dom/broadcastchannel.rs +++ b/components/script/dom/broadcastchannel.rs @@ -11,7 +11,7 @@ use uuid::Uuid; use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods; use crate::dom::bindings::error::{Error, ErrorResult}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone; diff --git a/components/script/dom/bytelengthqueuingstrategy.rs b/components/script/dom/bytelengthqueuingstrategy.rs index 6ebffe81314..a9c2cda360e 100644 --- a/components/script/dom/bytelengthqueuingstrategy.rs +++ b/components/script/dom/bytelengthqueuingstrategy.rs @@ -15,7 +15,7 @@ use super::bindings::codegen::Bindings::QueuingStrategyBinding::{ ByteLengthQueuingStrategyMethods, QueuingStrategyInit, }; use super::bindings::error::Fallible; -use super::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use super::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use super::bindings::root::DomRoot; use super::types::GlobalScope; use crate::dom::bindings::import::module::get_dictionary_property; diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index d06e9578033..5eb1318d707 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasGradientMethods; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index 6104540652b..9953a4e2f00 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -6,7 +6,7 @@ use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom_struct::dom_struct; use euclid::default::Size2D; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::canvasgradient::ToFillOrStrokeStyle; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index c5182c6fd83..909ea6a4d89 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -22,7 +22,7 @@ use crate::dom::bindings::codegen::UnionTypes::{ }; use crate::dom::bindings::error::{ErrorResult, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, LayoutDom}; use crate::dom::bindings::str::DOMString; use crate::dom::canvasgradient::CanvasGradient; diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs index f590e2075e8..0ae6b8d74a5 100644 --- a/components/script/dom/client.rs +++ b/components/script/dom/client.rs @@ -9,7 +9,7 @@ use servo_url::ServoUrl; use uuid::Uuid; use crate::dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, FrameType}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::serviceworker::ServiceWorker; diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index 945228e225a..91ef05a00c5 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -17,7 +17,7 @@ use js::rust::wrappers::{ JS_IdToValue, JS_Stringify, JS_ValueToSource, }; use js::rust::{ - describe_scripted_caller, CapturedJSStack, HandleObject, HandleValue, IdVector, ToString, + CapturedJSStack, HandleObject, HandleValue, IdVector, ToString, describe_scripted_caller, }; use script_bindings::conversions::get_dom_class; diff --git a/components/script/dom/countqueuingstrategy.rs b/components/script/dom/countqueuingstrategy.rs index 6e6eef9f357..4ae4ebf3c58 100644 --- a/components/script/dom/countqueuingstrategy.rs +++ b/components/script/dom/countqueuingstrategy.rs @@ -14,7 +14,7 @@ use super::bindings::codegen::Bindings::QueuingStrategyBinding::{ CountQueuingStrategyMethods, QueuingStrategy, QueuingStrategyInit, QueuingStrategySize, }; use super::bindings::error::{Error, Fallible}; -use super::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use super::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use super::bindings::root::DomRoot; use super::types::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs index f110e28314d..14774549b27 100644 --- a/components/script/dom/create.rs +++ b/components/script/dom/create.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName}; +use html5ever::{LocalName, Prefix, QualName, local_name, namespace_url, ns}; use js::rust::HandleObject; use servo_config::pref; @@ -10,7 +10,7 @@ use crate::dom::bindings::error::{report_pending_exception, throw_dom_exception} use crate::dom::bindings::reflector::DomGlobal; use crate::dom::bindings::root::DomRoot; use crate::dom::customelementregistry::{ - is_valid_custom_element_name, upgrade_element, CustomElementState, + CustomElementState, is_valid_custom_element_name, upgrade_element, }; use crate::dom::document::Document; use crate::dom::element::{CustomElementCreationMode, Element, ElementCreator}; @@ -86,7 +86,7 @@ use crate::dom::htmlunknownelement::HTMLUnknownElement; use crate::dom::htmlvideoelement::HTMLVideoElement; use crate::dom::svgelement::SVGElement; use crate::dom::svgsvgelement::SVGSVGElement; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; use crate::script_thread::ScriptThread; diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index 98d9d717de1..0550d5920d5 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -12,7 +12,7 @@ use uuid::Uuid; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/cryptokey.rs b/components/script/dom/cryptokey.rs index c77dca1dd12..5cdd5f3ea79 100644 --- a/components/script/dom/cryptokey.rs +++ b/components/script/dom/cryptokey.rs @@ -12,7 +12,7 @@ use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::CryptoKeyBinding::{ CryptoKeyMethods, KeyType, KeyUsage, }; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs index f7fdee79350..7a4623b23f1 100644 --- a/components/script/dom/css.rs +++ b/components/script/dom/css.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 https://mozilla.org/MPL/2.0/. */ -use cssparser::{serialize_identifier, Parser, ParserInput}; +use cssparser::{Parser, ParserInput, serialize_identifier}; use dom_struct::dom_struct; use style::context::QuirksMode; use style::parser::ParserContext; -use style::stylesheets::supports_rule::{parse_condition_or_declaration, Declaration}; +use style::stylesheets::supports_rule::{Declaration, parse_condition_or_declaration}; use style::stylesheets::{CssRuleType, Origin, UrlExtraData}; use style_traits::ParsingMode; diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index bbf78b90797..6ab2a4960c3 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -5,12 +5,12 @@ use dom_struct::dom_struct; use servo_arc::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; -use style::stylesheets::keyframes_rule::Keyframe; use style::stylesheets::CssRuleType; +use style::stylesheets::keyframes_rule::Keyframe; use crate::dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::CSSKeyframeRuleMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index 4475d6042e7..be36ed0f6f4 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -6,14 +6,14 @@ use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; -use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesRule}; use style::stylesheets::CssRuleType; +use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesRule}; use style::values::KeyframesName; use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use crate::dom::bindings::error::ErrorResult; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::csskeyframerule::CSSKeyframeRule; diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index eba1e2d8046..069c44bd2d4 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -9,7 +9,7 @@ use style::stylesheets::{CssRuleType, MediaRule}; use style_traits::ToCss; use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssconditionrule::CSSConditionRule; diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index c81eab7711c..9990be38148 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -159,11 +159,7 @@ impl CSSRuleMethods<crate::DomTypeHolder> for CSSRule { let rule_type = self.as_specific().ty() as u16; // Per https://drafts.csswg.org/cssom/#dom-cssrule-type for constants > 15 // we return 0. - if rule_type > 15 { - 0 - } else { - rule_type - } + if rule_type > 15 { 0 } else { rule_type } } // https://drafts.csswg.org/cssom/#dom-cssrule-parentstylesheet diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 678f04d45bb..f96d2a8018a 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -16,7 +16,7 @@ use crate::conversions::Convert; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::csskeyframerule::CSSKeyframeRule; use crate::dom::cssrule::CSSRule; diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index b45af93f6c2..2909ebe077e 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -11,8 +11,8 @@ use servo_arc::Arc; use servo_url::ServoUrl; use style::attr::AttrValue; use style::properties::{ - parse_one_declaration_into, parse_style_attribute, Importance, LonghandId, - PropertyDeclarationBlock, PropertyId, ShorthandId, SourcePropertyDeclaration, + Importance, LonghandId, PropertyDeclarationBlock, PropertyId, ShorthandId, + SourcePropertyDeclaration, parse_one_declaration_into, parse_style_attribute, }; use style::selector_parser::PseudoElement; use style::shared_lock::Locked; @@ -23,7 +23,7 @@ use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyl use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::CSSRule; diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 5a41600d433..14d23079d36 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -14,7 +14,7 @@ use style::stylesheets::{CssRuleType, Origin, StyleRule}; use crate::dom::bindings::codegen::Bindings::CSSStyleRuleBinding::CSSStyleRuleMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index 8ad8d12b8fe..e5d802eb532 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -11,7 +11,7 @@ use style::stylesheets::{CssRuleTypes, Stylesheet as StyleStyleSheet}; use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrulelist::{CSSRuleList, RulesSource}; diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs index 4f32369a3ef..d151dcc350d 100644 --- a/components/script/dom/cssstylevalue.rs +++ b/components/script/dom/cssstylevalue.rs @@ -7,7 +7,7 @@ use dom_struct::dom_struct; use servo_url::ServoUrl; use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 93eb26e42ad..a307eae2294 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -9,7 +9,7 @@ use std::rc::Rc; use std::{mem, ptr}; use dom_struct::dom_struct; -use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix}; +use html5ever::{LocalName, Namespace, Prefix, namespace_url, ns}; use js::conversions::ToJSValConvertible; use js::glue::UnwrapObjectStatic; use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor, JSAutoRealm, JSObject}; @@ -30,10 +30,10 @@ use crate::dom::bindings::conversions::{ ConversionResult, FromJSValConvertible, StringificationBehavior, }; use crate::dom::bindings::error::{ - report_pending_exception, throw_dom_exception, Error, ErrorResult, Fallible, + Error, ErrorResult, Fallible, report_pending_exception, throw_dom_exception, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, DomObject, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::settings_stack::is_execution_stack_empty; use crate::dom::bindings::str::DOMString; @@ -47,7 +47,7 @@ use crate::dom::node::{Node, NodeTraits, ShadowIncluding}; use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::microtask::Microtask; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext}; use crate::script_thread::ScriptThread; diff --git a/components/script/dom/datatransfer.rs b/components/script/dom/datatransfer.rs index 4b44d1e7fc0..0626ec27787 100644 --- a/components/script/dom/datatransfer.rs +++ b/components/script/dom/datatransfer.rs @@ -11,7 +11,7 @@ use js::rust::{HandleObject, MutableHandleValue}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DataTransferBinding::DataTransferMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::datatransferitemlist::DataTransferItemList; diff --git a/components/script/dom/datatransferitem.rs b/components/script/dom/datatransferitem.rs index db25b62178e..777f590ee3a 100644 --- a/components/script/dom/datatransferitem.rs +++ b/components/script/dom/datatransferitem.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::DataTransferItemBinding::{ DataTransferItemMethods, FunctionStringCallback, }; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::file::File; diff --git a/components/script/dom/datatransferitemlist.rs b/components/script/dom/datatransferitemlist.rs index 3f2f029ab67..0977834ddb7 100644 --- a/components/script/dom/datatransferitemlist.rs +++ b/components/script/dom/datatransferitemlist.rs @@ -11,7 +11,7 @@ use js::rust::MutableHandleValue; use crate::dom::bindings::codegen::Bindings::DataTransferItemListBinding::DataTransferItemListMethods; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::frozenarray::CachedFrozenArray; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::datatransferitem::DataTransferItem; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index af4a61e44e7..4f013dbb6c0 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -2,25 +2,25 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::thread::{self, JoinHandle}; use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId}; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::IpcReceiver; use ipc_channel::router::ROUTER; -use js::jsapi::{Heap, JSContext, JSObject, JS_AddInterruptCallback}; +use js::jsapi::{Heap, JS_AddInterruptCallback, JSContext, JSObject}; use js::jsval::UndefinedValue; use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue}; +use net_traits::IpcSend; use net_traits::image_cache::ImageCache; use net_traits::request::{ CredentialsMode, Destination, InsecureRequestsPolicy, ParserMetadata, Referrer, RequestBuilder, RequestMode, }; -use net_traits::IpcSend; use script_traits::{WorkerGlobalScopeInit, WorkerScriptLoadOrigin}; use servo_rand::random; use servo_url::{ImmutableOrigin, ServoUrl}; @@ -28,7 +28,7 @@ use style::thread_state::{self, ThreadState}; use crate::devtools; use crate::dom::abstractworker::{SimpleWorkerErrorHandler, WorkerScriptMsg}; -use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods}; +use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding; use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::DedicatedWorkerGlobalScopeMethods; @@ -52,7 +52,7 @@ use crate::dom::worker::{TrustedWorkerAddress, Worker}; use crate::dom::workerglobalscope::WorkerGlobalScope; use crate::fetch::load_whole_resource; use crate::messaging::{CommonScriptMsg, ScriptEventLoopReceiver, ScriptEventLoopSender}; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent; use crate::script_runtime::{CanGc, JSContext as SafeJSContext, Runtime, ThreadSafeJSContext}; use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; diff --git a/components/script/dom/defaultteeunderlyingsource.rs b/components/script/dom/defaultteeunderlyingsource.rs index c949fb7c660..34c374dd71d 100644 --- a/components/script/dom/defaultteeunderlyingsource.rs +++ b/components/script/dom/defaultteeunderlyingsource.rs @@ -13,7 +13,7 @@ use js::rust::HandleValue as SafeHandleValue; use super::bindings::root::{DomRoot, MutNullableDom}; use super::types::{ReadableStream, ReadableStreamDefaultReader}; use crate::dom::bindings::import::module::Error; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::Dom; use crate::dom::defaultteereadrequest::DefaultTeeReadRequest; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index bc4d62c689a..7e3e468eb45 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::DissimilarOriginLocationMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow; diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index a1b6b8cd04b..6458b11e481 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -31,7 +31,7 @@ use embedder_traits::{ }; use encoding_rs::{Encoding, UTF_8}; use euclid::default::{Point2D, Rect, Size2D}; -use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName}; +use html5ever::{LocalName, Namespace, QualName, local_name, namespace_url, ns}; use hyper_serde::Serde; use ipc_channel::ipc; use js::rust::{HandleObject, HandleValue}; @@ -41,12 +41,12 @@ use metrics::{ ProgressiveWebMetric, }; use mime::{self, Mime}; +use net_traits::CookieSource::NonHTTP; +use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::policy_container::PolicyContainer; use net_traits::pub_domains::is_pub_domain; use net_traits::request::{InsecureRequestsPolicy, RequestBuilder}; use net_traits::response::HttpsState; -use net_traits::CookieSource::NonHTTP; -use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::{FetchResponseListener, IpcSend, ReferrerPolicy}; use num_traits::ToPrimitive; use percent_encoding::percent_decode; @@ -78,6 +78,7 @@ use webrender_traits::CompositorHitTestResult; use super::bindings::codegen::Bindings::XPathEvaluatorBinding::XPathEvaluatorMethods; use super::clipboardevent::ClipboardEventType; +use crate::DomTypes; use crate::animation_timeline::AnimationTimeline; use crate::animations::Animations; use crate::canvas_context::CanvasContext as _; @@ -110,7 +111,7 @@ use crate::dom::bindings::error::{Error, ErrorInfo, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, DomSlice, LayoutDom, MutNullableDom, ToLayout}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::trace::{HashMapTracedValues, NoTrace}; @@ -199,14 +200,13 @@ use crate::fetch::FetchCanceller; use crate::iframe_collection::IFrameCollection; use crate::messaging::{CommonScriptMsg, MainThreadScriptMsg}; use crate::network_listener::{NetworkListener, PreInvoke}; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, ScriptThreadEventCategory}; -use crate::script_thread::{with_script_thread, ScriptThread}; +use crate::script_thread::{ScriptThread, with_script_thread}; use crate::stylesheet_set::StylesheetSetRef; use crate::task::TaskBox; use crate::task_source::TaskSourceName; use crate::timers::OneshotTimerCallback; -use crate::DomTypes; /// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before /// falling back to fake ones. diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 2a69b453e37..6a2ec644e5d 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::{ }; use crate::dom::bindings::error::Error; use crate::dom::bindings::reflector::{ - reflect_dom_object, reflect_dom_object_with_proto, Reflector, + Reflector, reflect_dom_object, reflect_dom_object_with_proto, }; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index f2258ae9204..8d455f8c00a 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::UnionTypes::StringOrElementCreationOptions; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::xmlname::{ diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index f5491e8cefe..bfc6b32aa21 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object_with_proto; use crate::dom::bindings::root::DomRoot; use crate::dom::dommatrixreadonly::{ - dommatrixinit_to_matrix, entries_to_matrix, transform_to_matrix, DOMMatrixReadOnly, + DOMMatrixReadOnly, dommatrixinit_to_matrix, entries_to_matrix, transform_to_matrix, }; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index 97887315726..bae91f1edb0 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -7,8 +7,8 @@ use std::{f64, ptr}; use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; -use euclid::default::Transform3D; use euclid::Angle; +use euclid::default::Transform3D; use js::jsapi::JSObject; use js::jsval; use js::rust::{CustomAutoRooterGuard, HandleObject, ToString}; @@ -26,7 +26,7 @@ use crate::dom::bindings::conversions::jsstring_to_str; use crate::dom::bindings::error; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::dommatrix::DOMMatrix; diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index 5357516d71e..5945c77023d 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::{ use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index ed29b9f7513..d437c470cc9 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -10,7 +10,7 @@ use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index ea21272019e..ac5df6fd36b 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOM use crate::dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods}; use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::dompoint::DOMPoint; use crate::dom::domrect::DOMRect; diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 1748b7e6f68..e595065d3c0 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{ use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; -use crate::dom::domrectreadonly::{create_a_domrectreadonly_from_the_dictionary, DOMRectReadOnly}; +use crate::dom::domrectreadonly::{DOMRectReadOnly, create_a_domrectreadonly_from_the_dictionary}; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/domrectlist.rs b/components/script/dom/domrectlist.rs index 83f161ae442..de130e0c972 100644 --- a/components/script/dom/domrectlist.rs +++ b/components/script/dom/domrectlist.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DOMRectListBinding::DOMRectListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::domrect::DOMRect; use crate::dom::window::Window; diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs index bdad365b55e..d50045b8bfd 100644 --- a/components/script/dom/domrectreadonly.rs +++ b/components/script/dom/domrectreadonly.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::{ - reflect_dom_object, reflect_dom_object_with_proto, Reflector, + Reflector, reflect_dom_object, reflect_dom_object_with_proto, }; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/domstringlist.rs b/components/script/dom/domstringlist.rs index f78035bd344..a3fc89be90b 100644 --- a/components/script/dom/domstringlist.rs +++ b/components/script/dom/domstringlist.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::DOMStringListBinding::DOMStringListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 5b8f9e623e4..710a77305d4 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use crate::dom::bindings::error::ErrorResult; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::htmlelement::HTMLElement; diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 96c9d14430f..3813a810964 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -3,14 +3,14 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{namespace_url, ns, LocalName}; +use html5ever::{LocalName, namespace_url, ns}; use servo_atoms::Atom; use style::str::HTML_SPACE_CHARACTERS; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/dynamicmoduleowner.rs b/components/script/dom/dynamicmoduleowner.rs index 61c88a48e18..4c985c9048b 100644 --- a/components/script/dom/dynamicmoduleowner.rs +++ b/components/script/dom/dynamicmoduleowner.rs @@ -8,7 +8,7 @@ use dom_struct::dom_struct; use uuid::Uuid; use crate::dom::bindings::codegen::Bindings::DynamicModuleOwnerBinding::DynamicModuleOwnerMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 643e06ee35f..47598081bca 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -19,18 +19,18 @@ use embedder_traits::InputMethodType; use euclid::default::{Rect, Size2D}; use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; use html5ever::{ - local_name, namespace_prefix, namespace_url, ns, LocalName, Namespace, Prefix, QualName, + LocalName, Namespace, Prefix, QualName, local_name, namespace_prefix, namespace_url, ns, }; use js::jsapi::Heap; use js::jsval::JSVal; use js::rust::HandleObject; -use net_traits::request::CorsSettings; use net_traits::ReferrerPolicy; +use net_traits::request::CorsSettings; +use selectors::Element as SelectorsElement; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; -use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK}; +use selectors::bloom::{BLOOM_HASH_MASK, BloomFilter}; use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::sink::Push; -use selectors::Element as SelectorsElement; use servo_arc::Arc; use servo_atoms::Atom; use style::applicable_declarations::ApplicableDeclarationBlock; @@ -41,22 +41,22 @@ use style::properties::longhands::{ self, background_image, border_spacing, font_family, font_size, }; use style::properties::{ - parse_style_attribute, ComputedValues, Importance, PropertyDeclaration, - PropertyDeclarationBlock, + ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock, + parse_style_attribute, }; use style::rule_tree::CascadeLevel; use style::selector_parser::{ - extended_filtering, NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, - SelectorParser, + NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser, + extended_filtering, }; use style::shared_lock::{Locked, SharedRwLock}; use style::stylesheets::layer_rule::LayerOrder; use style::stylesheets::{CssRuleType, UrlExtraData}; +use style::values::generics::NonNegative; use style::values::generics::position::PreferredRatio; use style::values::generics::ratio::Ratio; -use style::values::generics::NonNegative; -use style::values::{computed, specified, AtomIdent, AtomString, CSSFloat}; -use style::{dom_apis, thread_state, ArcSlice, CaseSensitivityExt}; +use style::values::{AtomIdent, AtomString, CSSFloat, computed, specified}; +use style::{ArcSlice, CaseSensitivityExt, dom_apis, thread_state}; use style_dom::ElementState; use xml5ever::serialize::TraversalScope::{ ChildrenOnly as XmlChildrenOnly, IncludeNode as XmlIncludeNode, @@ -64,7 +64,7 @@ use xml5ever::serialize::TraversalScope::{ use crate::dom::activation::Activatable; use crate::dom::attr::{Attr, AttrHelpersForLayout}; -use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref, RefMut}; +use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut, ref_filter_map}; use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::codegen::Bindings::ElementBinding::{ElementMethods, ShadowRootInit}; @@ -91,11 +91,11 @@ use crate::dom::bindings::xmlname::{ use crate::dom::characterdata::CharacterData; use crate::dom::create::create_element; use crate::dom::customelementregistry::{ - is_valid_custom_element_name, CallbackReaction, CustomElementDefinition, CustomElementReaction, - CustomElementState, + CallbackReaction, CustomElementDefinition, CustomElementReaction, CustomElementState, + is_valid_custom_element_name, }; use crate::dom::document::{ - determine_policy_for_token, Document, LayoutDocumentHelpers, ReflowTriggerCondition, + Document, LayoutDocumentHelpers, ReflowTriggerCondition, determine_policy_for_token, }; use crate::dom::documentfragment::DocumentFragment; use crate::dom::domrect::DOMRect; @@ -150,7 +150,7 @@ use crate::dom::shadowroot::{IsUserAgentWidget, ShadowRoot}; use crate::dom::text::Text; use crate::dom::validation::Validatable; use crate::dom::validitystate::ValidationFlags; -use crate::dom::virtualmethods::{vtable_for, VirtualMethods}; +use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; use crate::script_runtime::CanGc; use crate::script_thread::ScriptThread; use crate::stylesheet_loader::StylesheetOwner; @@ -1914,9 +1914,11 @@ impl Element { pub(crate) fn get_int_attribute(&self, local_name: &LocalName, default: i32) -> i32 { // TODO: Is this assert necessary? - assert!(local_name - .chars() - .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)); + assert!( + local_name + .chars() + .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch) + ); let attribute = self.get_attribute(&ns!(), local_name); match attribute { @@ -1937,9 +1939,11 @@ impl Element { } pub(crate) fn get_uint_attribute(&self, local_name: &LocalName, default: u32) -> u32 { - assert!(local_name - .chars() - .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)); + assert!( + local_name + .chars() + .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch) + ); let attribute = self.get_attribute(&ns!(), local_name); match attribute { Some(ref attribute) => match *attribute.value() { @@ -3103,7 +3107,7 @@ impl ElementMethods<crate::DomTypeHolder> for Element { AdjacentPosition::BeforeBegin | AdjacentPosition::AfterEnd => { match self.upcast::<Node>().GetParentNode() { Some(ref node) if node.is::<Document>() => { - return Err(Error::NoModificationAllowed) + return Err(Error::NoModificationAllowed); }, None => return Err(Error::NoModificationAllowed), Some(node) => node, diff --git a/components/script/dom/elementinternals.rs b/components/script/dom/elementinternals.rs index f9b2651e3fe..974799dd255 100644 --- a/components/script/dom/elementinternals.rs +++ b/components/script/dom/elementinternals.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::ElementInternalsBinding::{ use crate::dom::bindings::codegen::UnionTypes::FileOrUSVStringOrFormData; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::element::Element; @@ -23,7 +23,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlformelement::{FormDatum, FormDatumValue, HTMLFormElement}; use crate::dom::node::{Node, NodeTraits}; use crate::dom::nodelist::NodeList; -use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable}; +use crate::dom::validation::{Validatable, is_barred_by_datalist_ancestor}; use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::script_runtime::CanGc; diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 8416bbe17f1..a39325b86c2 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -25,7 +25,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index bbec13d0d83..70caa4949d5 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -32,7 +32,7 @@ use crate::dom::bindings::codegen::Bindings::EventSourceBinding::{ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; @@ -40,7 +40,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::dom::performanceresourcetiming::InitiatorType; -use crate::fetch::{create_a_potential_cors_request, FetchCanceller}; +use crate::fetch::{FetchCanceller, create_a_potential_cors_request}; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use crate::realms::enter_realm; use crate::script_runtime::CanGc; @@ -343,7 +343,7 @@ impl FetchResponseListener for EventSourceContext { FetchMetadata::Unfiltered(m) => m, FetchMetadata::Filtered { unsafe_, filtered } => match filtered { FilteredMetadata::Opaque | FilteredMetadata::OpaqueRedirect(_) => { - return self.fail_the_connection() + return self.fail_the_connection(); }, _ => unsafe_, }, diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index b66a54cb5a5..96b18558774 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -18,7 +18,7 @@ use js::jsapi::JS_GetFunctionObject; use js::jsval::JSVal; use js::rust::wrappers::CompileFunction; use js::rust::{ - transform_u16_to_source_text, CompileOptionsWrapper, HandleObject, RootedObjectVectorWrapper, + CompileOptionsWrapper, HandleObject, RootedObjectVectorWrapper, transform_u16_to_source_text, }; use libc::c_char; use servo_atoms::Atom; @@ -44,10 +44,10 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::UnionTypes::{ AddEventListenerOptionsOrBoolean, EventListenerOptionsOrBoolean, EventOrString, }; -use crate::dom::bindings::error::{report_pending_exception, Error, Fallible}; +use crate::dom::bindings::error::{Error, Fallible, report_pending_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::{ - reflect_dom_object_with_proto, DomGlobal, DomObject, Reflector, + DomGlobal, DomObject, Reflector, reflect_dom_object_with_proto, }; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; @@ -63,7 +63,7 @@ use crate::dom::shadowroot::ShadowRoot; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; use crate::dom::workerglobalscope::WorkerGlobalScope; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; #[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)] diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index ac35b5292de..06671794c13 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -18,7 +18,7 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object_with_proto; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; -use crate::dom::blob::{blob_parts_to_bytes, normalize_type_string, Blob}; +use crate::dom::blob::{Blob, blob_parts_to_bytes, normalize_type_string}; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index ae96218f0ab..d526b54b99b 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -7,7 +7,7 @@ use std::slice::Iter; use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::file::File; use crate::dom::window::Window; diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 88dd7fcd731..32808a66fd0 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -24,7 +24,7 @@ use crate::dom::bindings::codegen::UnionTypes::StringOrObject; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs index db65c8112af..54c83e473ae 100644 --- a/components/script/dom/filereadersync.rs +++ b/components/script/dom/filereadersync.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::buffer_source::create_buffer_source; use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::FileReaderSyncMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::blob::Blob; diff --git a/components/script/dom/fontface.rs b/components/script/dom/fontface.rs index 5386eed7a86..c21f3a86a08 100644 --- a/components/script/dom/fontface.rs +++ b/components/script/dom/fontface.rs @@ -27,7 +27,7 @@ use crate::dom::bindings::codegen::Bindings::FontFaceBinding::{ }; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::UnionTypes; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 23bb2627e4d..2a3a52df8eb 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::UnionTypes::FileOrUSVString; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::Blob; diff --git a/components/script/dom/formdataevent.rs b/components/script/dom/formdataevent.rs index 267363a3a32..03fffb2a760 100644 --- a/components/script/dom/formdataevent.rs +++ b/components/script/dom/formdataevent.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::FormDataEventBinding; use crate::dom::bindings::codegen::Bindings::FormDataEventBinding::FormDataEventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index b209f84caeb..f4c649d0c42 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadBinding::{GamepadHand, Gamep use crate::dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/gamepadbutton.rs b/components/script/dom/gamepadbutton.rs index 6abdd783b7f..fead990ccd3 100644 --- a/components/script/dom/gamepadbutton.rs +++ b/components/script/dom/gamepadbutton.rs @@ -8,7 +8,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::GamepadButtonBinding::GamepadButtonMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index 92d4edac0a3..50d9c8172bc 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, DomSlice}; use crate::dom::gamepadbutton::GamepadButton; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index 0fcca49d793..df01850ab22 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadEventBinding; use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/gamepadhapticactuator.rs b/components/script/dom/gamepadhapticactuator.rs index 5f23a9d07f7..fc8dbbd7add 100644 --- a/components/script/dom/gamepadhapticactuator.rs +++ b/components/script/dom/gamepadhapticactuator.rs @@ -18,7 +18,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadHapticActuatorBinding::{ use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::error::Error; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::utils::to_frozen_array; diff --git a/components/script/dom/gamepadpose.rs b/components/script/dom/gamepadpose.rs index bb77e90701e..8737a5a7d32 100644 --- a/components/script/dom/gamepadpose.rs +++ b/components/script/dom/gamepadpose.rs @@ -7,7 +7,7 @@ use js::typedarray::{Float32, Float32Array}; use super::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::codegen::Bindings::GamepadPoseBinding::GamepadPoseMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::{CanGc, JSContext}; diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index dabcbc80a75..ceeca775f53 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -37,12 +37,12 @@ use js::jsval::{PrivateValue, UndefinedValue}; use js::panic::maybe_resume_unwind; use js::rust::wrappers::{JS_ExecuteScript, JS_GetScriptPrivate}; use js::rust::{ - describe_scripted_caller, get_object_class, transform_str_to_source_text, CompileOptionsWrapper, CustomAutoRooter, CustomAutoRooterGuard, HandleValue, - MutableHandleValue, ParentRuntime, Runtime, + MutableHandleValue, ParentRuntime, Runtime, describe_scripted_caller, get_object_class, + transform_str_to_source_text, }; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; -use net_traits::blob_url_store::{get_blob_origin, BlobBuf}; +use net_traits::blob_url_store::{BlobBuf, get_blob_origin}; use net_traits::filemanager_thread::{ FileManagerResult, FileManagerThreadMsg, ReadFileProgress, RelativePos, }; @@ -51,8 +51,8 @@ use net_traits::policy_container::PolicyContainer; use net_traits::request::{InsecureRequestsPolicy, Referrer, RequestBuilder}; use net_traits::response::HttpsState; use net_traits::{ - fetch_async, CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend, - ReferrerPolicy, ResourceThreads, + CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend, ReferrerPolicy, + ResourceThreads, fetch_async, }; use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time}; use script_traits::serializable::{BlobData, BlobImpl, FileBlob}; @@ -89,13 +89,13 @@ use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use crate::dom::bindings::conversions::{root_from_object, root_from_object_static}; -use crate::dom::bindings::error::{report_pending_exception, Error, ErrorInfo}; +use crate::dom::bindings::error::{Error, ErrorInfo, report_pending_exception}; use crate::dom::bindings::frozenarray::CachedFrozenArray; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::{DomGlobal, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; -use crate::dom::bindings::settings_stack::{entry_global, incumbent_global, AutoEntryScript}; +use crate::dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone; use crate::dom::bindings::trace::CustomTraceable; @@ -111,7 +111,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus}; use crate::dom::eventsource::EventSource; use crate::dom::eventtarget::EventTarget; use crate::dom::file::File; -use crate::dom::gamepad::{contains_user_gesture, Gamepad}; +use crate::dom::gamepad::{Gamepad, contains_user_gesture}; use crate::dom::gamepadevent::GamepadEventType; use crate::dom::htmlscriptelement::{ScriptId, SourceCode}; use crate::dom::imagebitmap::ImageBitmap; @@ -135,10 +135,10 @@ use crate::dom::workletglobalscope::WorkletGlobalScope; use crate::messaging::{CommonScriptMsg, ScriptEventLoopReceiver, ScriptEventLoopSender}; use crate::microtask::{Microtask, MicrotaskQueue, UserMicrotask}; use crate::network_listener::{NetworkListener, PreInvoke}; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_module::{DynamicModuleList, ModuleScript, ModuleTree, ScriptFetchOptions}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext, ThreadSafeJSContext}; -use crate::script_thread::{with_script_thread, ScriptThread}; +use crate::script_thread::{ScriptThread, with_script_thread}; use crate::security_manager::CSPViolationReporter; use crate::task_manager::TaskManager; use crate::task_source::SendableTaskSource; diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index 7024f7b8cb5..10a8be731bf 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -18,9 +18,9 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::str::{is_token, ByteString}; +use crate::dom::bindings::str::{ByteString, is_token}; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; @@ -270,9 +270,10 @@ impl Headers { let name = seq.pop().unwrap(); self.Append(name, val)?; } else { - return Err(Error::Type( - format!("Each header object must be a sequence of length 2 - found one with length {}", - seq.len()))); + return Err(Error::Type(format!( + "Each header object must be a sequence of length 2 - found one with length {}", + seq.len() + ))); } } Ok(()) diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index 1ffc107b446..f79529f13b4 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -22,7 +22,7 @@ use crate::dom::bindings::codegen::Bindings::LocationBinding::Location_Binding:: use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::structuredclone; diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 70452f5b3ef..ea7fe80bf68 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -6,7 +6,7 @@ use std::cell::Cell; use std::default::Default; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use num_traits::ToPrimitive; use servo_atoms::Atom; @@ -24,7 +24,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::document::Document; use crate::dom::domtokenlist::DOMTokenList; -use crate::dom::element::{reflect_referrer_policy_attribute, AttributeMutation, Element}; +use crate::dom::element::{AttributeMutation, Element, reflect_referrer_policy_attribute}; use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; @@ -33,7 +33,7 @@ use crate::dom::htmlimageelement::HTMLImageElement; use crate::dom::mouseevent::MouseEvent; use crate::dom::node::{BindContext, Node}; use crate::dom::virtualmethods::VirtualMethods; -use crate::links::{follow_hyperlink, LinkRelations}; +use crate::links::{LinkRelations, follow_hyperlink}; use crate::script_runtime::CanGc; #[dom_struct] diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 3ed687ff133..010d941a446 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -9,7 +9,7 @@ use std::{f32, str}; use cssparser::match_ignore_ascii_case; use dom_struct::dom_struct; use euclid::default::Point2D; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use servo_atoms::Atom; use servo_url::ServoUrl; @@ -24,14 +24,14 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::document::Document; use crate::dom::domtokenlist::DOMTokenList; -use crate::dom::element::{reflect_referrer_policy_attribute, AttributeMutation, Element}; +use crate::dom::element::{AttributeMutation, Element, reflect_referrer_policy_attribute}; use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlhyperlinkelementutils::{HyperlinkElement, HyperlinkElementTraits}; use crate::dom::node::{BindContext, Node}; use crate::dom::virtualmethods::VirtualMethods; -use crate::links::{follow_hyperlink, LinkRelations}; +use crate::links::{LinkRelations, follow_hyperlink}; use crate::script_runtime::CanGc; #[derive(Debug, PartialEq)] diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index 6377d5519ea..dbf0a88eb2a 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName}; +use html5ever::{LocalName, Prefix, QualName, local_name, namespace_url, ns}; use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::ElementBinding::Element_Binding::ElementMethods; diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 55403787154..abe45ee7110 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use servo_url::ServoUrl; diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index b531e27f0a1..8ff01d220f2 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -4,7 +4,7 @@ use dom_struct::dom_struct; use embedder_traits::{EmbedderMsg, LoadStatus}; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use servo_url::ServoUrl; use style::attr::AttrValue; diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 2abcf49d2e8..5c7637305a3 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -6,7 +6,7 @@ use std::cell::Cell; use std::default::Default; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url}; use js::rust::HandleObject; use style_dom::ElementState; @@ -28,7 +28,7 @@ use crate::dom::htmlformelement::{ }; use crate::dom::node::{BindContext, Node, NodeTraits, UnbindContext}; use crate::dom::nodelist::NodeList; -use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable}; +use crate::dom::validation::{Validatable, is_barred_by_datalist_ancestor}; use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use crate::script_runtime::CanGc; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index d68d28a877b..04324e5fd3d 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -10,7 +10,7 @@ use canvas_traits::canvas::CanvasId; use canvas_traits::webgl::{GLContextAttributes, WebGLVersion}; use dom_struct::dom_struct; use euclid::default::Size2D; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use image::codecs::jpeg::JpegEncoder; use image::codecs::png::PngEncoder; use image::codecs::webp::WebPEncoder; @@ -21,17 +21,17 @@ use ipc_channel::ipc::{self as ipcchan}; use js::error::throw_type_error; use js::rust::{HandleObject, HandleValue}; use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource}; -use script_traits::serializable::BlobImpl; #[cfg(feature = "webgpu")] use script_traits::ScriptMsg; -use servo_media::streams::registry::MediaStreamId; +use script_traits::serializable::BlobImpl; use servo_media::streams::MediaStreamType; +use servo_media::streams::registry::MediaStreamId; use style::attr::AttrValue; use crate::canvas_context::CanvasContext as _; pub(crate) use crate::canvas_context::*; use crate::dom::attr::Attr; -use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref}; +use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{ BlobCallback, HTMLCanvasElementMethods, RenderingContext, }; diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index dbceec38293..857ba572625 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -6,13 +6,13 @@ use std::cell::Cell; use std::cmp::Ordering; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, QualName}; +use html5ever::{LocalName, QualName, local_name, namespace_url, ns}; use servo_atoms::Atom; use style::str::split_html_space_chars; use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::JSTraceable; diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index 04451cf2ae2..b6bcaf8a5bc 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -5,7 +5,7 @@ use std::cell::{Cell, Ref}; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use crate::dom::attr::Attr; diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index 3839fe77575..949dfef0a53 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use crate::dom::bindings::cell::DomRefCell; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 33e83a5db04..6bf01535a10 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -7,7 +7,7 @@ use std::default::Default; use std::rc::Rc; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use script_layout_interface::QueryMsg; use style::attr::AttrValue; diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 23898d4036c..f4ff9bd2d49 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -5,7 +5,7 @@ use std::default::Default; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style_dom::ElementState; diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index e7af77812fc..335d04b7fae 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -4,12 +4,12 @@ use cssparser::match_ignore_ascii_case; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use servo_atoms::Atom; use style::attr::AttrValue; use style::color::AbsoluteColor; -use style::str::{read_numbers, HTML_SPACE_CHARACTERS}; +use style::str::{HTML_SPACE_CHARACTERS, read_numbers}; use style::values::computed::font::{ FamilyName, FontFamilyNameSyntax, GenericFontFamily, SingleFontFamily, }; diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index 5da814ab20f..ab922c0958c 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding:: use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, NodeMethods}; use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 3a7a56ffaf4..75b4830dddd 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -8,7 +8,7 @@ use std::cell::Cell; use dom_struct::dom_struct; use encoding_rs::{Encoding, UTF_8}; use headers::{ContentType, HeaderMapExt}; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use http::Method; use js::rust::HandleObject; use mime::{self, Mime}; @@ -78,7 +78,7 @@ use crate::dom::radionodelist::RadioNodeList; use crate::dom::submitevent::SubmitEvent; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; -use crate::links::{get_element_target, LinkRelations}; +use crate::links::{LinkRelations, get_element_target}; use crate::script_runtime::CanGc; use crate::script_thread::ScriptThread; @@ -402,10 +402,9 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement { } }, _ => { - debug_assert!(!elem - .downcast::<HTMLElement>() - .unwrap() - .is_listed_element()); + debug_assert!( + !elem.downcast::<HTMLElement>().unwrap().is_listed_element() + ); return false; }, }, @@ -593,7 +592,7 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement { let entry = SourcedName { name: key.clone(), element: DomRoot::from_ref(&*val.0), - source: SourcedNameSource::Past(self.current_name_generation.get() - val.1 .0), + source: SourcedNameSource::Past(self.current_name_generation.get() - val.1.0), }; sourced_names_vec.push(entry); } diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index 686007dc53d..bfd092c894f 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -4,13 +4,13 @@ use content_security_policy::{CspList, PolicyDisposition, PolicySource}; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; -use crate::dom::document::{determine_policy_for_token, Document}; +use crate::dom::document::{Document, determine_policy_for_token}; use crate::dom::element::Element; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlmetaelement::HTMLMetaElement; diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 2707c4ebabf..5754b2f3dd3 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::color::AbsoluteColor; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 3f072fda5a9..6f45814d031 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -7,7 +7,7 @@ use std::cell::Cell; use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use bitflags::bitflags; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use net_traits::ReferrerPolicy; use profile_traits::ipc as ProfiledIpc; @@ -29,10 +29,10 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomGlobal; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; -use crate::dom::document::{determine_policy_for_token, Document}; +use crate::dom::document::{Document, determine_policy_for_token}; use crate::dom::domtokenlist::DOMTokenList; use crate::dom::element::{ - reflect_referrer_policy_attribute, AttributeMutation, Element, LayoutElementHelpers, + AttributeMutation, Element, LayoutElementHelpers, reflect_referrer_policy_attribute, }; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 4fb518887d7..382b3e439cd 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -9,11 +9,11 @@ use std::rc::Rc; use std::sync::Arc; use std::{char, mem}; -use app_units::{Au, AU_PER_PX}; +use app_units::{AU_PER_PX, Au}; use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use euclid::Point2D; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName}; +use html5ever::{LocalName, Prefix, QualName, local_name, namespace_url, ns}; use js::jsapi::JSAutoRealm; use js::rust::HandleObject; use mime::{self, Mime}; @@ -29,16 +29,16 @@ use net_traits::{ }; use num_traits::ToPrimitive; use pixels::{CorsStatus, Image, ImageMetadata}; -use servo_url::origin::MutableOrigin; use servo_url::ServoUrl; -use style::attr::{parse_integer, parse_length, AttrValue, LengthOrPercentageOrAuto}; +use servo_url::origin::MutableOrigin; +use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_integer, parse_length}; use style::context::QuirksMode; use style::media_queries::MediaList; use style::parser::ParserContext; use style::stylesheets::{CssRuleType, Origin, UrlExtraData}; +use style::values::specified::AbsoluteLength; use style::values::specified::length::{Length, NoCalcLength}; use style::values::specified::source_size_list::SourceSizeList; -use style::values::specified::AbsoluteLength; use style_traits::ParsingMode; use url::Url; @@ -60,11 +60,11 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomGlobal; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; -use crate::dom::document::{determine_policy_for_token, Document}; +use crate::dom::document::{Document, determine_policy_for_token}; use crate::dom::element::{ + AttributeMutation, CustomElementCreationMode, Element, ElementCreator, LayoutElementHelpers, cors_setting_for_element, referrer_policy_for_element, reflect_cross_origin_attribute, - reflect_referrer_policy_attribute, set_cross_origin_attribute, AttributeMutation, - CustomElementCreationMode, Element, ElementCreator, LayoutElementHelpers, + reflect_referrer_policy_attribute, set_cross_origin_attribute, }; use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index eedd9134966..66fef852ffd 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -14,9 +14,9 @@ use std::{f64, ptr}; use dom_struct::dom_struct; use embedder_traits::{FilterPattern, InputMethodType}; use encoding_rs::Encoding; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::jsapi::{ - ClippedTime, DateGetMsecSinceEpoch, Handle, JSObject, JS_ClearPendingException, NewDateObject, + ClippedTime, DateGetMsecSinceEpoch, Handle, JS_ClearPendingException, JSObject, NewDateObject, NewUCRegExpObject, ObjectIsDate, RegExpFlag_Unicode, RegExpFlags, }; use js::jsval::UndefinedValue; @@ -31,7 +31,7 @@ use style::attr::AttrValue; use style::str::{split_commas, str_join}; use style_dom::ElementState; use time::{Month, OffsetDateTime, Time}; -use unicode_bidi::{bidi_class, BidiClass}; +use unicode_bidi::{BidiClass, bidi_class}; use url::Url; use super::bindings::str::{FromInputValueString, ToInputValueString}; @@ -73,7 +73,7 @@ use crate::dom::node::{ }; use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; -use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable}; +use crate::dom::validation::{Validatable, is_barred_by_datalist_ancestor}; use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use crate::realms::enter_realm; @@ -83,8 +83,8 @@ use crate::textinput::KeyReaction::{ }; use crate::textinput::Lines::Single; use crate::textinput::{ - handle_text_clipboard_action, Direction, SelectionDirection, TextInput, UTF16CodeUnits, - UTF8Bytes, + Direction, SelectionDirection, TextInput, UTF8Bytes, UTF16CodeUnits, + handle_text_clipboard_action, }; const DEFAULT_SUBMIT_VALUE: &str = "Submit"; @@ -1832,13 +1832,9 @@ impl HTMLInputElement { // https://html.spec.whatwg.org/multipage/#radio-button-group fn radio_group_name(&self) -> Option<Atom> { - self.upcast::<Element>().get_name().and_then(|name| { - if name == atom!("") { - None - } else { - Some(name) - } - }) + self.upcast::<Element>() + .get_name() + .and_then(|name| if name == atom!("") { None } else { Some(name) }) } fn update_checked_state(&self, checked: bool, dirty: bool) { diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index 378bf1a6ed9..e9865ea274d 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::AttrValue; diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs index 22a0e50eaca..d72ffb4fa1d 100644 --- a/components/script/dom/htmllielement.rs +++ b/components/script/dom/htmllielement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style::attr::AttrValue; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 62e77d0088c..a321cd25fc9 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -10,7 +10,7 @@ use base::id::WebViewId; use cssparser::{Parser as CssParser, ParserInput}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use net_traits::policy_container::PolicyContainer; use net_traits::request::{ @@ -44,9 +44,9 @@ use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::document::Document; use crate::dom::domtokenlist::DOMTokenList; use crate::dom::element::{ - cors_setting_for_element, referrer_policy_for_element, reflect_cross_origin_attribute, - reflect_referrer_policy_attribute, set_cross_origin_attribute, AttributeMutation, Element, - ElementCreator, + AttributeMutation, Element, ElementCreator, cors_setting_for_element, + referrer_policy_for_element, reflect_cross_origin_attribute, reflect_referrer_policy_attribute, + set_cross_origin_attribute, }; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{BindContext, Node, NodeTraits, UnbindContext}; @@ -55,7 +55,7 @@ use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; use crate::fetch::create_a_potential_cors_request; use crate::links::LinkRelations; -use crate::network_listener::{submit_timing, PreInvoke, ResourceTimingListener}; +use crate::network_listener::{PreInvoke, ResourceTimingListener, submit_timing}; use crate::script_runtime::CanGc; use crate::stylesheet_loader::{StylesheetContextSource, StylesheetLoader, StylesheetOwner}; diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 863e2a0da2e..f9520ab1fdc 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -14,10 +14,10 @@ use embedder_traits::resources::{self, Resource as EmbedderResource}; use embedder_traits::{MediaPositionState, MediaSessionEvent, MediaSessionPlaybackState}; use euclid::default::Size2D; use headers::{ContentLength, ContentRange, HeaderMapExt}; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; -use http::header::{self, HeaderMap, HeaderValue}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use http::StatusCode; -use ipc_channel::ipc::{self, channel, IpcSharedMemory}; +use http::header::{self, HeaderMap, HeaderValue}; +use ipc_channel::ipc::{self, IpcSharedMemory, channel}; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoRealm; use media::{GLPlayerMsg, GLPlayerMsgForward, WindowGLContext}; @@ -76,8 +76,8 @@ use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::Blob; use crate::dom::document::Document; use crate::dom::element::{ - cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute, - AttributeMutation, Element, ElementCreator, + AttributeMutation, Element, ElementCreator, cors_setting_for_element, + reflect_cross_origin_attribute, set_cross_origin_attribute, }; use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; @@ -102,10 +102,10 @@ use crate::dom::url::URL; use crate::dom::videotrack::VideoTrack; use crate::dom::videotracklist::VideoTrackList; use crate::dom::virtualmethods::VirtualMethods; -use crate::fetch::{create_a_potential_cors_request, FetchCanceller}; +use crate::fetch::{FetchCanceller, create_a_potential_cors_request}; use crate::microtask::{Microtask, MicrotaskRunnable}; use crate::network_listener::{self, PreInvoke, ResourceTimingListener}; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; use crate::script_thread::ScriptThread; diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index 31c21f35536..beab46e58d7 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -6,7 +6,7 @@ use std::cell::Ref; use std::ops::{Add, Div}; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style_dom::ElementState; diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 38aae77173d..e50669a3ad9 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -5,7 +5,7 @@ use std::default::Default; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use pixels::Image; use servo_arc::Arc; diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index e3f2f3f1996..aa9c8ce6497 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style_dom::ElementState; diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index b42a51d7ca1..e1b02c6cfa2 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -6,7 +6,7 @@ use std::cell::Cell; use std::convert::TryInto; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName}; +use html5ever::{LocalName, Prefix, QualName, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::str::{split_html_space_chars, str_join}; use style_dom::ElementState; diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index 7d768fcf22b..f26de72ba9c 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use crate::dom::attr::Attr; diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs index 17575c2c4c0..45a4690045e 100644 --- a/components/script/dom/htmlpreelement.rs +++ b/components/script/dom/htmlpreelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style::attr::AttrValue; diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index 9e118aa7b74..07e13f907f6 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -5,7 +5,7 @@ use std::cell::Ref; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use crate::dom::attr::Attr; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 1cfd93b356e..66bcf2d91e0 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -15,10 +15,10 @@ use base::id::{PipelineId, WebViewId}; use content_security_policy as csp; use dom_struct::dom_struct; use encoding_rs::Encoding; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use ipc_channel::ipc; use js::jsval::UndefinedValue; -use js::rust::{transform_str_to_source_text, CompileOptionsWrapper, HandleObject, Stencil}; +use js::rust::{CompileOptionsWrapper, HandleObject, Stencil, transform_str_to_source_text}; use net_traits::http_status::HttpStatus; use net_traits::request::{ CorsSettings, CredentialsMode, Destination, InsecureRequestsPolicy, ParserMetadata, @@ -31,9 +31,10 @@ use net_traits::{ use servo_atoms::Atom; use servo_config::pref; use servo_url::{ImmutableOrigin, ServoUrl}; -use style::str::{StaticStringVec, HTML_SPACE_CHARACTERS}; +use style::str::{HTML_SPACE_CHARACTERS, StaticStringVec}; use uuid::Uuid; +use crate::HasParent; use crate::document_loader::LoadType; use crate::dom::activation::Activatable; use crate::dom::attr::Attr; @@ -49,9 +50,9 @@ use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::trace::NoTrace; use crate::dom::document::Document; use crate::dom::element::{ - cors_setting_for_element, referrer_policy_for_element, reflect_cross_origin_attribute, - reflect_referrer_policy_attribute, set_cross_origin_attribute, AttributeMutation, Element, - ElementCreator, + AttributeMutation, Element, ElementCreator, cors_setting_for_element, + referrer_policy_for_element, reflect_cross_origin_attribute, reflect_referrer_policy_attribute, + set_cross_origin_attribute, }; use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus}; use crate::dom::globalscope::GlobalScope; @@ -63,12 +64,11 @@ use crate::fetch::create_a_potential_cors_request; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use crate::realms::enter_realm; use crate::script_module::{ - fetch_external_module_script, fetch_inline_module_script, ModuleOwner, ScriptFetchOptions, + ModuleOwner, ScriptFetchOptions, fetch_external_module_script, fetch_inline_module_script, }; use crate::script_runtime::CanGc; use crate::task_source::{SendableTaskSource, TaskSourceName}; -use crate::unminify::{unminify_js, ScriptSource}; -use crate::HasParent; +use crate::unminify::{ScriptSource, unminify_js}; impl ScriptSource for ScriptOrigin { fn unminified_dir(&self) -> Option<String> { diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 679ba816683..4fe55593d11 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -6,7 +6,7 @@ use std::default::Default; use std::iter; use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use style::attr::AttrValue; use style_dom::ElementState; @@ -36,7 +36,7 @@ use crate::dom::htmloptionelement::HTMLOptionElement; use crate::dom::htmloptionscollection::HTMLOptionsCollection; use crate::dom::node::{BindContext, Node, NodeTraits, UnbindContext}; use crate::dom::nodelist::NodeList; -use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable}; +use crate::dom::validation::{Validatable, is_barred_by_datalist_ancestor}; use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use crate::script_runtime::CanGc; @@ -208,11 +208,7 @@ impl HTMLSelectElement { // https://html.spec.whatwg.org/multipage/#concept-select-size fn display_size(&self) -> u32 { if self.Size() == 0 { - if self.Multiple() { - 4 - } else { - 1 - } + if self.Multiple() { 4 } else { 1 } } else { self.Size() } diff --git a/components/script/dom/htmlslotelement.rs b/components/script/dom/htmlslotelement.rs index 686705f9d4b..2685179af08 100644 --- a/components/script/dom/htmlslotelement.rs +++ b/components/script/dom/htmlslotelement.rs @@ -5,10 +5,11 @@ use std::cell::{Cell, Ref, RefCell}; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::gc::RootedVec; use js::rust::HandleObject; +use crate::ScriptThread; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLSlotElementBinding::{ AssignedNodesOptions, HTMLSlotElementMethods, @@ -31,7 +32,6 @@ use crate::dom::mutationobserver::MutationObserver; use crate::dom::node::{Node, NodeDamage, ShadowIncluding}; use crate::dom::virtualmethods::VirtualMethods; use crate::script_runtime::CanGc; -use crate::ScriptThread; /// <https://html.spec.whatwg.org/multipage/#the-slot-element> #[dom_struct] diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index 34949fa38ce..147a0a696a7 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use crate::dom::attr::Attr; diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index dc32f57e87a..623dfdea54b 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::color::AbsoluteColor; diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs index 047b164cd34..b2821fd38e2 100644 --- a/components/script/dom/htmltablecolelement.rs +++ b/components/script/dom/htmltablecolelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index d47e43ea42a..b0e6adeb8d3 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -5,9 +5,9 @@ use std::cell::Cell; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; -use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto}; +use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_unsigned_integer}; use style::color::AbsoluteColor; use crate::dom::attr::Attr; diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 4ad32a38947..326c8867df0 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::color::AbsoluteColor; diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index ed3b5fc04a5..4c17e86fa75 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::color::AbsoluteColor; diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index fb2d8877311..d35771b803b 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -7,7 +7,7 @@ use std::default::Default; use std::ops::Range; use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style::attr::AttrValue; use style_dom::ElementState; @@ -38,13 +38,13 @@ use crate::dom::node::{ }; use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; -use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable}; +use crate::dom::validation::{Validatable, is_barred_by_datalist_ancestor}; use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use crate::script_runtime::CanGc; use crate::textinput::{ - handle_text_clipboard_action, Direction, KeyReaction, Lines, SelectionDirection, TextInput, - UTF16CodeUnits, UTF8Bytes, + Direction, KeyReaction, Lines, SelectionDirection, TextInput, UTF8Bytes, UTF16CodeUnits, + handle_text_clipboard_action, }; #[dom_struct] diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index 132c3b2ee24..2341e90736b 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::HTMLTrackElementBinding::{ diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index 90de3eae134..21a2a11888b 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use dom_struct::dom_struct; use euclid::default::Size2D; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use ipc_channel::ipc; use js::rust::HandleObject; use net_traits::image_cache::{ diff --git a/components/script/dom/imagebitmap.rs b/components/script/dom/imagebitmap.rs index da1e30c2e7e..ef6538e7451 100644 --- a/components/script/dom/imagebitmap.rs +++ b/components/script/dom/imagebitmap.rs @@ -10,7 +10,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ImageBitmapBinding::ImageBitmapMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 03224afd303..a7ee406e222 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -14,11 +14,11 @@ use js::rust::HandleObject; use js::typedarray::{ClampedU8, CreateWith, Uint8ClampedArray}; use super::bindings::buffer_source::{ - new_initialized_heap_buffer_source, BufferSource, HeapBufferSource, HeapTypedArrayInit, + BufferSource, HeapBufferSource, HeapTypedArrayInit, new_initialized_heap_buffer_source, }; use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::ImageDataMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::{CanGc, JSContext}; @@ -78,7 +78,7 @@ impl ImageData { Err(_) => { return Err(Error::Type( "Argument to Image data is not an Uint8ClampedArray".to_owned(), - )) + )); }, }; diff --git a/components/script/dom/intersectionobserver.rs b/components/script/dom/intersectionobserver.rs index 73a9b2bed27..cc9cba87cc4 100644 --- a/components/script/dom/intersectionobserver.rs +++ b/components/script/dom/intersectionobserver.rs @@ -26,7 +26,7 @@ use crate::dom::bindings::codegen::UnionTypes::{DoubleOrDoubleSequence, ElementO use crate::dom::bindings::error::Error; use crate::dom::bindings::import::module::Fallible; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::utils::to_frozen_array; diff --git a/components/script/dom/intersectionobserverentry.rs b/components/script/dom/intersectionobserverentry.rs index 26b18b635c5..759b950cb50 100644 --- a/components/script/dom/intersectionobserverentry.rs +++ b/components/script/dom/intersectionobserverentry.rs @@ -9,7 +9,7 @@ use super::bindings::codegen::Bindings::IntersectionObserverEntryBinding::{ IntersectionObserverEntryInit, IntersectionObserverEntryMethods, }; use super::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::domrectreadonly::DOMRectReadOnly; use crate::dom::element::Element; diff --git a/components/script/dom/intersectionobserverrootmargin.rs b/components/script/dom/intersectionobserverrootmargin.rs index edde6c0e363..4f5decdcfd6 100644 --- a/components/script/dom/intersectionobserverrootmargin.rs +++ b/components/script/dom/intersectionobserverrootmargin.rs @@ -7,7 +7,7 @@ use std::fmt; -use cssparser::{match_ignore_ascii_case, Parser, Token}; +use cssparser::{Parser, Token, match_ignore_ascii_case}; use style::parser::{Parse, ParserContext}; use style::values::computed::{self, Length, LengthPercentage}; use style::values::generics::rect::Rect; diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 165522028e3..3241717fdf8 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -10,7 +10,7 @@ use servo_url::{MutableOrigin, ServoUrl}; use crate::dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::document::Document; diff --git a/components/script/dom/mediadeviceinfo.rs b/components/script/dom/mediadeviceinfo.rs index 5ea7ca0a32c..c426fac270a 100644 --- a/components/script/dom/mediadeviceinfo.rs +++ b/components/script/dom/mediadeviceinfo.rs @@ -9,7 +9,7 @@ use crate::conversions::Convert; use crate::dom::bindings::codegen::Bindings::MediaDeviceInfoBinding::{ MediaDeviceInfoMethods, MediaDeviceKind, }; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs index 282bcc13be8..2ae2ebaca10 100644 --- a/components/script/dom/mediadevices.rs +++ b/components/script/dom/mediadevices.rs @@ -5,9 +5,9 @@ use std::rc::Rc; use dom_struct::dom_struct; -use servo_media::streams::capture::{Constrain, ConstrainRange, MediaTrackConstraintSet}; -use servo_media::streams::MediaStreamType; use servo_media::ServoMedia; +use servo_media::streams::MediaStreamType; +use servo_media::streams::capture::{Constrain, ConstrainRange, MediaTrackConstraintSet}; use crate::conversions::Convert; use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::{ @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::UnionTypes::{ BooleanOrMediaTrackConstraints, ClampedUnsignedLongOrConstrainULongRange as ConstrainULong, DoubleOrConstrainDoubleRange as ConstrainDouble, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/mediaerror.rs b/components/script/dom/mediaerror.rs index 2cc8dbff353..905c1b22c29 100644 --- a/components/script/dom/mediaerror.rs +++ b/components/script/dom/mediaerror.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/mediafragmentparser.rs b/components/script/dom/mediafragmentparser.rs index 342ee894a0a..0cd757de12c 100644 --- a/components/script/dom/mediafragmentparser.rs +++ b/components/script/dom/mediafragmentparser.rs @@ -8,7 +8,7 @@ use std::str::FromStr; use chrono::NaiveDateTime; use servo_url::ServoUrl; -use url::{form_urlencoded, Position, Url}; +use url::{Position, Url, form_urlencoded}; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub(crate) enum SpatialRegion { diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index f630a985923..45e1fce3a66 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -13,7 +13,7 @@ use style_traits::{ParsingMode, ToCss}; use crate::dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/mediametadata.rs b/components/script/dom/mediametadata.rs index 17ce05e8ee5..be8a78506a2 100644 --- a/components/script/dom/mediametadata.rs +++ b/components/script/dom/mediametadata.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::{ MediaMetadataInit, MediaMetadataMethods, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::mediasession::MediaSession; diff --git a/components/script/dom/mediasession.rs b/components/script/dom/mediasession.rs index bc235d52243..1db8c4dc25d 100644 --- a/components/script/dom/mediasession.rs +++ b/components/script/dom/mediasession.rs @@ -24,13 +24,13 @@ use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::{ }; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::htmlmediaelement::HTMLMediaElement; use crate::dom::mediametadata::MediaMetadata; use crate::dom::window::Window; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; #[dom_struct] diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs index 006f4b86634..2bd43b1e2c0 100644 --- a/components/script/dom/mediastream.rs +++ b/components/script/dom/mediastream.rs @@ -4,13 +4,13 @@ use dom_struct::dom_struct; use js::rust::HandleObject; -use servo_media::streams::registry::MediaStreamId; use servo_media::streams::MediaStreamType; +use servo_media::streams::registry::MediaStreamId; use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::MediaStreamBinding::MediaStreamMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/mediastreamaudiodestinationnode.rs b/components/script/dom/mediastreamaudiodestinationnode.rs index 547044056b8..773db19ee86 100644 --- a/components/script/dom/mediastreamaudiodestinationnode.rs +++ b/components/script/dom/mediastreamaudiodestinationnode.rs @@ -4,9 +4,9 @@ use dom_struct::dom_struct; use js::rust::HandleObject; +use servo_media::ServoMedia; use servo_media::audio::node::AudioNodeInit; use servo_media::streams::MediaStreamType; -use servo_media::ServoMedia; use crate::dom::audiocontext::AudioContext; use crate::dom::audionode::AudioNode; @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ use crate::dom::bindings::codegen::Bindings::MediaStreamAudioDestinationNodeBinding::MediaStreamAudioDestinationNodeMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::mediastream::MediaStream; use crate::dom::window::Window; diff --git a/components/script/dom/mediastreamtrack.rs b/components/script/dom/mediastreamtrack.rs index 98248ddb1c8..af8f6780c07 100644 --- a/components/script/dom/mediastreamtrack.rs +++ b/components/script/dom/mediastreamtrack.rs @@ -3,11 +3,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use servo_media::streams::registry::MediaStreamId; use servo_media::streams::MediaStreamType; +use servo_media::streams::registry::MediaStreamId; use crate::dom::bindings::codegen::Bindings::MediaStreamTrackBinding::MediaStreamTrackMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/messagechannel.rs b/components/script/dom/messagechannel.rs index a74e0be6bb3..55e1fc56136 100644 --- a/components/script/dom/messagechannel.rs +++ b/components/script/dom/messagechannel.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::MessageChannelBinding::MessageChannelMethods; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::messageport::MessagePort; diff --git a/components/script/dom/messageport.rs b/components/script/dom/messageport.rs index 6fbd787e173..e8a3b3ac695 100644 --- a/components/script/dom/messageport.rs +++ b/components/script/dom/messageport.rs @@ -21,7 +21,7 @@ use crate::dom::bindings::codegen::Bindings::MessagePortBinding::{ use crate::dom::bindings::conversions::root_from_object; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, DomObject}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::structuredclone::{self, StructuredDataReader, StructuredDataWriter}; use crate::dom::bindings::trace::RootedTraceableBox; @@ -236,7 +236,9 @@ impl Transferable for MessagePort { } (ports_len, port_impl) } else { - panic!("A messageport was transfer-received, yet the SC holder does not have any port impls"); + panic!( + "A messageport was transfer-received, yet the SC holder does not have any port impls" + ); }; let transferred_port = diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs index 86fc5aacbef..109b592d13e 100644 --- a/components/script/dom/mimetypearray.rs +++ b/components/script/dom/mimetypearray.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::MimeTypeArrayBinding::MimeTypeArrayMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index da5a7088ac7..2e769972ab2 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethod use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 749a72eefb0..2df554c80ff 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -6,7 +6,7 @@ use std::cell::LazyCell; use std::rc::Rc; use dom_struct::dom_struct; -use html5ever::{namespace_url, ns, LocalName, Namespace}; +use html5ever::{LocalName, Namespace, namespace_url, ns}; use js::rust::HandleObject; use crate::dom::bindings::callback::ExceptionHandling; @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::{ }; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index 7d7326b4547..c01ae6ef86e 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use html5ever::{LocalName, Namespace}; use crate::dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecord_Binding::MutationRecordMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::node::{Node, NodeTraits}; diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index e9a9d70d860..354f598226f 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -9,7 +9,7 @@ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::xmlname::namespace_from_domstring; diff --git a/components/script/dom/navigationpreloadmanager.rs b/components/script/dom/navigationpreloadmanager.rs index c6cc45b3742..4859b775b13 100644 --- a/components/script/dom/navigationpreloadmanager.rs +++ b/components/script/dom/navigationpreloadmanager.rs @@ -10,7 +10,7 @@ use js::jsval::UndefinedValue; use crate::dom::bindings::codegen::Bindings::NavigationPreloadManagerBinding::{ NavigationPreloadManagerMethods, NavigationPreloadState, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::ByteString; use crate::dom::domexception::{DOMErrorName, DOMException}; diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 79a7167ee97..f32edc364ee 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -12,7 +12,7 @@ use js::rust::MutableHandleValue; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::utils::to_frozen_array; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 966662ba1d6..4653139ed12 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -18,7 +18,7 @@ use bitflags::bitflags; use devtools_traits::NodeInfo; use dom_struct::dom_struct; use euclid::default::{Rect, Size2D, Vector2D}; -use html5ever::{namespace_url, ns, serialize as html_serialize, Namespace, Prefix, QualName}; +use html5ever::{Namespace, Prefix, QualName, namespace_url, ns, serialize as html_serialize}; use js::jsapi::JSObject; use js::rust::HandleObject; use libc::{self, c_void, uintptr_t}; @@ -30,8 +30,8 @@ use script_layout_interface::{ }; use script_traits::{DocumentActivity, UntrustedNodeAddress}; use selectors::matching::{ - matches_selector_list, MatchingContext, MatchingForInvalidation, MatchingMode, - NeedsSelectorFlags, + MatchingContext, MatchingForInvalidation, MatchingMode, NeedsSelectorFlags, + matches_selector_list, }; use selectors::parser::SelectorList; use servo_arc::Arc; @@ -75,13 +75,13 @@ use crate::dom::bindings::inheritance::{ SVGElementTypeId, SVGGraphicsElementTypeId, TextTypeId, }; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, DomObjectWrap}; +use crate::dom::bindings::reflector::{DomObject, DomObjectWrap, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, DomSlice, LayoutDom, MutNullableDom, ToLayout}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::xmlname::namespace_from_domstring; use crate::dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; use crate::dom::cssstylesheet::CSSStyleSheet; -use crate::dom::customelementregistry::{try_upgrade_element, CallbackReaction}; +use crate::dom::customelementregistry::{CallbackReaction, try_upgrade_element}; use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use crate::dom::documentfragment::DocumentFragment; use crate::dom::documenttype::DocumentType; @@ -110,7 +110,7 @@ use crate::dom::shadowroot::{IsUserAgentWidget, LayoutShadowRootHelpers, ShadowR use crate::dom::stylesheetlist::StyleSheetListOwner; use crate::dom::svgsvgelement::{LayoutSVGSVGElementHelpers, SVGSVGElement}; use crate::dom::text::Text; -use crate::dom::virtualmethods::{vtable_for, VirtualMethods}; +use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; use crate::dom::window::Window; use crate::script_runtime::CanGc; use crate::script_thread::ScriptThread; @@ -2408,9 +2408,10 @@ impl Node { /// <https://dom.spec.whatwg.org/#concept-node-remove> fn remove(node: &Node, parent: &Node, suppress_observers: SuppressObserver) { parent.owner_doc().add_script_and_layout_blocker(); - assert!(node - .GetParentNode() - .is_some_and(|node_parent| &*node_parent == parent)); + assert!( + node.GetParentNode() + .is_some_and(|node_parent| &*node_parent == parent) + ); let cached_index = { if parent.ranges_is_empty() { None diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 05b59360b3a..175a3a89467 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::{NodeFilter, NodeFilterConstants}; use crate::dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutDom}; use crate::dom::document::Document; use crate::dom::node::Node; diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 8ec930e42ce..743e372e907 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -9,7 +9,7 @@ use servo_atoms::Atom; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; diff --git a/components/script/dom/notification.rs b/components/script/dom/notification.rs index 937c7b8706e..471c5a82e84 100644 --- a/components/script/dom/notification.rs +++ b/components/script/dom/notification.rs @@ -34,7 +34,7 @@ use crate::dom::bindings::trace::RootedTraceableBox; use crate::dom::bindings::utils::to_frozen_array; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; -use crate::dom::permissions::{descriptor_permission_state, PermissionAlgorithm, Permissions}; +use crate::dom::permissions::{PermissionAlgorithm, Permissions, descriptor_permission_state}; use crate::dom::promise::Promise; use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope; use crate::dom::serviceworkerregistration::ServiceWorkerRegistration; diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index 349fc9665c5..344f523f8fc 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -4,7 +4,7 @@ use std::cell::Cell; use std::rc::Rc; -use std::sync::{mpsc, Arc, Mutex}; +use std::sync::{Arc, Mutex, mpsc}; use std::thread::Builder; use base::id::PipelineId; @@ -24,7 +24,7 @@ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::offlineaudiocompletionevent::OfflineAudioCompletionEvent; diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs index 4a44efaffac..0587fbad12b 100644 --- a/components/script/dom/offscreencanvas.rs +++ b/components/script/dom/offscreencanvas.rs @@ -9,12 +9,12 @@ use euclid::default::Size2D; use ipc_channel::ipc::IpcSharedMemory; use js::rust::{HandleObject, HandleValue}; -use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref}; +use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; use crate::dom::bindings::codegen::Bindings::OffscreenCanvasBinding::{ OffscreenCanvasMethods, OffscreenRenderingContext, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs index 3fb783b40b2..58a6f8dd2a3 100644 --- a/components/script/dom/paintsize.rs +++ b/components/script/dom/paintsize.rs @@ -8,7 +8,7 @@ use style_traits::CSSPixel; use crate::dom::bindings::codegen::Bindings::PaintSizeBinding::PaintSizeMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index 3aa3869eb41..cdbcc2658bc 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -11,12 +11,12 @@ use std::thread; use std::time::Duration; use base::id::PipelineId; -use crossbeam_channel::{unbounded, Sender}; +use crossbeam_channel::{Sender, unbounded}; use dom_struct::dom_struct; use euclid::{Scale, Size2D}; use js::jsapi::{ - HandleValueArray, Heap, IsCallable, IsConstructor, JSAutoRealm, JSObject, - JS_ClearPendingException, JS_IsExceptionPending, NewArrayObject, Value, + HandleValueArray, Heap, IsCallable, IsConstructor, JS_ClearPendingException, + JS_IsExceptionPending, JSAutoRealm, JSObject, NewArrayObject, Value, }; use js::jsval::{JSVal, ObjectValue, UndefinedValue}; use js::rust::wrappers::{Call, Construct1}; diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index cd537642bb3..7d4021ea801 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -18,7 +18,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceBinding::{ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/performanceentry.rs b/components/script/dom/performanceentry.rs index a5b461b3103..13b7302d66a 100644 --- a/components/script/dom/performanceentry.rs +++ b/components/script/dom/performanceentry.rs @@ -9,7 +9,7 @@ use time::Duration; use super::performance::ToDOMHighResTimeStamp; use crate::dom::bindings::codegen::Bindings::PerformanceBinding::DOMHighResTimeStamp; use crate::dom::bindings::codegen::Bindings::PerformanceEntryBinding::PerformanceEntryMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/performancenavigation.rs b/components/script/dom/performancenavigation.rs index 291bb4f7345..86fbf754255 100644 --- a/components/script/dom/performancenavigation.rs +++ b/components/script/dom/performancenavigation.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceNavigationBinding::{ PerformanceNavigationConstants, PerformanceNavigationMethods, }; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index 86955792b50..379474d03e9 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::{ PerformanceObserverCallback, PerformanceObserverInit, PerformanceObserverMethods, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::console::Console; diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs index 6320c9037b5..af96183cdf3 100644 --- a/components/script/dom/performanceobserverentrylist.rs +++ b/components/script/dom/performanceobserverentrylist.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/performanceresourcetiming.rs b/components/script/dom/performanceresourcetiming.rs index c96a344086d..88bd36b77fc 100644 --- a/components/script/dom/performanceresourcetiming.rs +++ b/components/script/dom/performanceresourcetiming.rs @@ -10,7 +10,7 @@ use time::Duration; use crate::dom::bindings::codegen::Bindings::PerformanceBinding::DOMHighResTimeStamp; use crate::dom::bindings::codegen::Bindings::PerformanceResourceTimingBinding::PerformanceResourceTimingMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 886126c6e6d..0be136b8aff 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -21,7 +21,7 @@ use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{ use crate::dom::bindings::codegen::Bindings::PermissionsBinding::PermissionsMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; #[cfg(feature = "bluetooth")] use crate::dom::bluetooth::Bluetooth; diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs index 84a38a48c02..1d943961797 100644 --- a/components/script/dom/pluginarray.rs +++ b/components/script/dom/pluginarray.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index ab4726f9cc2..9cc83251592 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -17,9 +17,9 @@ use std::rc::Rc; use dom_struct::dom_struct; use js::conversions::ToJSValConvertible; use js::jsapi::{ - AddRawValueRoot, CallArgs, GetFunctionNativeReserved, Heap, JSAutoRealm, JSContext, JSObject, - JS_ClearPendingException, JS_GetFunctionObject, JS_NewFunction, NewFunctionWithReserved, - PromiseState, PromiseUserInputEventHandlingState, RemoveRawValueRoot, + AddRawValueRoot, CallArgs, GetFunctionNativeReserved, Heap, JS_ClearPendingException, + JS_GetFunctionObject, JS_NewFunction, JSAutoRealm, JSContext, JSObject, + NewFunctionWithReserved, PromiseState, PromiseUserInputEventHandlingState, RemoveRawValueRoot, SetFunctionNativeReserved, }; use js::jsval::{Int32Value, JSVal, ObjectValue, UndefinedValue}; @@ -36,7 +36,7 @@ use crate::dom::bindings::reflector::{DomGlobal, DomObject, MutDomObject, Reflec use crate::dom::bindings::settings_stack::AutoEntryScript; use crate::dom::globalscope::GlobalScope; use crate::dom::promisenativehandler::PromiseNativeHandler; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; use crate::script_thread::ScriptThread; diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs index 9a4a078a874..c8f35da6e03 100644 --- a/components/script/dom/promisenativehandler.rs +++ b/components/script/dom/promisenativehandler.rs @@ -7,7 +7,7 @@ use js::jsapi::JSContext; use js::rust::HandleValue; use malloc_size_of::MallocSizeOf; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::trace::JSTraceable; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index a4db9944dfd..e25e9f870ba 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -10,7 +10,7 @@ use js::jsapi::JSTracer; use js::rust::HandleObject; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -use crate::dom::abstractrange::{bp_position, AbstractRange, BoundaryPoint}; +use crate::dom::abstractrange::{AbstractRange, BoundaryPoint, bp_position}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AbstractRangeBinding::AbstractRangeMethods; use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; diff --git a/components/script/dom/readablestream.rs b/components/script/dom/readablestream.rs index dcb3a84d88d..07c94dbf591 100644 --- a/components/script/dom/readablestream.rs +++ b/components/script/dom/readablestream.rs @@ -361,7 +361,9 @@ impl ReadableStream { }, ReaderType::BYOB(ref reader) => { let Some(reader) = reader.get() else { - unreachable!("Attempt to add a read into request without having first acquired a reader."); + unreachable!( + "Attempt to add a read into request without having first acquired a reader." + ); }; // Assert: stream.[[state]] is "readable" or "closed". diff --git a/components/script/dom/readablestreambyobreader.rs b/components/script/dom/readablestreambyobreader.rs index 6ad308fcbae..8353ddd531b 100644 --- a/components/script/dom/readablestreambyobreader.rs +++ b/components/script/dom/readablestreambyobreader.rs @@ -23,7 +23,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ReadableStreamBYOBReaderBinding::ReadableStreamBYOBReaderMethods; use crate::dom::bindings::error::{Error, ErrorToJsval}; use crate::dom::bindings::import::module::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::trace::RootedTraceableBox; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/readablestreamdefaultcontroller.rs b/components/script/dom/readablestreamdefaultcontroller.rs index d1091f4fa98..da61d5e02ca 100644 --- a/components/script/dom/readablestreamdefaultcontroller.rs +++ b/components/script/dom/readablestreamdefaultcontroller.rs @@ -20,8 +20,8 @@ use crate::dom::bindings::buffer_source::create_buffer_source; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultControllerBinding::ReadableStreamDefaultControllerMethods; use crate::dom::bindings::codegen::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller; -use crate::dom::bindings::error::{throw_dom_exception, Error, ErrorToJsval, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible, throw_dom_exception}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::trace::RootedTraceableBox; use crate::dom::globalscope::GlobalScope; @@ -31,7 +31,7 @@ use crate::dom::readablestream::ReadableStream; use crate::dom::readablestreamdefaultreader::ReadRequest; use crate::dom::underlyingsourcecontainer::{UnderlyingSourceContainer, UnderlyingSourceType}; use crate::js::conversions::ToJSValConvertible; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext, JSContext as SafeJSContext}; /// The fulfillment handler for diff --git a/components/script/dom/readablestreamdefaultreader.rs b/components/script/dom/readablestreamdefaultreader.rs index 2be17b56426..7e374a1f11a 100644 --- a/components/script/dom/readablestreamdefaultreader.rs +++ b/components/script/dom/readablestreamdefaultreader.rs @@ -21,16 +21,16 @@ use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultReaderBinding: }; use crate::dom::bindings::error::{Error, ErrorToJsval}; use crate::dom::bindings::import::module::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::trace::RootedTraceableBox; use crate::dom::defaultteereadrequest::DefaultTeeReadRequest; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; -use crate::dom::readablestream::{get_read_promise_bytes, get_read_promise_done, ReadableStream}; +use crate::dom::readablestream::{ReadableStream, get_read_promise_bytes, get_read_promise_done}; use crate::dom::readablestreamgenericreader::ReadableStreamGenericReader; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; type ReadAllBytesSuccessSteps = dyn Fn(&[u8]); diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index c032229ad75..406b6b4222d 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -7,10 +7,11 @@ use std::str::FromStr; use cssparser::match_ignore_ascii_case; use dom_struct::dom_struct; +use http::Method as HttpMethod; use http::header::{HeaderName, HeaderValue}; use http::method::InvalidMethod; -use http::Method as HttpMethod; use js::rust::HandleObject; +use net_traits::ReferrerPolicy as MsgReferrerPolicy; use net_traits::fetch::headers::is_forbidden_method; use net_traits::request::{ CacheMode as NetTraitsRequestCache, CredentialsMode as NetTraitsRequestCredentials, @@ -18,10 +19,9 @@ use net_traits::request::{ Referrer as NetTraitsRequestReferrer, Request as NetTraitsRequest, RequestBuilder, RequestMode as NetTraitsRequestMode, Window, }; -use net_traits::ReferrerPolicy as MsgReferrerPolicy; use servo_url::ServoUrl; -use crate::body::{consume_body, BodyMixin, BodyType, Extractable}; +use crate::body::{BodyMixin, BodyType, Extractable, consume_body}; use crate::conversions::Convert; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; @@ -30,7 +30,7 @@ use crate::dom::bindings::codegen::Bindings::RequestBinding::{ RequestMethods, RequestMode, RequestRedirect, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{ByteString, DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/resizeobserver.rs b/components/script/dom/resizeobserver.rs index 02c90c9d727..55178f01b1d 100644 --- a/components/script/dom/resizeobserver.rs +++ b/components/script/dom/resizeobserver.rs @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::ResizeObserverBinding::{ }; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::domrectreadonly::DOMRectReadOnly; use crate::dom::element::Element; @@ -252,11 +252,7 @@ impl ResizeObservation { let box_size = calculate_box_size(target, &self.observed_box.borrow(), can_gc); let is_active = box_size.width().to_f64_px() != last_reported_size.inline_size() || box_size.height().to_f64_px() != last_reported_size.block_size(); - if is_active { - Some(box_size) - } else { - None - } + if is_active { Some(box_size) } else { None } } } diff --git a/components/script/dom/resizeobserverentry.rs b/components/script/dom/resizeobserverentry.rs index ec76a9d3617..12157b226ad 100644 --- a/components/script/dom/resizeobserverentry.rs +++ b/components/script/dom/resizeobserverentry.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use js::rust::MutableHandleValue; use crate::dom::bindings::codegen::Bindings::ResizeObserverEntryBinding::ResizeObserverEntryMethods; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::utils::to_frozen_array; use crate::dom::domrectreadonly::DOMRectReadOnly; diff --git a/components/script/dom/resizeobserversize.rs b/components/script/dom/resizeobserversize.rs index c89b43f215b..caa7d9bbf28 100644 --- a/components/script/dom/resizeobserversize.rs +++ b/components/script/dom/resizeobserversize.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::ResizeObserverSizeBinding::ResizeObserverSizeMethods; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index abe6fe49fa3..283b7d615aa 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -13,7 +13,7 @@ use net_traits::http_status::HttpStatus; use servo_url::ServoUrl; use url::Position; -use crate::body::{consume_body, BodyMixin, BodyType, Extractable, ExtractedBody}; +use crate::body::{BodyMixin, BodyType, Extractable, ExtractedBody, consume_body}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods; use crate::dom::bindings::codegen::Bindings::ResponseBinding; @@ -22,11 +22,11 @@ use crate::dom::bindings::codegen::Bindings::ResponseBinding::{ }; use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{ByteString, USVString}; use crate::dom::globalscope::GlobalScope; -use crate::dom::headers::{is_obs_text, is_vchar, Guard, Headers}; +use crate::dom::headers::{Guard, Headers, is_obs_text, is_vchar}; use crate::dom::promise::Promise; use crate::dom::readablestream::ReadableStream; use crate::dom::underlyingsourcecontainer::UnderlyingSourceType; diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs index df56f357db3..2f85d14f6dc 100644 --- a/components/script/dom/rtcdatachannel.rs +++ b/components/script/dom/rtcdatachannel.rs @@ -24,7 +24,7 @@ use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::{ use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::{RTCErrorDetailType, RTCErrorInit}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, DomObject}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::Blob; @@ -182,12 +182,14 @@ impl RTCDataChannel { }, "arraybuffer" => { rooted!(in(*cx) let mut array_buffer = ptr::null_mut::<JSObject>()); - assert!(ArrayBuffer::create( - *cx, - CreateWith::Slice(&data), - array_buffer.handle_mut() - ) - .is_ok()); + assert!( + ArrayBuffer::create( + *cx, + CreateWith::Slice(&data), + array_buffer.handle_mut() + ) + .is_ok() + ); (*array_buffer).to_jsval(*cx, message.handle_mut()); }, diff --git a/components/script/dom/rtcdatachannelevent.rs b/components/script/dom/rtcdatachannelevent.rs index fda441c3a73..163a9036803 100644 --- a/components/script/dom/rtcdatachannelevent.rs +++ b/components/script/dom/rtcdatachannelevent.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::RTCDataChannelEventBinding::{ RTCDataChannelEventInit, RTCDataChannelEventMethods, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/rtcerror.rs b/components/script/dom/rtcerror.rs index 3c3254ebc40..61299c49cbe 100644 --- a/components/script/dom/rtcerror.rs +++ b/components/script/dom/rtcerror.rs @@ -8,7 +8,7 @@ use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::{ RTCErrorDetailType, RTCErrorInit, RTCErrorMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::domexception::DOMException; diff --git a/components/script/dom/rtcerrorevent.rs b/components/script/dom/rtcerrorevent.rs index 56853cafced..b92b447b166 100644 --- a/components/script/dom/rtcerrorevent.rs +++ b/components/script/dom/rtcerrorevent.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::RTCErrorEventBinding::{ RTCErrorEventInit, RTCErrorEventMethods, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 5fb660b03d2..a2090aecdf5 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::{ RTCIceCandidateInit, RTCIceCandidateMethods, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 6c1aa8c709b..d16a69d47f9 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -8,14 +8,14 @@ use std::rc::Rc; use dom_struct::dom_struct; use js::rust::HandleObject; -use servo_media::streams::registry::MediaStreamId; +use servo_media::ServoMedia; use servo_media::streams::MediaStreamType; +use servo_media::streams::registry::MediaStreamId; use servo_media::webrtc::{ BundlePolicy, DataChannelEvent, DataChannelId, DataChannelState, GatheringState, IceCandidate, IceConnectionState, SdpType, SessionDescription, SignalingState, WebRtcController, WebRtcSignaller, }; -use servo_media::ServoMedia; use crate::conversions::Convert; use crate::dom::bindings::cell::DomRefCell; @@ -33,7 +33,7 @@ use crate::dom::bindings::codegen::UnionTypes::{MediaStreamTrackOrString, String use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::USVString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; @@ -50,7 +50,7 @@ use crate::dom::rtcrtptransceiver::RTCRtpTransceiver; use crate::dom::rtcsessiondescription::RTCSessionDescription; use crate::dom::rtctrackevent::RTCTrackEvent; use crate::dom::window::Window; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; use crate::task_source::SendableTaskSource; diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs index 13c57e5402d..b550f29eb31 100644 --- a/components/script/dom/rtcpeerconnectioniceevent.rs +++ b/components/script/dom/rtcpeerconnectioniceevent.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/rtcrtpsender.rs b/components/script/dom/rtcrtpsender.rs index 58c5af6cecc..4f22e2d8dcf 100644 --- a/components/script/dom/rtcrtpsender.rs +++ b/components/script/dom/rtcrtpsender.rs @@ -9,7 +9,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::RTCRtpSenderBinding::{ RTCRtcpParameters, RTCRtpParameters, RTCRtpSendParameters, RTCRtpSenderMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/rtcrtptransceiver.rs b/components/script/dom/rtcrtptransceiver.rs index 59aa492a7e1..61885da1015 100644 --- a/components/script/dom/rtcrtptransceiver.rs +++ b/components/script/dom/rtcrtptransceiver.rs @@ -9,7 +9,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::RTCRtpTransceiverBinding::{ RTCRtpTransceiverDirection, RTCRtpTransceiverMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::rtcrtpsender::RTCRtpSender; diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 6ba91ef6413..6dfec4186fc 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ RTCSdpType, RTCSessionDescriptionInit, RTCSessionDescriptionMethods, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/rtctrackevent.rs b/components/script/dom/rtctrackevent.rs index d1f6455d2f5..5e9ab153a95 100644 --- a/components/script/dom/rtctrackevent.rs +++ b/components/script/dom/rtctrackevent.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventM use crate::dom::bindings::codegen::Bindings::RTCTrackEventBinding::{self, RTCTrackEventMethods}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index d10332d7c54..ff35b2e60f5 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -11,7 +11,7 @@ use webrender_traits::CrossProcessCompositorMessage; use crate::dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/selection.rs b/components/script/dom/selection.rs index 207fa001d67..758a8608d2b 100644 --- a/components/script/dom/selection.rs +++ b/components/script/dom/selection.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::SelectionBinding::SelectionMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; @@ -167,11 +167,7 @@ impl SelectionMethods<crate::DomTypeHolder> for Selection { // https://w3c.github.io/selection-api/#dom-selection-rangecount fn RangeCount(&self) -> u32 { - if self.range.get().is_some() { - 1 - } else { - 0 - } + if self.range.get().is_some() { 1 } else { 0 } } // https://w3c.github.io/selection-api/#dom-selection-type diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index 8a0d2b07d71..c3d677c5111 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -20,7 +20,7 @@ use crate::dom::bindings::codegen::Bindings::ServiceWorkerBinding::{ use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::bindings::structuredclone; diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index 29f0fc8fb9b..a1ef784bbad 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ }; use crate::dom::bindings::error::Error; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::USVString; use crate::dom::client::Client; @@ -24,7 +24,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::serviceworker::ServiceWorker; use crate::dom::serviceworkerregistration::ServiceWorkerRegistration; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; use crate::task_source::SendableTaskSource; diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 432535e4e2d..9b12561388f 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -2,18 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::thread::{self, JoinHandle}; use std::time::{Duration, Instant}; use base::id::PipelineId; -use crossbeam_channel::{after, unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, after, unbounded}; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use js::jsapi::{JSContext, JS_AddInterruptCallback}; +use js::jsapi::{JS_AddInterruptCallback, JSContext}; use js::jsval::UndefinedValue; use net_traits::request::{ CredentialsMode, Destination, InsecureRequestsPolicy, ParserMetadata, Referrer, RequestBuilder, @@ -27,7 +27,7 @@ use style::thread_state::{self, ThreadState}; use crate::devtools; use crate::dom::abstractworker::WorkerScriptMsg; -use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods}; +use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; use crate::dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; use crate::dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use crate::dom::bindings::codegen::Bindings::WorkerBinding::WorkerType; @@ -48,7 +48,7 @@ use crate::dom::worker::TrustedWorkerAddress; use crate::dom::workerglobalscope::WorkerGlobalScope; use crate::fetch::load_whole_resource; use crate::messaging::{CommonScriptMsg, ScriptEventLoopSender}; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext, Runtime, ThreadSafeJSContext}; use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; use crate::task_source::TaskSourceName; diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index dabd517e9dd..bbd3840e695 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ ServiceWorkerRegistrationMethods, ServiceWorkerUpdateViaCache, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::{ByteString, USVString}; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 98ca1fbb3b0..863ed3c917b 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -6,11 +6,11 @@ use std::borrow::Cow; use std::cell::{Cell, Ref, RefCell, RefMut}; -use std::collections::vec_deque::VecDeque; use std::collections::HashMap; +use std::collections::vec_deque::VecDeque; use std::thread; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use html5ever::buffer_queue::BufferQueue; use html5ever::tendril::fmt::UTF8; use html5ever::tendril::{SendTendril, StrTendril, Tendril}; @@ -20,7 +20,7 @@ use html5ever::tree_builder::{ TreeBuilderOpts, TreeSink, }; use html5ever::{ - local_name, namespace_url, ns, Attribute as HtmlAttribute, ExpandedName, QualName, + Attribute as HtmlAttribute, ExpandedName, QualName, local_name, namespace_url, ns, }; use servo_url::ServoUrl; use style::context::QuirksMode as ServoQuirksMode; @@ -39,7 +39,7 @@ use crate::dom::htmlscriptelement::HTMLScriptElement; use crate::dom::htmltemplateelement::HTMLTemplateElement; use crate::dom::node::Node; use crate::dom::processinginstruction::ProcessingInstruction; -use crate::dom::servoparser::{create_element_for_token, ElementAttribute, ParsingAlgorithm}; +use crate::dom::servoparser::{ElementAttribute, ParsingAlgorithm, create_element_for_token}; use crate::dom::virtualmethods::vtable_for; use crate::script_runtime::CanGc; diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 624063d20dc..2d07bf2f088 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -7,12 +7,12 @@ use std::cell::Cell; use std::io; +use html5ever::QualName; use html5ever::buffer_queue::BufferQueue; use html5ever::serialize::TraversalScope::IncludeNode; use html5ever::serialize::{AttrRef, Serialize, Serializer, TraversalScope}; use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult}; use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts}; -use html5ever::QualName; use js::jsapi::JSTracer; use servo_url::ServoUrl; diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 3fdf9743519..fd6c39c7f97 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -7,8 +7,8 @@ use std::cell::Cell; use base::cross_process_instant::CrossProcessInstant; use base::id::PipelineId; -use base64::engine::general_purpose; use base64::Engine as _; +use base64::engine::general_purpose; use content_security_policy::{self as csp, CspList}; use dom_struct::dom_struct; use embedder_traits::resources::{self, Resource}; @@ -18,7 +18,7 @@ use html5ever::tendril::fmt::UTF8; use html5ever::tendril::{ByteTendril, StrTendril, TendrilSink}; use html5ever::tokenizer::TokenizerResult; use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksMode, TreeSink}; -use html5ever::{local_name, namespace_url, ns, Attribute, ExpandedName, LocalName, QualName}; +use html5ever::{Attribute, ExpandedName, LocalName, QualName, local_name, namespace_url, ns}; use hyper_serde::Serde; use mime::{self, Mime}; use net_traits::request::RequestId; @@ -46,7 +46,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTem use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::settings_stack::is_execution_stack_empty; use crate::dom::bindings::str::{DOMString, USVString}; diff --git a/components/script/dom/servoparser/prefetch.rs b/components/script/dom/servoparser/prefetch.rs index aba27d85253..2d3c1569375 100644 --- a/components/script/dom/servoparser/prefetch.rs +++ b/components/script/dom/servoparser/prefetch.rs @@ -11,7 +11,7 @@ use html5ever::tokenizer::states::RawKind; use html5ever::tokenizer::{ Tag, TagKind, Token, TokenSink, TokenSinkResult, Tokenizer as HtmlTokenizer, TokenizerResult, }; -use html5ever::{local_name, Attribute, LocalName}; +use html5ever::{Attribute, LocalName, local_name}; use js::jsapi::JSTracer; use net_traits::request::{ CorsSettings, CredentialsMode, InsecureRequestsPolicy, ParserMetadata, Referrer, @@ -21,7 +21,7 @@ use servo_url::{ImmutableOrigin, ServoUrl}; use crate::dom::bindings::reflector::DomGlobal; use crate::dom::bindings::trace::{CustomTraceable, JSTraceable}; -use crate::dom::document::{determine_policy_for_token, Document}; +use crate::dom::document::{Document, determine_policy_for_token}; use crate::dom::htmlscriptelement::script_fetch_request; use crate::fetch::create_a_potential_cors_request; use crate::script_module::ScriptFetchOptions; diff --git a/components/script/dom/shadowroot.rs b/components/script/dom/shadowroot.rs index e27e58a1ca6..357594a0948 100644 --- a/components/script/dom/shadowroot.rs +++ b/components/script/dom/shadowroot.rs @@ -32,7 +32,7 @@ use crate::dom::node::{ }; use crate::dom::stylesheetlist::{StyleSheetList, StyleSheetListOwner}; use crate::dom::types::EventTarget; -use crate::dom::virtualmethods::{vtable_for, VirtualMethods}; +use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; use crate::dom::window::Window; use crate::script_runtime::CanGc; use crate::stylesheet_set::StylesheetSetRef; diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 360f47cf569..8b155a81dd2 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -4,8 +4,8 @@ use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; -use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use net_traits::IpcSend; +use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use profile_traits::ipc; use script_traits::ScriptMsg; use servo_url::ServoUrl; @@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index fb67257a5e2..5d5260f887a 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -11,7 +11,7 @@ use style::custom_properties; use super::bindings::trace::HashMapTracedValues; use crate::dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylevalue::CSSStyleValue; diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs index 430d37d0dac..628c044c3b7 100644 --- a/components/script/dom/stylesheetlist.rs +++ b/components/script/dom/stylesheetlist.rs @@ -7,7 +7,7 @@ use servo_arc::Arc; use style::stylesheets::Stylesheet; use crate::dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::document::Document; diff --git a/components/script/dom/submitevent.rs b/components/script/dom/submitevent.rs index 3e267974b16..02a33a8e82c 100644 --- a/components/script/dom/submitevent.rs +++ b/components/script/dom/submitevent.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::SubmitEventBinding; use crate::dom::bindings::codegen::Bindings::SubmitEventBinding::SubmitEventMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/subtlecrypto.rs b/components/script/dom/subtlecrypto.rs index de1e852222f..17c3ff752ae 100644 --- a/components/script/dom/subtlecrypto.rs +++ b/components/script/dom/subtlecrypto.rs @@ -17,7 +17,7 @@ use base64::prelude::*; use cipher::consts::{U12, U16, U32}; use dom_struct::dom_struct; use js::conversions::ConversionResult; -use js::jsapi::{JSObject, JS_NewObject}; +use js::jsapi::{JS_NewObject, JSObject}; use js::jsval::ObjectValue; use js::rust::MutableHandleObject; use js::typedarray::ArrayBufferU8; @@ -40,7 +40,7 @@ use crate::dom::bindings::codegen::UnionTypes::{ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::import::module::SafeJSContext; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/svgelement.rs b/components/script/dom/svgelement.rs index 8e3b2e1e5ba..525c93c5741 100644 --- a/components/script/dom/svgelement.rs +++ b/components/script/dom/svgelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use style_dom::ElementState; diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index 2438854b3b0..0a6e7605aad 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; +use html5ever::{LocalName, Prefix, local_name, namespace_url, ns}; use js::rust::HandleObject; use script_layout_interface::SVGSVGData; use style::attr::AttrValue; diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 13b6da11b55..31e62b9f92f 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -10,7 +10,7 @@ use std::rc::Rc; use std::time::Duration; use dom_struct::dom_struct; -use js::jsapi::{Heap, JSObject, JS_NewPlainObject}; +use js::jsapi::{Heap, JS_NewPlainObject, JSObject}; use js::jsval::JSVal; use js::rust::{CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleValue}; use js::typedarray::{self, Uint8ClampedArray}; @@ -37,7 +37,7 @@ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; use crate::dom::bindings::record::Record; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{ByteString, DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index 20da79122f7..6ef79223a45 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -10,7 +10,7 @@ use js::rust::HandleObject; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingIterableBinding::TestBindingIterableMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testbindingmaplikewithinterface.rs b/components/script/dom/testbindingmaplikewithinterface.rs index 1297f89e7fd..3fddb41bb34 100644 --- a/components/script/dom/testbindingmaplikewithinterface.rs +++ b/components/script/dom/testbindingmaplikewithinterface.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeWithInterfaceBinding::TestBindingMaplikeWithInterfaceMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::like::Maplike; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testbindingmaplikewithprimitive.rs b/components/script/dom/testbindingmaplikewithprimitive.rs index 4768bb246c0..e90c984d028 100644 --- a/components/script/dom/testbindingmaplikewithprimitive.rs +++ b/components/script/dom/testbindingmaplikewithprimitive.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeWithPrimitiveBinding::TestBindingMaplikeWithPrimitiveMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::like::Maplike; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index 03df811260b..098e85f5647 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindingPairIterableMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testbindingsetlikewithinterface.rs b/components/script/dom/testbindingsetlikewithinterface.rs index 26439b20103..22c6c308c03 100644 --- a/components/script/dom/testbindingsetlikewithinterface.rs +++ b/components/script/dom/testbindingsetlikewithinterface.rs @@ -12,7 +12,7 @@ use super::bindings::like::Setlike; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterfaceMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::dom::testbinding::TestBinding; diff --git a/components/script/dom/testbindingsetlikewithprimitive.rs b/components/script/dom/testbindingsetlikewithprimitive.rs index f1467b18b15..4d556085a13 100644 --- a/components/script/dom/testbindingsetlikewithprimitive.rs +++ b/components/script/dom/testbindingsetlikewithprimitive.rs @@ -12,7 +12,7 @@ use super::bindings::like::Setlike; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingSetlikeWithPrimitiveBinding::TestBindingSetlikeWithPrimitiveMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index 4565edfcef6..7c7630ac788 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -9,10 +9,10 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::TestWorkletBinding::TestWorkletMethods; -use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use crate::dom::bindings::codegen::Bindings::WorkletBinding::Worklet_Binding::WorkletMethods; +use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::promise::Promise; diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index 9368d63306d..1396f6589f0 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::TextDecoderBinding::{ }; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index 9e98583e065..3d2ec8b6187 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::TextEncoderBinding::{ TextEncoderEncodeIntoResult, TextEncoderMethods, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/textmetrics.rs b/components/script/dom/textmetrics.rs index f31b2700015..f4aa38a19ed 100644 --- a/components/script/dom/textmetrics.rs +++ b/components/script/dom/textmetrics.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::TextMetricsBinding::TextMetricsMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/texttrack.rs b/components/script/dom/texttrack.rs index 526858b7aa1..e311827a516 100644 --- a/components/script/dom/texttrack.rs +++ b/components/script/dom/texttrack.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::TextTrackBinding::{ TextTrackKind, TextTrackMethods, TextTrackMode, }; use crate::dom::bindings::error::{Error, ErrorResult}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/texttrackcuelist.rs b/components/script/dom/texttrackcuelist.rs index f0f25ccfa80..be586ed805d 100644 --- a/components/script/dom/texttrackcuelist.rs +++ b/components/script/dom/texttrackcuelist.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TextTrackCueListBinding::TextTrackCueListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::texttrackcue::TextTrackCue; diff --git a/components/script/dom/texttracklist.rs b/components/script/dom/texttracklist.rs index 54fb1e96d05..7d1c869d0bf 100644 --- a/components/script/dom/texttracklist.rs +++ b/components/script/dom/texttracklist.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::TextTrackListBinding::TextTrackList use crate::dom::bindings::codegen::UnionTypes::VideoTrackOrAudioTrackOrTextTrack; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/timeranges.rs b/components/script/dom/timeranges.rs index eb00be77130..a2b1e9720f0 100644 --- a/components/script/dom/timeranges.rs +++ b/components/script/dom/timeranges.rs @@ -9,7 +9,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::TimeRangesBinding::TimeRangesMethods; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs index d34258591cb..b9453d961ad 100644 --- a/components/script/dom/touch.rs +++ b/components/script/dom/touch.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutDom}; use crate::dom::eventtarget::EventTarget; use crate::dom::window::Window; diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs index 2ee9c620786..38de438cbd6 100644 --- a/components/script/dom/touchlist.rs +++ b/components/script/dom/touchlist.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::touch::Touch; use crate::dom::window::Window; diff --git a/components/script/dom/trackevent.rs b/components/script/dom/trackevent.rs index c1e45bf5cdd..13849760c6a 100644 --- a/components/script/dom/trackevent.rs +++ b/components/script/dom/trackevent.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::TrackEventBinding::TrackEventMethod use crate::dom::bindings::codegen::UnionTypes::VideoTrackOrAudioTrackOrTextTrack; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 2d44991d1c4..b3ec0e86501 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::{NodeFilter, NodeFilterConstants}; use crate::dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutDom}; use crate::dom::document::Document; use crate::dom::node::Node; diff --git a/components/script/dom/underlyingsourcecontainer.rs b/components/script/dom/underlyingsourcecontainer.rs index 694b5553a36..e04e6a0fd6a 100644 --- a/components/script/dom/underlyingsourcecontainer.rs +++ b/components/script/dom/underlyingsourcecontainer.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::codegen::Bindings::UnderlyingSourceBinding::UnderlyingSource as JsUnderlyingSource; use crate::dom::bindings::import::module::Error; use crate::dom::bindings::import::module::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::defaultteeunderlyingsource::DefaultTeeUnderlyingSource; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index ce8bf37d3bd..8486de3de0d 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -16,7 +16,7 @@ use uuid::Uuid; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::URLBinding::URLMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::Blob; diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index b7c13e312fa..ed1f2665892 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchPa use crate::dom::bindings::codegen::UnionTypes::USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::weakref::MutableWeakRef; @@ -192,7 +192,7 @@ impl URLSearchParamsMethods<crate::DomTypeHolder> for URLSearchParams { None => list.push((name.0, value.0)), // Step 2. }; } // Un-borrow self.list - // Step 3. + // Step 3. self.update_steps(); } diff --git a/components/script/dom/userscripts.rs b/components/script/dom/userscripts.rs index 6f884ab641b..f48c8cf7f5e 100644 --- a/components/script/dom/userscripts.rs +++ b/components/script/dom/userscripts.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::fs::{read_dir, File}; +use std::fs::{File, read_dir}; use std::io::Read; use std::path::PathBuf; use std::rc::Rc; diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index 675fe01449b..e757e09766a 100755 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -14,7 +14,7 @@ use super::bindings::codegen::Bindings::ElementInternalsBinding::ValidityStateFl use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/vertexarrayobject.rs b/components/script/dom/vertexarrayobject.rs index 31db2848fc6..7da5cf7195b 100644 --- a/components/script/dom/vertexarrayobject.rs +++ b/components/script/dom/vertexarrayobject.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::{ ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVersion, WebGLVertexArrayId, }; -use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref}; +use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants2; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::root::{Dom, MutNullableDom}; diff --git a/components/script/dom/videotrack.rs b/components/script/dom/videotrack.rs index 193cb455188..2004c1b8bbc 100644 --- a/components/script/dom/videotrack.rs +++ b/components/script/dom/videotrack.rs @@ -8,7 +8,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VideoTrackBinding::VideoTrackMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::videotracklist::VideoTrackList; diff --git a/components/script/dom/videotracklist.rs b/components/script/dom/videotracklist.rs index 2750ab503e2..075d2c62c03 100644 --- a/components/script/dom/videotracklist.rs +++ b/components/script/dom/videotracklist.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VideoTrackListBinding::VideoTrackListMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/vttcue.rs b/components/script/dom/vttcue.rs index 6dc48ebb0b8..4d44245d26f 100644 --- a/components/script/dom/vttcue.rs +++ b/components/script/dom/vttcue.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::VTTCueBinding::{ }; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::documentfragment::DocumentFragment; diff --git a/components/script/dom/vttregion.rs b/components/script/dom/vttregion.rs index fd6766c1afc..ee80210ee23 100644 --- a/components/script/dom/vttregion.rs +++ b/components/script/dom/vttregion.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VTTRegionBinding::{ScrollSetting, VTTRegionMethods}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index 7dd25b59c59..58e6149a271 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -11,8 +11,8 @@ use std::rc::Rc; use bitflags::bitflags; use canvas_traits::webgl::WebGLError::*; use canvas_traits::webgl::{ - webgl_channel, GLContextAttributes, InternalFormatParameter, WebGLCommand, WebGLContextId, - WebGLResult, WebGLVersion, + GLContextAttributes, InternalFormatParameter, WebGLCommand, WebGLContextId, WebGLResult, + WebGLVersion, webgl_channel, }; use dom_struct::dom_struct; use euclid::default::{Point2D, Rect, Size2D}; @@ -39,17 +39,17 @@ use crate::dom::bindings::codegen::UnionTypes::{ Uint32ArrayOrUnsignedLongSequence, }; use crate::dom::bindings::error::{ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, ToLayout}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlcanvaselement::LayoutCanvasRenderingContextHelpers; #[cfg(feature = "webxr")] use crate::dom::promise::Promise; +use crate::dom::webgl_validations::WebGLValidator; use crate::dom::webgl_validations::tex_image_2d::{ TexImage2DValidator, TexImage2DValidatorResult, TexStorageValidator, TexStorageValidatorResult, }; -use crate::dom::webgl_validations::WebGLValidator; use crate::dom::webglactiveinfo::WebGLActiveInfo; use crate::dom::webglbuffer::WebGLBuffer; use crate::dom::webglframebuffer::{WebGLFramebuffer, WebGLFramebufferAttachmentRoot}; @@ -57,8 +57,8 @@ use crate::dom::webglprogram::WebGLProgram; use crate::dom::webglquery::WebGLQuery; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; use crate::dom::webglrenderingcontext::{ - uniform_get, uniform_typed, Operation, TexPixels, TexSource, VertexAttrib, - WebGLRenderingContext, + Operation, TexPixels, TexSource, VertexAttrib, WebGLRenderingContext, uniform_get, + uniform_typed, }; use crate::dom::webglsampler::{WebGLSampler, WebGLSamplerValue}; use crate::dom::webglshader::WebGLShader; diff --git a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs index c53be69ae97..4d42beaa8ae 100644 --- a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs +++ b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs @@ -9,7 +9,7 @@ use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::{ ANGLEInstancedArraysConstants, ANGLEInstancedArraysMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/extblendminmax.rs b/components/script/dom/webgl_extensions/ext/extblendminmax.rs index 75a24557aec..1d728f5818f 100644 --- a/components/script/dom/webgl_extensions/ext/extblendminmax.rs +++ b/components/script/dom/webgl_extensions/ext/extblendminmax.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLVersion; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs index 44bea1cd0bc..43305992d6d 100644 --- a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLVersion; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat; use crate::dom::webglrenderingcontext::WebGLRenderingContext; diff --git a/components/script/dom/webgl_extensions/ext/extfragdepth.rs b/components/script/dom/webgl_extensions/ext/extfragdepth.rs index 393ba32503b..697249ebf83 100644 --- a/components/script/dom/webgl_extensions/ext/extfragdepth.rs +++ b/components/script/dom/webgl_extensions/ext/extfragdepth.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{WebGLSLVersion, WebGLVersion}; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs index c42b7deffc2..f4a578d8df7 100644 --- a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs +++ b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLVersion; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs index d19b2d93f65..48128028cd0 100644 --- a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs +++ b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs @@ -7,7 +7,7 @@ use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs index 2aa857ab252..7cbdd717977 100644 --- a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs +++ b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLVersion; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs index c963eb61295..a7ed70ca880 100644 --- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs +++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs @@ -7,7 +7,7 @@ use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs index 9ae34aa01fd..5b0c13fcc7b 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs @@ -5,8 +5,8 @@ use canvas_traits::webgl::{TexFormat, WebGLVersion}; use dom_struct::dom_struct; -use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions, constants as webgl}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs index 755e163a899..630ef8b4908 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs @@ -4,8 +4,8 @@ use dom_struct::dom_struct; -use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions, constants as webgl}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs index 0289e96b0f9..b61ca0e1515 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs @@ -7,7 +7,7 @@ use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs index b1f3b00ba8f..b75ad00b522 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index aeadd9bbe67..6ce64d8a73b 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -9,7 +9,7 @@ use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{ OESVertexArrayObjectConstants, OESVertexArrayObjectMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; diff --git a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs index 7eef3d47d6a..3777717b2bc 100644 --- a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs +++ b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLVersion; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webgl_extensions::ext::oestexturefloat::OESTextureFloat; use crate::dom::webglrenderingcontext::WebGLRenderingContext; diff --git a/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs b/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs index d6958339aa3..c68841be3bd 100644 --- a/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs +++ b/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{TexFormat, WebGLVersion}; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webgltexture::{TexCompression, TexCompressionValidation}; diff --git a/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs b/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs index 59d306d0e91..5a792fad03c 100644 --- a/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs +++ b/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{TexFormat, WebGLVersion}; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webgltexture::{TexCompression, TexCompressionValidation}; diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs index ea62973d55d..35322ec0808 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -13,7 +13,7 @@ use malloc_size_of::MallocSizeOf; type GLenum = u32; use super::wrapper::{TypedWebGLExtensionWrapper, WebGLExtensionWrapper}; -use super::{ext, WebGLExtension, WebGLExtensionSpec}; +use super::{WebGLExtension, WebGLExtensionSpec, ext}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index 3bc518b7546..088c81d5443 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -7,8 +7,8 @@ use std::{self, cmp, fmt}; use canvas_traits::webgl::WebGLError::*; use canvas_traits::webgl::{TexDataType, TexFormat}; -use super::types::TexImageTarget; use super::WebGLValidator; +use super::types::TexImageTarget; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webgltexture::{ImageInfo, TexCompression, TexCompressionValidation, WebGLTexture}; diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs index a19c0a35bc5..db656390cbf 100644 --- a/components/script/dom/webglactiveinfo.rs +++ b/components/script/dom/webglactiveinfo.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 5624d9d9951..3b1a1076dcc 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -5,14 +5,14 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use std::cell::Cell; -use canvas_traits::webgl::{webgl_channel, WebGLBufferId, WebGLCommand, WebGLError, WebGLResult}; +use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult, webgl_channel}; use dom_struct::dom_struct; use ipc_channel::ipc; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 93752eb6634..b73c5101efb 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -8,8 +8,8 @@ use std::cell::Cell; use canvas_traits::webgl::{ - webgl_channel, WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLFramebufferId, - WebGLRenderbufferId, WebGLResult, WebGLTextureId, WebGLVersion, + WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLFramebufferId, + WebGLRenderbufferId, WebGLResult, WebGLTextureId, WebGLVersion, webgl_channel, }; use dom_struct::dom_struct; use euclid::Size2D; @@ -19,7 +19,7 @@ use webxr_api::Viewport; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 5b101430c6a..8806dc5d404 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -6,8 +6,8 @@ use std::cell::Cell; use canvas_traits::webgl::{ - webgl_channel, ActiveAttribInfo, ActiveUniformBlockInfo, ActiveUniformInfo, WebGLCommand, - WebGLError, WebGLProgramId, WebGLResult, + ActiveAttribInfo, ActiveUniformBlockInfo, ActiveUniformInfo, WebGLCommand, WebGLError, + WebGLProgramId, WebGLResult, webgl_channel, }; use dom_struct::dom_struct; use fnv::FnvHashSet; @@ -17,7 +17,7 @@ use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants2; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::webglactiveinfo::WebGLActiveInfo; diff --git a/components/script/dom/webglquery.rs b/components/script/dom/webglquery.rs index 0f47b4bb646..468a14fa477 100644 --- a/components/script/dom/webglquery.rs +++ b/components/script/dom/webglquery.rs @@ -5,13 +5,13 @@ use std::cell::Cell; use canvas_traits::webgl::WebGLError::*; -use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLQueryId}; +use canvas_traits::webgl::{WebGLCommand, WebGLQueryId, webgl_channel}; use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs index 0e2b52b62c0..ecfdf9573e7 100644 --- a/components/script/dom/webglrenderbuffer.rs +++ b/components/script/dom/webglrenderbuffer.rs @@ -6,8 +6,8 @@ use std::cell::Cell; use canvas_traits::webgl::{ - webgl_channel, GlType, InternalFormatIntVec, WebGLCommand, WebGLError, WebGLRenderbufferId, - WebGLResult, WebGLVersion, + GlType, InternalFormatIntVec, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult, + WebGLVersion, webgl_channel, }; use dom_struct::dom_struct; @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding::EXT use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding::WEBGLColorBufferFloatConstants; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::webglframebuffer::WebGLFramebuffer; use crate::dom::webglobject::WebGLObject; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index ecccecffb3b..98908854f28 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -13,11 +13,11 @@ use backtrace::Backtrace; use bitflags::bitflags; use canvas_traits::webgl::WebGLError::*; use canvas_traits::webgl::{ - webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType, - TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace, - WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, - WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion, - YAxisTreatment, + AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType, TexDataType, + TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace, WebGLContextId, + WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, + WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion, YAxisTreatment, + webgl_channel, }; use dom_struct::dom_struct; use euclid::default::{Point2D, Rect, Size2D}; @@ -53,24 +53,24 @@ use crate::dom::bindings::codegen::UnionTypes::{ use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, DomObject, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomOnceCell, DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::element::cors_setting_for_element; use crate::dom::event::{Event, EventBubbles, EventCancelable}; -use crate::dom::htmlcanvaselement::{utils as canvas_utils, LayoutCanvasRenderingContextHelpers}; +use crate::dom::htmlcanvaselement::{LayoutCanvasRenderingContextHelpers, utils as canvas_utils}; use crate::dom::node::{Node, NodeDamage, NodeTraits}; #[cfg(feature = "webxr")] use crate::dom::promise::Promise; use crate::dom::vertexarrayobject::VertexAttribData; use crate::dom::webgl_extensions::WebGLExtensions; +use crate::dom::webgl_validations::WebGLValidator; use crate::dom::webgl_validations::tex_image_2d::{ CommonCompressedTexImage2DValidatorResult, CommonTexImage2DValidator, CommonTexImage2DValidatorResult, CompressedTexImage2DValidator, CompressedTexSubImage2DValidator, TexImage2DValidator, TexImage2DValidatorResult, }; use crate::dom::webgl_validations::types::TexImageTarget; -use crate::dom::webgl_validations::WebGLValidator; use crate::dom::webglactiveinfo::WebGLActiveInfo; use crate::dom::webglbuffer::WebGLBuffer; use crate::dom::webglcontextevent::WebGLContextEvent; diff --git a/components/script/dom/webglsampler.rs b/components/script/dom/webglsampler.rs index b7c926e0839..1832fc154ce 100644 --- a/components/script/dom/webglsampler.rs +++ b/components/script/dom/webglsampler.rs @@ -5,12 +5,12 @@ use std::cell::Cell; use canvas_traits::webgl::WebGLError::*; -use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSamplerId}; +use canvas_traits::webgl::{WebGLCommand, WebGLSamplerId, webgl_channel}; use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index c1cc4f1410f..a8025ff5989 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -8,21 +8,21 @@ use std::os::raw::c_int; use std::sync::Once; use canvas_traits::webgl::{ - webgl_channel, GLLimits, GlType, WebGLCommand, WebGLError, WebGLResult, WebGLSLVersion, - WebGLShaderId, WebGLVersion, + GLLimits, GlType, WebGLCommand, WebGLError, WebGLResult, WebGLSLVersion, WebGLShaderId, + WebGLVersion, webgl_channel, }; use dom_struct::dom_struct; use mozangle::shaders::{BuiltInResources, CompileOptions, Output, ShaderValidator}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; +use crate::dom::webgl_extensions::WebGLExtensions; use crate::dom::webgl_extensions::ext::extfragdepth::EXTFragDepth; use crate::dom::webgl_extensions::ext::extshadertexturelod::EXTShaderTextureLod; use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDerivatives; -use crate::dom::webgl_extensions::WebGLExtensions; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs index c90f2405c34..ab29a335cf7 100644 --- a/components/script/dom/webglshaderprecisionformat.rs +++ b/components/script/dom/webglshaderprecisionformat.rs @@ -8,7 +8,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webglsync.rs b/components/script/dom/webglsync.rs index 3a73a618c92..f3ef5f605c6 100644 --- a/components/script/dom/webglsync.rs +++ b/components/script/dom/webglsync.rs @@ -4,13 +4,13 @@ use std::cell::Cell; -use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSyncId}; +use canvas_traits::webgl::{WebGLCommand, WebGLSyncId, webgl_channel}; use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 2c1fe129ac9..299e0267f0e 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -10,8 +10,8 @@ use std::cell::Cell; use std::cmp; use canvas_traits::webgl::{ - webgl_channel, TexDataType, TexFormat, TexParameter, TexParameterBool, TexParameterInt, - WebGLCommand, WebGLError, WebGLResult, WebGLTextureId, + TexDataType, TexFormat, TexParameter, TexParameterBool, TexParameterInt, WebGLCommand, + WebGLError, WebGLResult, WebGLTextureId, webgl_channel, }; use dom_struct::dom_struct; @@ -19,7 +19,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::webgl_validations::types::TexImageTarget; use crate::dom::webglframebuffer::WebGLFramebuffer; diff --git a/components/script/dom/webgltransformfeedback.rs b/components/script/dom/webgltransformfeedback.rs index c5463cc28ab..413527b5a87 100644 --- a/components/script/dom/webgltransformfeedback.rs +++ b/components/script/dom/webgltransformfeedback.rs @@ -4,11 +4,11 @@ use std::cell::Cell; -use canvas_traits::webgl::{webgl_channel, WebGLCommand}; +use canvas_traits::webgl::{WebGLCommand, webgl_channel}; use dom_struct::dom_struct; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs index 15c12bc2def..85994b87635 100644 --- a/components/script/dom/webgluniformlocation.rs +++ b/components/script/dom/webgluniformlocation.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{WebGLContextId, WebGLProgramId}; use dom_struct::dom_struct; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webglvertexarrayobject.rs b/components/script/dom/webglvertexarrayobject.rs index 885ad0e44d8..6519e7467c9 100644 --- a/components/script/dom/webglvertexarrayobject.rs +++ b/components/script/dom/webglvertexarrayobject.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId}; use dom_struct::dom_struct; use crate::dom::bindings::cell::Ref; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::vertexarrayobject::{VertexArrayObject, VertexAttribData}; use crate::dom::webglbuffer::WebGLBuffer; diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs index cd4615f2fce..6700950f929 100644 --- a/components/script/dom/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webglvertexarrayobjectoes.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId}; use dom_struct::dom_struct; use crate::dom::bindings::cell::Ref; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::vertexarrayobject::{VertexArrayObject, VertexAttribData}; use crate::dom::webglbuffer::WebGLBuffer; diff --git a/components/script/dom/webgpu/gpu.rs b/components/script/dom/webgpu/gpu.rs index d152eec6f2e..163c4599d4a 100644 --- a/components/script/dom/webgpu/gpu.rs +++ b/components/script/dom/webgpu/gpu.rs @@ -10,7 +10,7 @@ use ipc_channel::router::ROUTER; use js::jsapi::Heap; use script_traits::ScriptMsg; use webgpu::wgt::PowerPreference; -use webgpu::{wgc, WebGPUResponse}; +use webgpu::{WebGPUResponse, wgc}; use super::wgsllanguagefeatures::WGSLLanguageFeatures; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ @@ -18,7 +18,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::error::Error; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, DomObject, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpuadapter.rs b/components/script/dom/webgpu/gpuadapter.rs index b8a905329b2..a8b50516234 100644 --- a/components/script/dom/webgpu/gpuadapter.rs +++ b/components/script/dom/webgpu/gpuadapter.rs @@ -8,7 +8,7 @@ use dom_struct::dom_struct; use js::jsapi::{Heap, JSObject}; use webgpu::wgc::instance::RequestDeviceError; use webgpu::wgt::MemoryHints; -use webgpu::{wgt, WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse}; +use webgpu::{WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse, wgt}; use super::gpusupportedfeatures::GPUSupportedFeatures; use super::gpusupportedlimits::set_limit; @@ -16,13 +16,13 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUAdapterMethods, GPUDeviceDescriptor, GPUDeviceLostReason, }; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::types::{GPUAdapterInfo, GPUSupportedLimits}; -use crate::dom::webgpu::gpu::{response_async, AsyncWGPUListener}; +use crate::dom::webgpu::gpu::{AsyncWGPUListener, response_async}; use crate::dom::webgpu::gpudevice::GPUDevice; use crate::dom::webgpu::gpusupportedfeatures::gpu_to_wgt_feature; use crate::realms::InRealm; diff --git a/components/script/dom/webgpu/gpuadapterinfo.rs b/components/script/dom/webgpu/gpuadapterinfo.rs index c5a26c2f5ed..88b6f6a9a05 100644 --- a/components/script/dom/webgpu/gpuadapterinfo.rs +++ b/components/script/dom/webgpu/gpuadapterinfo.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use webgpu::wgt::AdapterInfo; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUAdapterInfoMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/webgpu/gpubindgroup.rs b/components/script/dom/webgpu/gpubindgroup.rs index cb8fab3377f..0cc36c4cfcb 100644 --- a/components/script/dom/webgpu/gpubindgroup.rs +++ b/components/script/dom/webgpu/gpubindgroup.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUBindGroupDescriptor, GPUBindGroupMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpubindgrouplayout.rs b/components/script/dom/webgpu/gpubindgrouplayout.rs index 565753c9830..2f8ff161b50 100644 --- a/components/script/dom/webgpu/gpubindgrouplayout.rs +++ b/components/script/dom/webgpu/gpubindgrouplayout.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUBindGroupLayoutDescriptor, GPUBindGroupLayoutMethods, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpubuffer.rs b/components/script/dom/webgpu/gpubuffer.rs index 4958beb9502..b28b3d8c184 100644 --- a/components/script/dom/webgpu/gpubuffer.rs +++ b/components/script/dom/webgpu/gpubuffer.rs @@ -10,7 +10,7 @@ use dom_struct::dom_struct; use ipc_channel::ipc::IpcSharedMemory; use js::typedarray::ArrayBuffer; use webgpu::wgc::device::HostMap; -use webgpu::{wgt, Mapping, WebGPU, WebGPUBuffer, WebGPURequest, WebGPUResponse}; +use webgpu::{Mapping, WebGPU, WebGPUBuffer, WebGPURequest, WebGPUResponse, wgt}; use crate::conversions::Convert; use crate::dom::bindings::buffer_source::DataBlock; @@ -20,12 +20,12 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUMapModeConstants, GPUMapModeFlags, GPUSize64, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; -use crate::dom::webgpu::gpu::{response_async, AsyncWGPUListener}; +use crate::dom::webgpu::gpu::{AsyncWGPUListener, response_async}; use crate::dom::webgpu::gpudevice::GPUDevice; use crate::realms::InRealm; use crate::script_runtime::{CanGc, JSContext}; diff --git a/components/script/dom/webgpu/gpucanvascontext.rs b/components/script/dom/webgpu/gpucanvascontext.rs index 3b9abd27dce..fd621ebc335 100644 --- a/components/script/dom/webgpu/gpucanvascontext.rs +++ b/components/script/dom/webgpu/gpucanvascontext.rs @@ -12,10 +12,10 @@ use script_layout_interface::HTMLCanvasDataSource; use webgpu::swapchain::WebGPUContextId; use webgpu::wgc::id; use webgpu::{ - ContextConfiguration, WebGPU, WebGPURequest, WebGPUTexture, PRESENTATION_BUFFER_COUNT, + ContextConfiguration, PRESENTATION_BUFFER_COUNT, WebGPU, WebGPURequest, WebGPUTexture, }; -use webrender_api::units::DeviceIntSize; use webrender_api::ImageKey; +use webrender_api::units::DeviceIntSize; use super::gpuconvert::convert_texture_descriptor; use super::gputexture::GPUTexture; @@ -30,7 +30,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::USVString; use crate::dom::bindings::weakref::WeakRef; diff --git a/components/script/dom/webgpu/gpucommandbuffer.rs b/components/script/dom/webgpu/gpucommandbuffer.rs index 3492d53faa8..e014599e34e 100644 --- a/components/script/dom/webgpu/gpucommandbuffer.rs +++ b/components/script/dom/webgpu/gpucommandbuffer.rs @@ -7,7 +7,7 @@ use webgpu::{WebGPU, WebGPUCommandBuffer, WebGPURequest}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandBufferMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpucommandencoder.rs b/components/script/dom/webgpu/gpucommandencoder.rs index 82e7da34772..7d99c4f2bfb 100644 --- a/components/script/dom/webgpu/gpucommandencoder.rs +++ b/components/script/dom/webgpu/gpucommandencoder.rs @@ -5,8 +5,8 @@ use dom_struct::dom_struct; use webgpu::wgc::command as wgpu_com; use webgpu::{ - wgt, WebGPU, WebGPUCommandBuffer, WebGPUCommandEncoder, WebGPUComputePass, WebGPUDevice, - WebGPURenderPass, WebGPURequest, + WebGPU, WebGPUCommandBuffer, WebGPUCommandEncoder, WebGPUComputePass, WebGPUDevice, + WebGPURenderPass, WebGPURequest, wgt, }; use crate::conversions::{Convert, TryConvert}; @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPURenderPassDescriptor, GPUSize64, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpucompilationinfo.rs b/components/script/dom/webgpu/gpucompilationinfo.rs index 6af3b8e68f3..70fcd3f5398 100644 --- a/components/script/dom/webgpu/gpucompilationinfo.rs +++ b/components/script/dom/webgpu/gpucompilationinfo.rs @@ -8,7 +8,7 @@ use webgpu::ShaderCompilationInfo; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompilationInfoMethods; use crate::dom::bindings::import::module::DomRoot; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::utils::to_frozen_array; use crate::dom::globalscope::GlobalScope; use crate::dom::types::GPUCompilationMessage; diff --git a/components/script/dom/webgpu/gpucompilationmessage.rs b/components/script/dom/webgpu/gpucompilationmessage.rs index 1b10c12cf25..74094030f2b 100644 --- a/components/script/dom/webgpu/gpucompilationmessage.rs +++ b/components/script/dom/webgpu/gpucompilationmessage.rs @@ -10,7 +10,7 @@ use webgpu::ShaderCompilationInfo; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUCompilationMessageMethods, GPUCompilationMessageType, }; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::types::GlobalScope; diff --git a/components/script/dom/webgpu/gpucomputepassencoder.rs b/components/script/dom/webgpu/gpucomputepassencoder.rs index a2629d9045b..fba1af44a96 100644 --- a/components/script/dom/webgpu/gpucomputepassencoder.rs +++ b/components/script/dom/webgpu/gpucomputepassencoder.rs @@ -7,7 +7,7 @@ use webgpu::{WebGPU, WebGPUComputePass, WebGPURequest}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePassEncoderMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpucomputepipeline.rs b/components/script/dom/webgpu/gpucomputepipeline.rs index 161f6e639c6..418cf5f8fdd 100644 --- a/components/script/dom/webgpu/gpucomputepipeline.rs +++ b/components/script/dom/webgpu/gpucomputepipeline.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUComputePipelineDescriptor, GPUComputePipelineMethods, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpudevice.rs b/components/script/dom/webgpu/gpudevice.rs index 7b9c7a9f427..aa2a0d6a9c8 100644 --- a/components/script/dom/webgpu/gpudevice.rs +++ b/components/script/dom/webgpu/gpudevice.rs @@ -15,8 +15,8 @@ use webgpu::wgc::pipeline as wgpu_pipe; use webgpu::wgc::pipeline::RenderPipelineDescriptor; use webgpu::wgt::TextureFormat; use webgpu::{ - wgt, PopError, WebGPU, WebGPUComputePipeline, WebGPURenderPipeline, WebGPURequest, - WebGPUResponse, + PopError, WebGPU, WebGPUComputePipeline, WebGPURenderPipeline, WebGPURequest, WebGPUResponse, + wgt, }; use super::gpu::AsyncWGPUListener; @@ -37,7 +37,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::codegen::UnionTypes::GPUPipelineLayoutOrGPUAutoLayoutMode; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/webgpu/gpudevicelostinfo.rs b/components/script/dom/webgpu/gpudevicelostinfo.rs index ca0588ce108..2cfbc433ad6 100644 --- a/components/script/dom/webgpu/gpudevicelostinfo.rs +++ b/components/script/dom/webgpu/gpudevicelostinfo.rs @@ -9,7 +9,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUDeviceLostInfoMethods, GPUDeviceLostReason, }; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +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; diff --git a/components/script/dom/webgpu/gpuerror.rs b/components/script/dom/webgpu/gpuerror.rs index 5d403b89061..3456b09165e 100644 --- a/components/script/dom/webgpu/gpuerror.rs +++ b/components/script/dom/webgpu/gpuerror.rs @@ -8,7 +8,7 @@ use webgpu::{Error, ErrorFilter}; use crate::conversions::Convert; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{GPUErrorFilter, GPUErrorMethods}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpupipelinelayout.rs b/components/script/dom/webgpu/gpupipelinelayout.rs index ceb970cd80a..9f8923bbb0f 100644 --- a/components/script/dom/webgpu/gpupipelinelayout.rs +++ b/components/script/dom/webgpu/gpupipelinelayout.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUPipelineLayoutDescriptor, GPUPipelineLayoutMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpuqueue.rs b/components/script/dom/webgpu/gpuqueue.rs index 8d22ad81d35..1cf3589eadc 100644 --- a/components/script/dom/webgpu/gpuqueue.rs +++ b/components/script/dom/webgpu/gpuqueue.rs @@ -6,9 +6,9 @@ use std::rc::Rc; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSharedMemory; -use webgpu::{wgt, WebGPU, WebGPUQueue, WebGPURequest, WebGPUResponse}; +use webgpu::{WebGPU, WebGPUQueue, WebGPURequest, WebGPUResponse, wgt}; -use super::gpu::{response_async, AsyncWGPUListener}; +use super::gpu::{AsyncWGPUListener, response_async}; use crate::conversions::{Convert, TryConvert}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer as BufferSource; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpurenderbundle.rs b/components/script/dom/webgpu/gpurenderbundle.rs index 56e9a38a80a..83b7cc43d75 100644 --- a/components/script/dom/webgpu/gpurenderbundle.rs +++ b/components/script/dom/webgpu/gpurenderbundle.rs @@ -7,7 +7,7 @@ use webgpu::{WebGPU, WebGPUDevice, WebGPURenderBundle, WebGPURequest}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpurenderbundleencoder.rs b/components/script/dom/webgpu/gpurenderbundleencoder.rs index 93a39eecc5e..2e7a1cc8f35 100644 --- a/components/script/dom/webgpu/gpurenderbundleencoder.rs +++ b/components/script/dom/webgpu/gpurenderbundleencoder.rs @@ -6,9 +6,9 @@ use std::borrow::Cow; use dom_struct::dom_struct; use webgpu::wgc::command::{ - bundle_ffi as wgpu_bundle, RenderBundleEncoder, RenderBundleEncoderDescriptor, + RenderBundleEncoder, RenderBundleEncoderDescriptor, bundle_ffi as wgpu_bundle, }; -use webgpu::{wgt, WebGPU, WebGPURenderBundle, WebGPURequest}; +use webgpu::{WebGPU, WebGPURenderBundle, WebGPURequest, wgt}; use crate::conversions::Convert; use crate::dom::bindings::cell::DomRefCell; @@ -17,7 +17,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPURenderBundleEncoderMethods, }; use crate::dom::bindings::import::module::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpurenderpassencoder.rs b/components/script/dom/webgpu/gpurenderpassencoder.rs index 3c40f243628..5263c52138d 100644 --- a/components/script/dom/webgpu/gpurenderpassencoder.rs +++ b/components/script/dom/webgpu/gpurenderpassencoder.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use webgpu::{wgt, RenderCommand, WebGPU, WebGPURenderPass, WebGPURequest}; +use webgpu::{RenderCommand, WebGPU, WebGPURenderPass, WebGPURequest, wgt}; use crate::conversions::TryConvert; use crate::dom::bindings::cell::DomRefCell; @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpurenderpipeline.rs b/components/script/dom/webgpu/gpurenderpipeline.rs index 0f7e25468d2..b4321475913 100644 --- a/components/script/dom/webgpu/gpurenderpipeline.rs +++ b/components/script/dom/webgpu/gpurenderpipeline.rs @@ -10,7 +10,7 @@ use webgpu::{WebGPU, WebGPUBindGroupLayout, WebGPURenderPipeline, WebGPURequest, use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpusampler.rs b/components/script/dom/webgpu/gpusampler.rs index cd973c45144..56e63ca6a5a 100644 --- a/components/script/dom/webgpu/gpusampler.rs +++ b/components/script/dom/webgpu/gpusampler.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUSamplerDescriptor, GPUSamplerMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpushadermodule.rs b/components/script/dom/webgpu/gpushadermodule.rs index 1e5e6507ec8..62dd456a054 100644 --- a/components/script/dom/webgpu/gpushadermodule.rs +++ b/components/script/dom/webgpu/gpushadermodule.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUShaderModuleDescriptor, GPUShaderModuleMethods, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/webgpu/gpusupportedfeatures.rs b/components/script/dom/webgpu/gpusupportedfeatures.rs index f07b173f5ca..d065cfa39c0 100644 --- a/components/script/dom/webgpu/gpusupportedfeatures.rs +++ b/components/script/dom/webgpu/gpusupportedfeatures.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::like::Setlike; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gpusupportedlimits.rs b/components/script/dom/webgpu/gpusupportedlimits.rs index a444b58d8b5..0ada017660d 100644 --- a/components/script/dom/webgpu/gpusupportedlimits.rs +++ b/components/script/dom/webgpu/gpusupportedlimits.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use GPUSupportedLimits_Binding::GPUSupportedLimitsMethods; use dom_struct::dom_struct; use num_traits::bounds::UpperBounded; use webgpu::wgt::Limits; -use GPUSupportedLimits_Binding::GPUSupportedLimitsMethods; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSupportedLimits_Binding; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webgpu/gputexture.rs b/components/script/dom/webgpu/gputexture.rs index eb0af2d09e5..e02bbedbdd5 100644 --- a/components/script/dom/webgpu/gputexture.rs +++ b/components/script/dom/webgpu/gputexture.rs @@ -6,7 +6,7 @@ use std::string::String; use dom_struct::dom_struct; use webgpu::wgc::resource; -use webgpu::{wgt, WebGPU, WebGPURequest, WebGPUTexture, WebGPUTextureView}; +use webgpu::{WebGPU, WebGPURequest, WebGPUTexture, WebGPUTextureView, wgt}; use super::gpuconvert::convert_texture_descriptor; use crate::conversions::Convert; @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ GPUTextureMethods, GPUTextureViewDescriptor, }; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/gputextureview.rs b/components/script/dom/webgpu/gputextureview.rs index 5cd1e0a0b66..f51b644cc83 100644 --- a/components/script/dom/webgpu/gputextureview.rs +++ b/components/script/dom/webgpu/gputextureview.rs @@ -7,7 +7,7 @@ use webgpu::{WebGPU, WebGPURequest, WebGPUTextureView}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webgpu/wgsllanguagefeatures.rs b/components/script/dom/webgpu/wgsllanguagefeatures.rs index 9b370e0b710..131f07bc677 100644 --- a/components/script/dom/webgpu/wgsllanguagefeatures.rs +++ b/components/script/dom/webgpu/wgsllanguagefeatures.rs @@ -12,7 +12,7 @@ use webgpu::wgc::naga::front::wgsl::ImplementedLanguageExtension; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::WGSLLanguageFeaturesMethods; use crate::dom::bindings::like::Setlike; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 363ccb2f761..760318771fa 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -32,9 +32,9 @@ use crate::dom::bindings::conversions::ToJSValConvertible; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, DomObject}; +use crate::dom::bindings::reflector::{DomGlobal, DomObject, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::str::{is_token, DOMString, USVString}; +use crate::dom::bindings::str::{DOMString, USVString, is_token}; use crate::dom::blob::Blob; use crate::dom::closeevent::CloseEvent; use crate::dom::event::{Event, EventBubbles, EventCancelable}; @@ -586,12 +586,14 @@ impl TaskOnce for MessageReceivedTask { }, BinaryType::Arraybuffer => { rooted!(in(*cx) let mut array_buffer = ptr::null_mut::<JSObject>()); - assert!(ArrayBuffer::create( - *cx, - CreateWith::Slice(&data), - array_buffer.handle_mut() - ) - .is_ok()); + assert!( + ArrayBuffer::create( + *cx, + CreateWith::Slice(&data), + array_buffer.handle_mut() + ) + .is_ok() + ); (*array_buffer).to_jsval(*cx, message.handle_mut()); }, diff --git a/components/script/dom/webxr/fakexrdevice.rs b/components/script/dom/webxr/fakexrdevice.rs index 905981f9066..4d9ed0c21c0 100644 --- a/components/script/dom/webxr/fakexrdevice.rs +++ b/components/script/dom/webxr/fakexrdevice.rs @@ -29,9 +29,9 @@ use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; -use crate::dom::fakexrinputcontroller::{init_to_mock_buttons, FakeXRInputController}; +use crate::dom::fakexrinputcontroller::{FakeXRInputController, init_to_mock_buttons}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webxr/fakexrinputcontroller.rs b/components/script/dom/webxr/fakexrinputcontroller.rs index 0ff3bd86550..0b744371afa 100644 --- a/components/script/dom/webxr/fakexrinputcontroller.rs +++ b/components/script/dom/webxr/fakexrinputcontroller.rs @@ -18,7 +18,7 @@ use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{ XRHandedness, XRTargetRayMode, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::fakexrdevice::get_origin; diff --git a/components/script/dom/webxr/xrboundedreferencespace.rs b/components/script/dom/webxr/xrboundedreferencespace.rs index e118e92b47f..6965ef3dc26 100644 --- a/components/script/dom/webxr/xrboundedreferencespace.rs +++ b/components/script/dom/webxr/xrboundedreferencespace.rs @@ -7,7 +7,7 @@ use js::rust::MutableHandleValue; use crate::dom::bindings::codegen::Bindings::XRBoundedReferenceSpaceBinding::XRBoundedReferenceSpaceMethods; use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::utils::to_frozen_array; use crate::dom::dompointreadonly::DOMPointReadOnly; diff --git a/components/script/dom/webxr/xrframe.rs b/components/script/dom/webxr/xrframe.rs index ef97919b998..b969581da8b 100644 --- a/components/script/dom/webxr/xrframe.rs +++ b/components/script/dom/webxr/xrframe.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::XRFrameBinding::XRFrameMethods; use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrhittestresult::XRHitTestResult; diff --git a/components/script/dom/webxr/xrhand.rs b/components/script/dom/webxr/xrhand.rs index baade6833d8..cba457f019c 100644 --- a/components/script/dom/webxr/xrhand.rs +++ b/components/script/dom/webxr/xrhand.rs @@ -10,7 +10,7 @@ use webxr_api::{FingerJoint, Hand, Joint}; use crate::dom::bindings::codegen::Bindings::XRHandBinding::{XRHandJoint, XRHandMethods}; use crate::dom::bindings::conversions::ToJSValConvertible; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrinputsource::XRInputSource; diff --git a/components/script/dom/webxr/xrhittestresult.rs b/components/script/dom/webxr/xrhittestresult.rs index 2970dbf2239..47faee97d5d 100644 --- a/components/script/dom/webxr/xrhittestresult.rs +++ b/components/script/dom/webxr/xrhittestresult.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use webxr_api::HitTestResult; use crate::dom::bindings::codegen::Bindings::XRHitTestResultBinding::XRHitTestResultMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrframe::XRFrame; diff --git a/components/script/dom/webxr/xrhittestsource.rs b/components/script/dom/webxr/xrhittestsource.rs index 461e4c59bad..0ec9560db6e 100644 --- a/components/script/dom/webxr/xrhittestsource.rs +++ b/components/script/dom/webxr/xrhittestsource.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use webxr_api::HitTestId; use crate::dom::bindings::codegen::Bindings::XRHitTestSourceBinding::XRHitTestSourceMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrsession::XRSession; diff --git a/components/script/dom/webxr/xrinputsource.rs b/components/script/dom/webxr/xrinputsource.rs index d4d8cef9799..009b210646a 100644 --- a/components/script/dom/webxr/xrinputsource.rs +++ b/components/script/dom/webxr/xrinputsource.rs @@ -13,7 +13,7 @@ use webxr_api::{Handedness, InputFrame, InputId, InputSource, TargetRayMode}; use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{ XRHandedness, XRInputSourceMethods, XRTargetRayMode, }; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::gamepad::Gamepad; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrinputsourcearray.rs b/components/script/dom/webxr/xrinputsourcearray.rs index 35b871fb7e1..db09b164e8f 100644 --- a/components/script/dom/webxr/xrinputsourcearray.rs +++ b/components/script/dom/webxr/xrinputsourcearray.rs @@ -8,7 +8,7 @@ use webxr_api::{InputId, InputSource}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::XRInputSourceArrayBinding::XRInputSourceArrayMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::event::Event; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrinputsourceevent.rs b/components/script/dom/webxr/xrinputsourceevent.rs index 1957e8f82da..0854fa6f5d8 100644 --- a/components/script/dom/webxr/xrinputsourceevent.rs +++ b/components/script/dom/webxr/xrinputsourceevent.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::XRInputSourceEventBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/webxr/xrinputsourceschangeevent.rs b/components/script/dom/webxr/xrinputsourceschangeevent.rs index 7ecda6d8d9f..bc79918dceb 100644 --- a/components/script/dom/webxr/xrinputsourceschangeevent.rs +++ b/components/script/dom/webxr/xrinputsourceschangeevent.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::XRInputSourcesChangeEventBinding::{ self, XRInputSourcesChangeEventMethods, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::utils::to_frozen_array; diff --git a/components/script/dom/webxr/xrmediabinding.rs b/components/script/dom/webxr/xrmediabinding.rs index db535542f88..34efebc6ca3 100644 --- a/components/script/dom/webxr/xrmediabinding.rs +++ b/components/script/dom/webxr/xrmediabinding.rs @@ -8,7 +8,7 @@ use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::XRMediaBindingBinding::XRMediaBinding_Binding::XRMediaBindingMethods; use crate::dom::bindings::codegen::Bindings::XRMediaBindingBinding::XRMediaLayerInit; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::htmlvideoelement::HTMLVideoElement; use crate::dom::window::Window; diff --git a/components/script/dom/webxr/xrpose.rs b/components/script/dom/webxr/xrpose.rs index c3e822606cc..bc1c0ffee00 100644 --- a/components/script/dom/webxr/xrpose.rs +++ b/components/script/dom/webxr/xrpose.rs @@ -5,7 +5,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::XRPoseBinding::XRPoseMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::dompointreadonly::DOMPointReadOnly; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrray.rs b/components/script/dom/webxr/xrray.rs index 7f19a85ab11..88690642930 100644 --- a/components/script/dom/webxr/xrray.rs +++ b/components/script/dom/webxr/xrray.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::codegen::Bindings::XRRayBinding::{XRRayDirectionInit, XRRayMethods}; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::dompointreadonly::DOMPointReadOnly; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrreferencespace.rs b/components/script/dom/webxr/xrreferencespace.rs index eedcbda663a..e8b171d42bc 100644 --- a/components/script/dom/webxr/xrreferencespace.rs +++ b/components/script/dom/webxr/xrreferencespace.rs @@ -10,11 +10,11 @@ use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::{ XRReferenceSpaceMethods, XRReferenceSpaceType, }; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrrigidtransform::XRRigidTransform; -use crate::dom::xrsession::{cast_transform, ApiPose, BaseTransform, XRSession}; +use crate::dom::xrsession::{ApiPose, BaseTransform, XRSession, cast_transform}; use crate::dom::xrspace::XRSpace; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webxr/xrreferencespaceevent.rs b/components/script/dom/webxr/xrreferencespaceevent.rs index a0e124900b8..14b320eafc1 100644 --- a/components/script/dom/webxr/xrreferencespaceevent.rs +++ b/components/script/dom/webxr/xrreferencespaceevent.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceEventBinding::{ }; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/webxr/xrrenderstate.rs b/components/script/dom/webxr/xrrenderstate.rs index 8393035837d..4cf263a9182 100644 --- a/components/script/dom/webxr/xrrenderstate.rs +++ b/components/script/dom/webxr/xrrenderstate.rs @@ -11,7 +11,7 @@ use webxr_api::SubImages; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::utils::to_frozen_array; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrrigidtransform.rs b/components/script/dom/webxr/xrrigidtransform.rs index 7a5cb4c40f4..86459bc98d3 100644 --- a/components/script/dom/webxr/xrrigidtransform.rs +++ b/components/script/dom/webxr/xrrigidtransform.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding::XRRigidTransformMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::dompointreadonly::DOMPointReadOnly; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/webxr/xrsessionevent.rs b/components/script/dom/webxr/xrsessionevent.rs index 212c408811c..3faf80dac0a 100644 --- a/components/script/dom/webxr/xrsessionevent.rs +++ b/components/script/dom/webxr/xrsessionevent.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventM use crate::dom::bindings::codegen::Bindings::XRSessionEventBinding::{self, XRSessionEventMethods}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/webxr/xrspace.rs b/components/script/dom/webxr/xrspace.rs index 4c4e07f304c..45c244f0b6e 100644 --- a/components/script/dom/webxr/xrspace.rs +++ b/components/script/dom/webxr/xrspace.rs @@ -14,7 +14,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::xrinputsource::XRInputSource; use crate::dom::xrjointspace::XRJointSpace; use crate::dom::xrreferencespace::XRReferenceSpace; -use crate::dom::xrsession::{cast_transform, ApiPose, XRSession}; +use crate::dom::xrsession::{ApiPose, XRSession, cast_transform}; use crate::script_runtime::CanGc; #[dom_struct] diff --git a/components/script/dom/webxr/xrsystem.rs b/components/script/dom/webxr/xrsystem.rs index 288a81e0649..eabe7a72119 100644 --- a/components/script/dom/webxr/xrsystem.rs +++ b/components/script/dom/webxr/xrsystem.rs @@ -22,7 +22,7 @@ use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible}; use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::trace::RootedTraceableBox; use crate::dom::eventtarget::EventTarget; @@ -169,7 +169,9 @@ impl XRSystemMethods<crate::DomTypeHolder> for XRSystem { if mode != XRSessionMode::Inline { if !ScriptThread::is_user_interacting() { if pref!(dom_webxr_unsafe_assume_user_intent) { - warn!("The dom.webxr.unsafe-assume-user-intent preference assumes user intent to enter WebXR."); + warn!( + "The dom.webxr.unsafe-assume-user-intent preference assumes user intent to enter WebXR." + ); } else { promise.reject_error(Error::Security, can_gc); return promise; diff --git a/components/script/dom/webxr/xrtest.rs b/components/script/dom/webxr/xrtest.rs index 1cd29b027e7..4ababf97849 100644 --- a/components/script/dom/webxr/xrtest.rs +++ b/components/script/dom/webxr/xrtest.rs @@ -21,9 +21,9 @@ use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionMode; use crate::dom::bindings::codegen::Bindings::XRTestBinding::{FakeXRDeviceInit, XRTestMethods}; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; -use crate::dom::fakexrdevice::{get_origin, get_views, get_world, FakeXRDevice}; +use crate::dom::fakexrdevice::{FakeXRDevice, get_origin, get_views, get_world}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webxr/xrview.rs b/components/script/dom/webxr/xrview.rs index b09b6235d92..820fa48bca9 100644 --- a/components/script/dom/webxr/xrview.rs +++ b/components/script/dom/webxr/xrview.rs @@ -12,11 +12,11 @@ use webxr_api::{ApiSpace, View}; use crate::dom::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::codegen::Bindings::XRViewBinding::{XREye, XRViewMethods}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::xrrigidtransform::XRRigidTransform; -use crate::dom::xrsession::{cast_transform, BaseSpace, BaseTransform, XRSession}; +use crate::dom::xrsession::{BaseSpace, BaseTransform, XRSession, cast_transform}; use crate::script_runtime::{CanGc, JSContext}; #[dom_struct] diff --git a/components/script/dom/webxr/xrviewerpose.rs b/components/script/dom/webxr/xrviewerpose.rs index f7f1924d963..e70e726a7e7 100644 --- a/components/script/dom/webxr/xrviewerpose.rs +++ b/components/script/dom/webxr/xrviewerpose.rs @@ -17,7 +17,7 @@ use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::dom::xrpose::XRPose; use crate::dom::xrrigidtransform::XRRigidTransform; -use crate::dom::xrsession::{cast_transform, BaseSpace, BaseTransform, XRSession}; +use crate::dom::xrsession::{BaseSpace, BaseTransform, XRSession, cast_transform}; use crate::dom::xrview::XRView; use crate::realms::enter_realm; use crate::script_runtime::{CanGc, JSContext}; diff --git a/components/script/dom/webxr/xrviewport.rs b/components/script/dom/webxr/xrviewport.rs index 56323ed9879..af9fc92fba5 100644 --- a/components/script/dom/webxr/xrviewport.rs +++ b/components/script/dom/webxr/xrviewport.rs @@ -7,7 +7,7 @@ use euclid::Rect; use webxr_api::Viewport; use crate::dom::bindings::codegen::Bindings::XRViewportBinding::XRViewportMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use crate::script_runtime::CanGc; diff --git a/components/script/dom/webxr/xrwebgllayer.rs b/components/script/dom/webxr/xrwebgllayer.rs index 90be25e720b..e06ae3fd3b6 100644 --- a/components/script/dom/webxr/xrwebgllayer.rs +++ b/components/script/dom/webxr/xrwebgllayer.rs @@ -20,7 +20,7 @@ use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanva use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::webglframebuffer::WebGLFramebuffer; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index ec1c4ef38e5..fccbb112652 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -8,7 +8,7 @@ use std::cmp; use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::default::Default; -use std::io::{stderr, stdout, Write}; +use std::io::{Write, stderr, stdout}; use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; @@ -21,7 +21,7 @@ use base64::Engine; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLChan; -use crossbeam_channel::{unbounded, Sender}; +use crossbeam_channel::{Sender, unbounded}; use cssparser::{Parser, ParserInput, SourceLocation}; use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; use dom_struct::dom_struct; @@ -36,7 +36,7 @@ use ipc_channel::ipc::{self, IpcSender}; use js::conversions::ToJSValConvertible; use js::glue::DumpJSStack; use js::jsapi::{ - GCReason, Heap, JSAutoRealm, JSContext as RawJSContext, JSObject, JSPROP_ENUMERATE, JS_GC, + GCReason, Heap, JS_GC, JSAutoRealm, JSContext as RawJSContext, JSObject, JSPROP_ENUMERATE, }; use js::jsval::{NullValue, UndefinedValue}; use js::rust::wrappers::JS_DefineProperty; @@ -46,18 +46,18 @@ use js::rust::{ }; use malloc_size_of::MallocSizeOf; use media::WindowGLContext; +use net_traits::ResourceThreads; use net_traits::image_cache::{ ImageCache, ImageResponder, ImageResponse, PendingImageId, PendingImageResponse, }; use net_traits::storage_thread::StorageType; -use net_traits::ResourceThreads; use num_traits::ToPrimitive; use profile_traits::ipc as ProfiledIpc; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_layout_interface::{ - combine_id_with_fragment_type, FragmentType, Layout, PendingImageState, QueryMsg, Reflow, - ReflowGoal, ReflowRequest, TrustedNodeAddress, + FragmentType, Layout, PendingImageState, QueryMsg, Reflow, ReflowGoal, ReflowRequest, + TrustedNodeAddress, combine_id_with_fragment_type, }; use script_traits::{ DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptMsg, ScriptThreadMessage, @@ -68,14 +68,14 @@ use selectors::attr::CaseSensitivity; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_config::{opts, pref}; -use servo_geometry::{f32_rect_to_au_rect, DeviceIndependentIntRect, MaxRect}; +use servo_geometry::{DeviceIndependentIntRect, MaxRect, f32_rect_to_au_rect}; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use style::dom::OpaqueNode; use style::error_reporting::{ContextualParseError, ParseErrorReporter}; use style::media_queries; use style::parser::ParserContext as CssParserContext; -use style::properties::style_structs::Font; use style::properties::PropertyId; +use style::properties::style_structs::Font; use style::queries::values::PrefersColorScheme; use style::selector_parser::PseudoElement; use style::str::HTML_SPACE_CHARACTERS; @@ -135,7 +135,7 @@ use crate::dom::mediaquerylist::{MediaQueryList, MediaQueryListMatchState}; use crate::dom::mediaquerylistevent::MediaQueryListEvent; use crate::dom::messageevent::MessageEvent; use crate::dom::navigator::Navigator; -use crate::dom::node::{from_untrusted_node_address, Node, NodeDamage, NodeTraits}; +use crate::dom::node::{Node, NodeDamage, NodeTraits, from_untrusted_node_address}; use crate::dom::performance::Performance; use crate::dom::promise::Promise; use crate::dom::screen::Screen; @@ -153,7 +153,7 @@ use crate::dom::workletglobalscope::WorkletGlobalScopeType; use crate::layout_image::fetch_image_for_layout; use crate::messaging::{MainThreadScriptMsg, ScriptEventLoopReceiver, ScriptEventLoopSender}; use crate::microtask::MicrotaskQueue; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext, Runtime}; use crate::script_thread::ScriptThread; use crate::timers::{IsInterval, TimerCallback}; @@ -838,11 +838,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window { let result = JS_DefineProperty(*cx, obj, c"opener".as_ptr(), value, JSPROP_ENUMERATE as u32); - if result { - Ok(()) - } else { - Err(Error::JSFailed) - } + if result { Ok(()) } else { Err(Error::JSFailed) } } } diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 09a3ea942d9..7c95d800fcf 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -10,23 +10,23 @@ use dom_struct::dom_struct; use html5ever::local_name; use indexmap::map::IndexMap; use ipc_channel::ipc; +use js::JSCLASS_IS_GLOBAL; use js::glue::{ CreateWrapperProxyHandler, DeleteWrapperProxyHandler, GetProxyPrivate, GetProxyReservedSlot, ProxyTraps, SetProxyReservedSlot, }; use js::jsapi::{ GCContext, Handle as RawHandle, HandleId as RawHandleId, HandleObject as RawHandleObject, - HandleValue as RawHandleValue, JSAutoRealm, JSContext, JSErrNum, JSObject, JSTracer, - JS_DefinePropertyById, JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, - JS_GetOwnPropertyDescriptorById, JS_HasOwnPropertyById, JS_HasPropertyById, - JS_IsExceptionPending, MutableHandle as RawMutableHandle, + HandleValue as RawHandleValue, JS_DefinePropertyById, JS_ForwardGetPropertyTo, + JS_ForwardSetPropertyTo, JS_GetOwnPropertyDescriptorById, JS_HasOwnPropertyById, + JS_HasPropertyById, JS_IsExceptionPending, JSAutoRealm, JSContext, JSErrNum, JSObject, + JSPROP_ENUMERATE, JSPROP_READONLY, JSTracer, MutableHandle as RawMutableHandle, MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue, - ObjectOpResult, PropertyDescriptor, JSPROP_ENUMERATE, JSPROP_READONLY, + ObjectOpResult, PropertyDescriptor, }; use js::jsval::{NullValue, PrivateValue, UndefinedValue}; use js::rust::wrappers::{JS_TransplantObject, NewWindowProxy, SetWindowProxy}; -use js::rust::{get_object_class, Handle, MutableHandle, MutableHandleValue}; -use js::JSCLASS_IS_GLOBAL; +use js::rust::{Handle, MutableHandle, MutableHandleValue, get_object_class}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use net_traits::request::Referrer; use script_traits::{ @@ -38,21 +38,21 @@ use servo_url::{ImmutableOrigin, ServoUrl}; use style::attr::parse_integer; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::conversions::{root_from_handleobject, ToJSValConvertible}; -use crate::dom::bindings::error::{throw_dom_exception, Error, Fallible}; +use crate::dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject}; +use crate::dom::bindings::error::{Error, Fallible, throw_dom_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::proxyhandler::set_property_descriptor; use crate::dom::bindings::reflector::{DomGlobal, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::trace::JSTraceable; -use crate::dom::bindings::utils::{get_array_index_from_id, AsVoidPtr}; +use crate::dom::bindings::utils::{AsVoidPtr, get_array_index_from_id}; use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow; use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; use crate::script_thread::ScriptThread; @@ -681,7 +681,9 @@ impl WindowProxy { pub(crate) fn unset_currently_active(&self, can_gc: CanGc) { if self.currently_active().is_none() { - return debug!("Attempt to unset the currently active window on a windowproxy that does not have one."); + return debug!( + "Attempt to unset the currently active window on a windowproxy that does not have one." + ); } let globalscope = self.global(); let window = DissimilarOriginWindow::new(&globalscope, self); diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index b85ee84f8ca..81fab5949a7 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -3,10 +3,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::cell::Cell; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; -use crossbeam_channel::{unbounded, Sender}; +use crossbeam_channel::{Sender, unbounded}; use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg, WorkerId}; use dom_struct::dom_struct; use ipc_channel::ipc; @@ -24,7 +24,7 @@ use crate::dom::bindings::codegen::Bindings::WorkerBinding::{WorkerMethods, Work use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::bindings::structuredclone; diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index d7ee456ba8b..276b39657a6 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -5,8 +5,8 @@ use std::cell::{RefCell, RefMut}; use std::default::Default; use std::rc::Rc; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::time::Duration; use base::cross_process_instant::CrossProcessInstant; @@ -18,12 +18,12 @@ use ipc_channel::ipc::IpcSender; use js::jsval::UndefinedValue; use js::panic::maybe_resume_unwind; use js::rust::{HandleValue, MutableHandleValue, ParentRuntime}; +use net_traits::IpcSend; use net_traits::policy_container::PolicyContainer; use net_traits::request::{ CredentialsMode, Destination, InsecureRequestsPolicy, ParserMetadata, RequestBuilder as NetRequestInit, }; -use net_traits::IpcSend; use script_traits::WorkerGlobalScopeInit; use servo_url::{MutableOrigin, ServoUrl}; use timers::TimerScheduler; @@ -39,7 +39,7 @@ use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction; use crate::dom::bindings::codegen::Bindings::WorkerBinding::WorkerType; use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use crate::dom::bindings::codegen::UnionTypes::{RequestOrUSVString, StringOrFunction}; -use crate::dom::bindings::error::{report_pending_exception, Error, ErrorResult, Fallible}; +use crate::dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; @@ -58,7 +58,7 @@ use crate::dom::workerlocation::WorkerLocation; use crate::dom::workernavigator::WorkerNavigator; use crate::fetch; use crate::messaging::{CommonScriptMsg, ScriptEventLoopReceiver, ScriptEventLoopSender}; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext, JSContextHelper, Runtime}; use crate::task::TaskCanceller; use crate::timers::{IsInterval, TimerCallback}; diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index 1c4ef897abd..69ff4b8135c 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use servo_url::{ImmutableOrigin, ServoUrl}; use crate::dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::urlhelper::UrlHelper; diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index 846f2a412d5..1cbba5dcc89 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use js::rust::MutableHandleValue; use crate::dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods; -use crate::dom::bindings::reflector::{reflect_dom_object, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::utils::to_frozen_array; diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 140c60bf6b5..7e276859b67 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -12,22 +12,22 @@ use std::cell::OnceCell; use std::cmp::max; -use std::collections::{hash_map, HashMap}; +use std::collections::{HashMap, hash_map}; use std::rc::Rc; -use std::sync::atomic::{AtomicIsize, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicIsize, Ordering}; use std::thread; use base::id::PipelineId; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use dom_struct::dom_struct; -use js::jsapi::{GCReason, JSGCParamKey, JSTracer, JS_GetGCParameter, JS_GC}; +use js::jsapi::{GCReason, JS_GC, JS_GetGCParameter, JSGCParamKey, JSTracer}; use malloc_size_of::malloc_size_of_is_0; -use net_traits::request::{Destination, RequestBuilder, RequestMode}; use net_traits::IpcSend; +use net_traits::request::{Destination, RequestBuilder, RequestMode}; use servo_url::{ImmutableOrigin, ServoUrl}; use style::thread_state::{self, ThreadState}; -use swapper::{swapper, Swapper}; +use swapper::{Swapper, swapper}; use uuid::Uuid; use crate::conversions::Convert; @@ -37,7 +37,7 @@ use crate::dom::bindings::codegen::Bindings::WorkletBinding::{WorkletMethods, Wo use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, RootCollection, ThreadLocalStackRoots}; use crate::dom::bindings::str::USVString; use crate::dom::bindings::trace::{CustomTraceable, JSTraceable, RootedTraceableBox}; diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index 62c69e80509..ae11c4ff214 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -12,8 +12,8 @@ use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use js::jsval::UndefinedValue; use js::rust::Runtime; -use net_traits::image_cache::ImageCache; use net_traits::ResourceThreads; +use net_traits::image_cache::ImageCache; use profile_traits::{mem, time}; use script_traits::{Painter, ScriptMsg, ScriptToConstellationChan}; use servo_atoms::Atom; diff --git a/components/script/dom/writablestream.rs b/components/script/dom/writablestream.rs index 3a391ff1b24..9d86f65d858 100644 --- a/components/script/dom/writablestream.rs +++ b/components/script/dom/writablestream.rs @@ -23,7 +23,7 @@ use crate::dom::bindings::codegen::Bindings::WritableStreamBinding::WritableStre use crate::dom::bindings::conversions::ConversionResult; use crate::dom::bindings::error::Error; use crate::dom::bindings::import::module::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::countqueuingstrategy::{extract_high_water_mark, extract_size_algorithm}; use crate::dom::globalscope::GlobalScope; @@ -31,7 +31,7 @@ use crate::dom::promise::Promise; use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; use crate::dom::writablestreamdefaultcontroller::WritableStreamDefaultController; use crate::dom::writablestreamdefaultwriter::WritableStreamDefaultWriter; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; impl js::gc::Rootable for AbortAlgorithmFulfillmentHandler {} diff --git a/components/script/dom/writablestreamdefaultcontroller.rs b/components/script/dom/writablestreamdefaultcontroller.rs index a5a2a632864..2cad7bb62c5 100644 --- a/components/script/dom/writablestreamdefaultcontroller.rs +++ b/components/script/dom/writablestreamdefaultcontroller.rs @@ -19,14 +19,14 @@ use crate::dom::bindings::codegen::Bindings::UnderlyingSinkBinding::{ }; use crate::dom::bindings::codegen::Bindings::WritableStreamDefaultControllerBinding::WritableStreamDefaultControllerMethods; use crate::dom::bindings::error::{Error, ErrorToJsval}; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; use crate::dom::readablestreamdefaultcontroller::{EnqueuedValue, QueueWithSizes, ValueWithSize}; use crate::dom::writablestream::WritableStream; -use crate::realms::{enter_realm, InRealm}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; impl js::gc::Rootable for CloseAlgorithmFulfillmentHandler {} diff --git a/components/script/dom/writablestreamdefaultwriter.rs b/components/script/dom/writablestreamdefaultwriter.rs index d8c6295a9ff..07151e815f1 100644 --- a/components/script/dom/writablestreamdefaultwriter.rs +++ b/components/script/dom/writablestreamdefaultwriter.rs @@ -11,7 +11,7 @@ use js::rust::{HandleObject as SafeHandleObject, HandleValue as SafeHandleValue} use crate::dom::bindings::codegen::Bindings::WritableStreamDefaultWriterBinding::WritableStreamDefaultWriterMethods; use crate::dom::bindings::error::{Error, ErrorToJsval}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index be77ee4798c..3fe0db9cde4 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -15,8 +15,8 @@ use encoding_rs::{Encoding, UTF_8}; use headers::{ContentLength, ContentType, HeaderMapExt}; use html5ever::serialize; use html5ever::serialize::SerializeOpts; -use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::Method; +use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use hyper_serde::Serde; use js::jsapi::{Heap, JS_ClearPendingException}; use js::jsval::{JSVal, NullValue}; @@ -27,16 +27,16 @@ use mime::{self, Mime, Name}; use net_traits::http_status::HttpStatus; use net_traits::request::{CredentialsMode, Referrer, RequestBuilder, RequestId, RequestMode}; use net_traits::{ - trim_http_whitespace, FetchMetadata, FetchResponseListener, FilteredMetadata, NetworkError, - ReferrerPolicy, ResourceFetchTiming, ResourceTimingType, + FetchMetadata, FetchResponseListener, FilteredMetadata, NetworkError, ReferrerPolicy, + ResourceFetchTiming, ResourceTimingType, trim_http_whitespace, }; -use script_traits::serializable::BlobImpl; use script_traits::DocumentActivity; +use script_traits::serializable::BlobImpl; use servo_atoms::Atom; use servo_url::ServoUrl; use url::Position; -use crate::body::{decode_to_utf16_with_bom_removal, BodySource, Extractable, ExtractedBody}; +use crate::body::{BodySource, Extractable, ExtractedBody, decode_to_utf16_with_bom_removal}; use crate::document_loader::DocumentLoader; use crate::dom::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::cell::DomRefCell; @@ -49,10 +49,10 @@ use crate::dom::bindings::conversions::ToJSValConvertible; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal}; +use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; -use crate::dom::bindings::str::{is_token, ByteString, DOMString, USVString}; -use crate::dom::blob::{normalize_type_string, Blob}; +use crate::dom::bindings::str::{ByteString, DOMString, USVString, is_token}; +use crate::dom::blob::{Blob, normalize_type_string}; use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/xmlserializer.rs b/components/script/dom/xmlserializer.rs index 74941f9018d..130746e1af1 100644 --- a/components/script/dom/xmlserializer.rs +++ b/components/script/dom/xmlserializer.rs @@ -4,11 +4,11 @@ use dom_struct::dom_struct; use js::rust::HandleObject; -use xml5ever::serialize::{serialize, SerializeOpts, TraversalScope}; +use xml5ever::serialize::{SerializeOpts, TraversalScope, serialize}; use crate::dom::bindings::codegen::Bindings::XMLSerializerBinding::XMLSerializerMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::node::Node; diff --git a/components/script/dom/xpathevaluator.rs b/components/script/dom/xpathevaluator.rs index 2eab76f208e..561c12a7c11 100644 --- a/components/script/dom/xpathevaluator.rs +++ b/components/script/dom/xpathevaluator.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::XPathEvaluatorBinding::XPathEvaluat use crate::dom::bindings::codegen::Bindings::XPathExpressionBinding::XPathExpression_Binding::XPathExpressionMethods; use crate::dom::bindings::codegen::Bindings::XPathNSResolverBinding::XPathNSResolver; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::node::Node; diff --git a/components/script/dom/xpathexpression.rs b/components/script/dom/xpathexpression.rs index ecbf3fb4610..1cacb179d4f 100644 --- a/components/script/dom/xpathexpression.rs +++ b/components/script/dom/xpathexpression.rs @@ -7,13 +7,13 @@ use js::rust::HandleObject; use crate::dom::bindings::codegen::Bindings::XPathExpressionBinding::XPathExpressionMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomGlobal, Reflector}; +use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::node::Node; use crate::dom::window::Window; use crate::dom::xpathresult::{XPathResult, XPathResultType}; use crate::script_runtime::CanGc; -use crate::xpath::{evaluate_parsed_xpath, Expr}; +use crate::xpath::{Expr, evaluate_parsed_xpath}; #[dom_struct] pub(crate) struct XPathExpression { diff --git a/components/script/dom/xpathresult.rs b/components/script/dom/xpathresult.rs index c3e768474e5..f4a9ae7a31b 100644 --- a/components/script/dom/xpathresult.rs +++ b/components/script/dom/xpathresult.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::XPathResultBinding::{ XPathResultConstants, XPathResultMethods, }; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector}; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::node::Node; diff --git a/components/script/fetch.rs b/components/script/fetch.rs index 202f74197ef..1480e389b65 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -13,17 +13,17 @@ use net_traits::request::{ Request as NetTraitsRequest, RequestBuilder, RequestId, RequestMode, ServiceWorkersMode, }; use net_traits::{ - cancel_async_fetch, CoreResourceMsg, CoreResourceThread, FetchChannels, FetchMetadata, - FetchResponseListener, FetchResponseMsg, FilteredMetadata, Metadata, NetworkError, - ResourceFetchTiming, ResourceTimingType, + CoreResourceMsg, CoreResourceThread, FetchChannels, FetchMetadata, FetchResponseListener, + FetchResponseMsg, FilteredMetadata, Metadata, NetworkError, ResourceFetchTiming, + ResourceTimingType, cancel_async_fetch, }; use servo_url::ServoUrl; use crate::dom::bindings::codegen::Bindings::RequestBinding::{ RequestInfo, RequestInit, RequestMethods, }; -use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType; use crate::dom::bindings::codegen::Bindings::ResponseBinding::Response_Binding::ResponseMethods; +use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType; use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; @@ -37,8 +37,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::{self, submit_timing_data, PreInvoke, ResourceTimingListener}; -use crate::realms::{enter_realm, InRealm}; +use crate::network_listener::{self, PreInvoke, ResourceTimingListener, submit_timing_data}; +use crate::realms::{InRealm, enter_realm}; use crate::script_runtime::CanGc; struct FetchContext { diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs index 02862218e92..c69a4b3fad4 100644 --- a/components/script/layout_dom/element.rs +++ b/components/script/layout_dom/element.rs @@ -7,7 +7,7 @@ use std::sync::atomic::Ordering; use std::{fmt, slice}; use atomic_refcell::{AtomicRef, AtomicRefMut}; -use html5ever::{local_name, namespace_url, ns, LocalName, Namespace}; +use html5ever::{LocalName, Namespace, local_name, namespace_url, ns}; use js::jsapi::JSObject; use script_layout_interface::wrapper_traits::{ LayoutNode, PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, @@ -15,11 +15,12 @@ use script_layout_interface::wrapper_traits::{ use script_layout_interface::{LayoutNodeType, StyleData}; use script_traits::UntrustedNodeAddress; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; -use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK}; +use selectors::bloom::{BLOOM_HASH_MASK, BloomFilter}; use selectors::matching::{ElementSelectorFlags, MatchingContext, VisitedHandlingMode}; use selectors::sink::Push; use servo_arc::{Arc, ArcBorrow}; use servo_atoms::Atom; +use style::CaseSensitivityExt; use style::animation::AnimationSetKey; use style::applicable_declarations::ApplicableDeclarationBlock; use style::attr::AttrValue; @@ -29,14 +30,13 @@ use style::data::ElementData; use style::dom::{DomChildren, LayoutIterator, TDocument, TElement, TNode, TShadowRoot}; use style::properties::PropertyDeclarationBlock; use style::selector_parser::{ - extended_filtering, AttrValue as SelectorAttrValue, Lang, NonTSPseudoClass, PseudoElement, - SelectorImpl, + AttrValue as SelectorAttrValue, Lang, NonTSPseudoClass, PseudoElement, SelectorImpl, + extended_filtering, }; use style::shared_lock::Locked as StyleLocked; use style::stylesheets::scope_rule::ImplicitScopeRoot; use style::values::computed::Display; use style::values::{AtomIdent, AtomString}; -use style::CaseSensitivityExt; use style_dom::ElementState; use crate::dom::attr::AttrHelpersForLayout; diff --git a/components/script/messaging.rs b/components/script/messaging.rs index 1aeaeb8456f..17d6664e1cf 100644 --- a/components/script/messaging.rs +++ b/components/script/messaging.rs @@ -11,11 +11,11 @@ use std::result::Result; use base::id::PipelineId; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; -use crossbeam_channel::{select, Receiver, SendError, Sender}; +use crossbeam_channel::{Receiver, SendError, Sender, select}; use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg}; use ipc_channel::ipc::IpcSender; -use net_traits::image_cache::PendingImageResponse; use net_traits::FetchResponseMsg; +use net_traits::image_cache::PendingImageResponse; use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan}; use profile_traits::time::{self as profile_time}; use script_traits::{LayoutMsg, Painter, ScriptMsg, ScriptThreadMessage}; diff --git a/components/script/microtask.rs b/components/script/microtask.rs index 94a675d78c9..2c06250a145 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -24,7 +24,7 @@ use crate::dom::htmlimageelement::ImageElementMicrotask; use crate::dom::htmlmediaelement::MediaElementMicrotask; use crate::dom::mutationobserver::MutationObserver; use crate::realms::enter_realm; -use crate::script_runtime::{notify_about_rejected_promises, CanGc, JSContext}; +use crate::script_runtime::{CanGc, JSContext, notify_about_rejected_promises}; use crate::script_thread::ScriptThread; /// A collection of microtasks in FIFO order. diff --git a/components/script/navigation.rs b/components/script/navigation.rs index 83ce10998d0..160ce769ade 100644 --- a/components/script/navigation.rs +++ b/components/script/navigation.rs @@ -18,8 +18,8 @@ use net_traits::request::{ }; use net_traits::response::ResponseInit; use net_traits::{ - fetch_async, set_default_accept_language, BoxedFetchCallback, CoreResourceThread, - FetchResponseMsg, Metadata, DOCUMENT_ACCEPT_HEADER_VALUE, + BoxedFetchCallback, CoreResourceThread, DOCUMENT_ACCEPT_HEADER_VALUE, FetchResponseMsg, + Metadata, fetch_async, set_default_accept_language, }; use script_traits::{DocumentActivity, LoadData, WindowSizeData}; use servo_url::{MutableOrigin, ServoUrl}; diff --git a/components/script/script_module.rs b/components/script/script_module.rs index 8143014bc66..45dbc57499e 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -19,19 +19,19 @@ use indexmap::IndexSet; use js::jsapi::{ CompileModule1, ExceptionStackBehavior, FinishDynamicModuleImport, GetModuleRequestSpecifier, GetModuleResolveHook, GetRequestedModuleSpecifier, GetRequestedModulesCount, - Handle as RawHandle, HandleObject, HandleValue as RawHandleValue, Heap, JSAutoRealm, JSContext, - JSObject, JSRuntime, JSString, JS_ClearPendingException, JS_DefineProperty4, - JS_IsExceptionPending, JS_NewStringCopyN, ModuleErrorBehaviour, ModuleEvaluate, ModuleLink, - MutableHandleValue, SetModuleDynamicImportHook, SetModuleMetadataHook, SetModulePrivate, - SetModuleResolveHook, SetScriptPrivateReferenceHooks, ThrowOnModuleEvaluationFailure, Value, - JSPROP_ENUMERATE, + Handle as RawHandle, HandleObject, HandleValue as RawHandleValue, Heap, + JS_ClearPendingException, JS_DefineProperty4, JS_IsExceptionPending, JS_NewStringCopyN, + JSAutoRealm, JSContext, JSObject, JSPROP_ENUMERATE, JSRuntime, JSString, ModuleErrorBehaviour, + ModuleEvaluate, ModuleLink, MutableHandleValue, SetModuleDynamicImportHook, + SetModuleMetadataHook, SetModulePrivate, SetModuleResolveHook, SetScriptPrivateReferenceHooks, + ThrowOnModuleEvaluationFailure, Value, }; use js::jsval::{JSVal, PrivateValue, UndefinedValue}; use js::rust::jsapi_wrapped::JS_GetPendingException; use js::rust::wrappers::JS_SetPendingException; use js::rust::{ - transform_str_to_source_text, CompileOptionsWrapper, Handle, HandleObject as RustHandleObject, - HandleValue, IntoHandle, MutableHandleObject as RustMutableHandleObject, + CompileOptionsWrapper, Handle, HandleObject as RustHandleObject, HandleValue, IntoHandle, + MutableHandleObject as RustMutableHandleObject, transform_str_to_source_text, }; use mime::Mime; use net_traits::http_status::HttpStatus; @@ -50,7 +50,7 @@ use crate::document_loader::LoadType; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::conversions::jsstring_to_str; -use crate::dom::bindings::error::{report_pending_exception, Error, ErrorToJsval}; +use crate::dom::bindings::error::{Error, ErrorToJsval, report_pending_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::{DomGlobal, DomObject}; @@ -63,7 +63,7 @@ use crate::dom::dynamicmoduleowner::{DynamicModuleId, DynamicModuleOwner}; use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlscriptelement::{ - HTMLScriptElement, ScriptId, ScriptOrigin, ScriptType, SCRIPT_JS_MIMES, + HTMLScriptElement, SCRIPT_JS_MIMES, ScriptId, ScriptOrigin, ScriptType, }; use crate::dom::node::NodeTraits; use crate::dom::performanceresourcetiming::InitiatorType; @@ -72,7 +72,7 @@ use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; use crate::dom::window::Window; use crate::dom::worker::TrustedWorkerAddress; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; -use crate::realms::{enter_realm, AlreadyInRealm, InRealm}; +use crate::realms::{AlreadyInRealm, InRealm, enter_realm}; use crate::script_runtime::{CanGc, JSContext as SafeJSContext}; use crate::task::TaskBox; diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index ac16a79dda8..6ae5add2b96 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -11,7 +11,7 @@ use core::ffi::c_char; use std::cell::{Cell, LazyCell, RefCell}; use std::collections::HashSet; use std::ffi::CString; -use std::io::{stdout, Write}; +use std::io::{Write, stdout}; use std::ops::Deref; use std::os::raw::c_void; use std::rc::Rc; @@ -31,22 +31,22 @@ use js::jsapi::{ AsmJSOption, BuildIdCharVector, ContextOptionsRef, DisableIncrementalGC, Dispatchable as JSRunnable, Dispatchable_MaybeShuttingDown, GCDescription, GCOptions, GCProgress, GCReason, GetPromiseUserInputEventHandlingState, HandleObject, HandleString, Heap, - InitConsumeStreamCallback, InitDispatchToEventLoop, JSContext as RawJSContext, JSGCParamKey, - JSGCStatus, JSJitCompilerOption, JSObject, JSSecurityCallbacks, JSTracer, - JS_AddExtraGCRootsTracer, JS_InitDestroyPrincipalsCallback, JS_InitReadPrincipalsCallback, - JS_SetGCCallback, JS_SetGCParameter, JS_SetGlobalJitCompilerOption, - JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled, JS_SetSecurityCallbacks, - JobQueue, MimeType, PromiseRejectionHandlingState, PromiseUserInputEventHandlingState, - RuntimeCode, SetDOMCallbacks, SetGCSliceCallback, SetJobQueue, SetPreserveWrapperCallbacks, + InitConsumeStreamCallback, InitDispatchToEventLoop, JS_AddExtraGCRootsTracer, + JS_InitDestroyPrincipalsCallback, JS_InitReadPrincipalsCallback, JS_SetGCCallback, + JS_SetGCParameter, JS_SetGlobalJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, + JS_SetParallelParsingEnabled, JS_SetSecurityCallbacks, JSContext as RawJSContext, JSGCParamKey, + JSGCStatus, JSJitCompilerOption, JSObject, JSSecurityCallbacks, JSTracer, JobQueue, MimeType, + PromiseRejectionHandlingState, PromiseUserInputEventHandlingState, RuntimeCode, + SetDOMCallbacks, SetGCSliceCallback, SetJobQueue, SetPreserveWrapperCallbacks, SetProcessBuildIdOp, SetPromiseRejectionTrackerCallback, StreamConsumer as JSStreamConsumer, }; use js::jsval::UndefinedValue; use js::panic::wrap_panic; -use js::rust::wrappers::{GetPromiseIsHandled, JS_GetPromiseResult}; pub(crate) use js::rust::ThreadSafeJSContext; +use js::rust::wrappers::{GetPromiseIsHandled, JS_GetPromiseResult}; use js::rust::{ - describe_scripted_caller, Handle, HandleObject as RustHandleObject, IntoHandle, JSEngine, - JSEngineHandle, ParentRuntime, Runtime as RustRuntime, + Handle, HandleObject as RustHandleObject, IntoHandle, JSEngine, JSEngineHandle, ParentRuntime, + Runtime as RustRuntime, describe_scripted_caller, }; use malloc_size_of::MallocSizeOfOps; use malloc_size_of_derive::MallocSizeOf; @@ -59,15 +59,15 @@ use style::thread_state::{self, ThreadState}; use crate::body::BodyMixin; use crate::dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType; use crate::dom::bindings::codegen::Bindings::ResponseBinding::Response_Binding::ResponseMethods; +use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType; use crate::dom::bindings::conversions::{ get_dom_class, private_from_object, root_from_handleobject, }; -use crate::dom::bindings::error::{throw_dom_exception, Error}; +use crate::dom::bindings::error::{Error, throw_dom_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::{ - trace_refcounted_objects, LiveDOMReferences, Trusted, TrustedPromise, + LiveDOMReferences, Trusted, TrustedPromise, trace_refcounted_objects, }; use crate::dom::bindings::reflector::{DomGlobal, DomObject}; use crate::dom::bindings::root::trace_roots; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index e39518b0262..66889f94ad3 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -24,8 +24,8 @@ use std::default::Default; use std::option::Option; use std::rc::Rc; use std::result::Result; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::thread; use std::time::{Duration, Instant, SystemTime}; @@ -33,11 +33,11 @@ use background_hang_monitor_api::{ BackgroundHangMonitor, BackgroundHangMonitorExitSignal, HangAnnotation, MonitoredComponentId, MonitoredComponentType, }; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::{ BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespace, TopLevelBrowsingContextId, }; -use base::Epoch; use canvas_traits::webgl::WebGLPipeline; use chrono::{DateTime, Local}; use crossbeam_channel::unbounded; @@ -57,12 +57,12 @@ use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::glue::GetWindowProxyClass; use js::jsapi::{ - JSContext as UnsafeJSContext, JSTracer, JS_AddInterruptCallback, SetWindowProxyClass, + JS_AddInterruptCallback, JSContext as UnsafeJSContext, JSTracer, SetWindowProxyClass, }; use js::jsval::UndefinedValue; use js::rust::ParentRuntime; use media::WindowGLContext; -use metrics::{PaintTimeMetrics, MAX_TASK_NS}; +use metrics::{MAX_TASK_NS, PaintTimeMetrics}; use mime::{self, Mime}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; use net_traits::request::{Referrer, RequestId}; @@ -77,7 +77,7 @@ use profile_traits::mem::ReportsChan; use profile_traits::time::ProfilerCategory; use profile_traits::time_profile; use script_layout_interface::{ - node_id_from_scroll_id, LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory, + LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory, node_id_from_scroll_id, }; use script_traits::{ ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState, @@ -2726,11 +2726,13 @@ impl ScriptThread { let document = self.documents.borrow_mut().remove(id); if let Some(document) = document { // We should never have a pipeline that's still an incomplete load, but also has a Document. - debug_assert!(!self - .incomplete_loads - .borrow() - .iter() - .any(|load| load.pipeline_id == id)); + debug_assert!( + !self + .incomplete_loads + .borrow() + .iter() + .any(|load| load.pipeline_id == id) + ); if let Some(parser) = document.get_current_parser() { parser.abort(can_gc); diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs index 23723ca39df..7ad4204f9fb 100644 --- a/components/script/serviceworker_manager.rs +++ b/components/script/serviceworker_manager.rs @@ -8,12 +8,12 @@ //! active_workers map use std::collections::HashMap; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::thread::{self, JoinHandle}; use base::id::{PipelineNamespace, ServiceWorkerId, ServiceWorkerRegistrationId}; -use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; +use crossbeam_channel::{Receiver, RecvError, Sender, select, unbounded}; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use net_traits::{CoreResourceMsg, CustomResponseMediator}; diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 94e6aa299e6..2e150d2862e 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -43,7 +43,7 @@ use crate::fetch::create_a_potential_cors_request; use crate::network_listener::{self, PreInvoke, ResourceTimingListener}; use crate::script_runtime::CanGc; use crate::unminify::{ - create_output_file, create_temp_files, execute_js_beautify, BeautifyFileType, + BeautifyFileType, create_output_file, create_temp_files, execute_js_beautify, }; pub(crate) trait StylesheetOwner { diff --git a/components/script/task.rs b/components/script/task.rs index ce99731df79..7b166b9cc41 100644 --- a/components/script/task.rs +++ b/components/script/task.rs @@ -5,8 +5,8 @@ //! Machinery for [tasks](https://html.spec.whatwg.org/multipage/#concept-task). use std::fmt; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; macro_rules! task { ($name:ident: move || $body:tt) => {{ diff --git a/components/script/test.rs b/components/script/test.rs index 1ddaf7e64e8..c5933696efc 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -61,7 +61,7 @@ pub mod size_of { } pub mod srcset { - pub use crate::dom::htmlimageelement::{parse_a_srcset_attribute, Descriptor, ImageSource}; + pub use crate::dom::htmlimageelement::{Descriptor, ImageSource, parse_a_srcset_attribute}; } pub mod timeranges { @@ -71,7 +71,7 @@ pub mod timeranges { pub mod textinput { pub use crate::clipboard_provider::ClipboardProvider; pub use crate::textinput::{ - Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint, UTF16CodeUnits, - UTF8Bytes, + Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint, UTF8Bytes, + UTF16CodeUnits, }; } diff --git a/components/script/unminify.rs b/components/script/unminify.rs index 56d4251cb95..054b5017daf 100644 --- a/components/script/unminify.rs +++ b/components/script/unminify.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::env; -use std::fs::{create_dir_all, File}; +use std::fs::{File, create_dir_all}; use std::io::{Error, Read, Seek, Write}; use std::path::{Path, PathBuf}; use std::process::Command; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index cb2b381900a..c72dee18200 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -15,13 +15,13 @@ use euclid::default::{Point2D, Rect, Size2D}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{ - self, GetPropertyKeys, HandleValueArray, JSAutoRealm, JSContext, JSType, - JS_GetOwnPropertyDescriptorById, JS_GetPropertyById, JS_IsExceptionPending, PropertyDescriptor, + self, GetPropertyKeys, HandleValueArray, JS_GetOwnPropertyDescriptorById, JS_GetPropertyById, + JS_IsExceptionPending, JSAutoRealm, JSContext, JSType, PropertyDescriptor, }; use js::jsval::UndefinedValue; use js::rust::wrappers::{JS_CallFunctionName, JS_GetProperty, JS_HasOwnProperty, JS_TypeOfValue}; use js::rust::{HandleObject, HandleValue, IdVector}; -use net_traits::CookieSource::{NonHTTP, HTTP}; +use net_traits::CookieSource::{HTTP, NonHTTP}; use net_traits::CoreResourceMsg::{DeleteCookies, GetCookiesDataForUrl, SetCookieForUrl}; use net_traits::IpcSend; use servo_url::ServoUrl; @@ -41,10 +41,10 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, N use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::Bindings::XMLSerializerBinding::XMLSerializerMethods; use crate::dom::bindings::conversions::{ - get_property, get_property_jsval, is_array_like, jsid_to_string, root_from_object, ConversionBehavior, ConversionResult, FromJSValConvertible, StringificationBehavior, + get_property, get_property_jsval, is_array_like, jsid_to_string, root_from_object, }; -use crate::dom::bindings::error::{throw_dom_exception, Error}; +use crate::dom::bindings::error::{Error, throw_dom_exception}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::{DomGlobal, DomObject}; use crate::dom::bindings::root::DomRoot; diff --git a/components/script/window_named_properties.rs b/components/script/window_named_properties.rs index 55c2e57a4b4..a48a9ff6091 100644 --- a/components/script/window_named_properties.rs +++ b/components/script/window_named_properties.rs @@ -8,11 +8,12 @@ use std::sync::LazyLock; use js::conversions::jsstr_to_string; use js::glue::{AppendToIdVector, CreateProxyHandler, NewProxyObject, ProxyTraps}; use js::jsapi::{ - GetWellKnownSymbol, Handle, HandleId, HandleObject, JSClass, JSClass_NON_NATIVE, JSContext, - JSErrNum, JS_SetImmutablePrototype, MutableHandle, MutableHandleIdVector, MutableHandleObject, - ObjectOpResult, PropertyDescriptor, ProxyClassExtension, ProxyClassOps, ProxyObjectOps, - SymbolCode, UndefinedHandleValue, JSCLASS_DELAY_METADATA_BUILDER, JSCLASS_IS_PROXY, - JSCLASS_RESERVED_SLOTS_MASK, JSCLASS_RESERVED_SLOTS_SHIFT, JSPROP_READONLY, + GetWellKnownSymbol, Handle, HandleId, HandleObject, JS_SetImmutablePrototype, + JSCLASS_DELAY_METADATA_BUILDER, JSCLASS_IS_PROXY, JSCLASS_RESERVED_SLOTS_MASK, + JSCLASS_RESERVED_SLOTS_SHIFT, JSClass, JSClass_NON_NATIVE, JSContext, JSErrNum, + JSPROP_READONLY, MutableHandle, MutableHandleIdVector, MutableHandleObject, ObjectOpResult, + PropertyDescriptor, ProxyClassExtension, ProxyClassOps, ProxyObjectOps, SymbolCode, + UndefinedHandleValue, }; use js::jsid::SymbolId; use js::jsval::UndefinedValue; diff --git a/components/script/xpath/eval.rs b/components/script/xpath/eval.rs index e24bdbddcdb..9c95c3d8699 100644 --- a/components/script/xpath/eval.rs +++ b/components/script/xpath/eval.rs @@ -4,7 +4,7 @@ use std::fmt; -use html5ever::{local_name, namespace_prefix, namespace_url, ns, QualName}; +use html5ever::{QualName, local_name, namespace_prefix, namespace_url, ns}; use super::parser::{ AdditiveOp, Axis, EqualityOp, Expr, FilterExpr, KindTest, Literal, MultiplicativeOp, NodeTest, @@ -207,9 +207,9 @@ impl Evaluatable for PathExpr { }, (true, value) => { error!( - "Expected nodeset from step evaluation, got: {:?} node: {:?}, step: {:?}", - value, node, step - ); + "Expected nodeset from step evaluation, got: {:?} node: {:?}, step: {:?}", + value, node, step + ); return Ok(value); }, } @@ -462,8 +462,7 @@ impl Evaluatable for PredicateListExpr { matched_nodes = narrowed_nodes; trace!( "[PredicateListExpr] Predicate {:?} matched nodes {:?}", - predicate_expr, - matched_nodes + predicate_expr, matched_nodes ); } Ok(Value::Nodeset(matched_nodes)) diff --git a/components/script/xpath/eval_function.rs b/components/script/xpath/eval_function.rs index dce7f4d9ba8..caf0782c07b 100644 --- a/components/script/xpath/eval_function.rs +++ b/components/script/xpath/eval_function.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 https://mozilla.org/MPL/2.0/. */ +use super::Value; use super::context::EvaluationCtx; -use super::eval::{try_extract_nodeset, Error, Evaluatable}; +use super::eval::{Error, Evaluatable, try_extract_nodeset}; use super::parser::CoreFunction; -use super::Value; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::inheritance::{Castable, NodeTypeId}; use crate::dom::element::Element; diff --git a/components/script/xpath/mod.rs b/components/script/xpath/mod.rs index 337c5d3eab4..a48cb3fd27b 100644 --- a/components/script/xpath/mod.rs +++ b/components/script/xpath/mod.rs @@ -6,7 +6,7 @@ use context::EvaluationCtx; use eval::Evaluatable; pub(crate) use eval_value::{NodesetHelpers, Value}; use parser::OwnedParserError; -pub(crate) use parser::{parse as parse_impl, Expr}; +pub(crate) use parser::{Expr, parse as parse_impl}; use super::dom::node::Node; diff --git a/components/script_bindings/constant.rs b/components/script_bindings/constant.rs index 810c302fa8c..3e1be708b4f 100644 --- a/components/script_bindings/constant.rs +++ b/components/script_bindings/constant.rs @@ -9,8 +9,8 @@ use std::ffi::CStr; use js::jsapi::{JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY}; use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UInt32Value}; use js::rooted; -use js::rust::wrappers::JS_DefineProperty; use js::rust::HandleObject; +use js::rust::wrappers::JS_DefineProperty; use crate::script_runtime::JSContext; diff --git a/components/script_bindings/conversions.rs b/components/script_bindings/conversions.rs index 43754a61ab9..98998e170da 100644 --- a/components/script_bindings/conversions.rs +++ b/components/script_bindings/conversions.rs @@ -5,7 +5,7 @@ use std::{ptr, slice}; use js::conversions::{ - latin1_to_string, ConversionResult, FromJSValConvertible, ToJSValConvertible, + ConversionResult, FromJSValConvertible, ToJSValConvertible, latin1_to_string, }; use js::error::throw_type_error; use js::glue::{ @@ -13,13 +13,13 @@ use js::glue::{ JS_GetReservedSlot, UnwrapObjectDynamic, }; use js::jsapi::{ - JSContext, JSObject, JSString, JS_DeprecatedStringHasLatin1Chars, - JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength, JS_NewStringCopyN, + JS_DeprecatedStringHasLatin1Chars, JS_GetLatin1StringCharsAndLength, + JS_GetTwoByteStringCharsAndLength, JS_NewStringCopyN, JSContext, JSObject, JSString, }; use js::jsval::{ObjectValue, StringValue, UndefinedValue}; use js::rust::{ - get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, HandleValue, - MutableHandleValue, ToString, + HandleValue, MutableHandleValue, ToString, get_object_class, is_dom_class, is_dom_object, + maybe_wrap_value, }; use crate::inheritance::Castable; diff --git a/components/script_bindings/inheritance.rs b/components/script_bindings/inheritance.rs index d0ede1a42aa..5ddbf072215 100644 --- a/components/script_bindings/inheritance.rs +++ b/components/script_bindings/inheritance.rs @@ -6,7 +6,7 @@ use std::mem; -use crate::conversions::{get_dom_class, DerivedFrom, IDLInterface}; +use crate::conversions::{DerivedFrom, IDLInterface, get_dom_class}; use crate::reflector::DomObject; use crate::script_runtime::runtime_is_alive; diff --git a/components/script_bindings/weakref.rs b/components/script_bindings/weakref.rs index 9288ef5e589..38f4f709997 100644 --- a/components/script_bindings/weakref.rs +++ b/components/script_bindings/weakref.rs @@ -16,14 +16,14 @@ use std::ops::Drop; use std::{mem, ptr}; use js::glue::JS_GetReservedSlot; -use js::jsapi::{JSTracer, JS_SetReservedSlot}; +use js::jsapi::{JS_SetReservedSlot, JSTracer}; use js::jsval::{PrivateValue, UndefinedValue}; use libc::c_void; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; +use crate::JSTraceable; use crate::reflector::DomObject; use crate::root::DomRoot; -use crate::JSTraceable; /// The index of the slot wherein a pointer to the weak holder cell is /// stored for weak-referenceable bindings. We use slot 1 for holding it, @@ -70,8 +70,7 @@ pub trait WeakReferenceable: DomObject + Sized { let new_count = box_.count.get() + 1; trace!( "Incrementing WeakBox refcount for {:p} to {}.", - self, - new_count + self, new_count ); box_.count.set(new_count); WeakRef { diff --git a/components/servo/examples/winit_minimal.rs b/components/servo/examples/winit_minimal.rs index 5b16aaf5496..c4995a54224 100644 --- a/components/servo/examples/winit_minimal.rs +++ b/components/servo/examples/winit_minimal.rs @@ -12,8 +12,8 @@ use servo::{RenderingContext, Servo, TouchEventType, WebView, WindowRenderingCon use servo_geometry::DeviceIndependentPixel; use tracing::warn; use url::Url; -use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DevicePixel, LayoutVector2D}; use webrender_api::ScrollLocation; +use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DevicePixel, LayoutVector2D}; use winit::application::ApplicationHandler; use winit::dpi::{PhysicalPosition, PhysicalSize}; use winit::event::{MouseScrollDelta, WindowEvent}; diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 5261a6db087..4ea13e2ff82 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -38,8 +38,8 @@ use base::id::{PipelineNamespace, PipelineNamespaceId, WebViewId}; use bluetooth::BluetoothThreadFactory; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; -use canvas::canvas_paint_thread::CanvasPaintThread; use canvas::WebGLComm; +use canvas::canvas_paint_thread::CanvasPaintThread; use canvas_traits::webgl::{GlType, WebGLThreads}; use clipboard_delegate::StringRequest; use compositing::windowing::{EmbedderMethods, WindowMethods}; @@ -58,7 +58,7 @@ use constellation::{ Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState, UnprivilegedContent, }; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; pub use embedder_traits::*; use env_logger::Builder as EnvLoggerBuilder; use euclid::Scale; @@ -79,7 +79,7 @@ use ipc_channel::router::ROUTER; pub use keyboard_types::*; #[cfg(feature = "layout_2013")] pub use layout_thread_2013; -use log::{debug, warn, Log, Metadata, Record}; +use log::{Log, Metadata, Record, debug, warn}; use media::{GlApi, NativeDisplay, WindowGLContext}; use net::protocols::ProtocolRegistry; use net::resource_thread::new_resource_threads; @@ -92,14 +92,14 @@ use servo_config::opts::Opts; use servo_config::prefs::Preferences; use servo_config::{opts, pref, prefs}; use servo_delegate::DefaultServoDelegate; -use servo_media::player::context::GlContext; use servo_media::ServoMedia; +use servo_media::player::context::GlContext; use servo_url::ServoUrl; #[cfg(feature = "webgpu")] pub use webgpu; #[cfg(feature = "webgpu")] use webgpu::swapchain::WGPUImageMap; -use webrender::{RenderApiSender, ShaderPrecacheFlags, UploadMethod, ONE_TIME_USAGE_HINT}; +use webrender::{ONE_TIME_USAGE_HINT, RenderApiSender, ShaderPrecacheFlags, UploadMethod}; use webrender_api::{ColorF, DocumentId, FramePublishId}; pub use webrender_traits::rendering_context::{ OffscreenRenderingContext, RenderingContext, SoftwareRenderingContext, WindowRenderingContext, @@ -1246,9 +1246,9 @@ fn default_user_agent_string_for(agent: UserAgent) -> String { match agent { UserAgent::Desktop => desktop_ua_string, - UserAgent::Android => format!( - "Mozilla/5.0 (Android; Mobile; rv:128.0) Servo/{servo_version} Firefox/128.0" - ), + UserAgent::Android => { + format!("Mozilla/5.0 (Android; Mobile; rv:128.0) Servo/{servo_version} Firefox/128.0") + }, UserAgent::OpenHarmony => format!( "Mozilla/5.0 (OpenHarmony; Mobile; rv:128.0) Servo/{servo_version} Firefox/128.0" ), diff --git a/components/servo/proxies.rs b/components/servo/proxies.rs index 2d98bbdab6e..ff51b8b9b19 100644 --- a/components/servo/proxies.rs +++ b/components/servo/proxies.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 https://mozilla.org/MPL/2.0/. */ -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use compositing_traits::ConstellationMsg; use crossbeam_channel::{SendError, Sender}; diff --git a/components/servo/servo_delegate.rs b/components/servo/servo_delegate.rs index 3c2b9befaaa..5ddd1036735 100644 --- a/components/servo/servo_delegate.rs +++ b/components/servo/servo_delegate.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 https://mozilla.org/MPL/2.0/. */ -use crate::webview_delegate::{AllowOrDenyRequest, WebResourceLoad}; use crate::Servo; +use crate::webview_delegate::{AllowOrDenyRequest, WebResourceLoad}; #[derive(Clone, Copy, Debug, Hash, PartialEq)] pub enum ServoError { diff --git a/components/servo/webview.rs b/components/servo/webview.rs index 3e39d1db21a..ba60ccd6bdc 100644 --- a/components/servo/webview.rs +++ b/components/servo/webview.rs @@ -8,8 +8,8 @@ use std::rc::{Rc, Weak}; use std::time::Duration; use base::id::WebViewId; -use compositing::windowing::WebRenderDebugOption; use compositing::IOCompositor; +use compositing::windowing::WebRenderDebugOption; use compositing_traits::ConstellationMsg; use dpi::PhysicalSize; use embedder_traits::{ @@ -17,12 +17,12 @@ use embedder_traits::{ TraversalDirection, }; use url::Url; -use webrender_api::units::{DeviceIntPoint, DeviceRect}; use webrender_api::ScrollLocation; +use webrender_api::units::{DeviceIntPoint, DeviceRect}; +use crate::ConstellationProxy; use crate::clipboard_delegate::{ClipboardDelegate, DefaultClipboardDelegate}; use crate::webview_delegate::{DefaultWebViewDelegate, WebViewDelegate}; -use crate::ConstellationProxy; /// A handle to a Servo webview. If you clone this handle, it does not create a new webview, /// but instead creates a new handle to the webview. Once the last handle is dropped, Servo diff --git a/components/shared/compositing/constellation_msg.rs b/components/shared/compositing/constellation_msg.rs index dbf1f75b979..a07b943d7e6 100644 --- a/components/shared/compositing/constellation_msg.rs +++ b/components/shared/compositing/constellation_msg.rs @@ -6,8 +6,8 @@ use std::collections::HashMap; use std::fmt; use std::time::Duration; -use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId}; use base::Epoch; +use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId}; use embedder_traits::{ Cursor, InputEvent, MediaSessionActionType, Theme, TraversalDirection, WebDriverCommandMsg, }; diff --git a/components/shared/compositing/lib.rs b/components/shared/compositing/lib.rs index 38390ecef31..29700c0f1dc 100644 --- a/components/shared/compositing/lib.rs +++ b/components/shared/compositing/lib.rs @@ -8,8 +8,8 @@ mod constellation_msg; use std::fmt::{Debug, Error, Formatter}; -use base::id::{PipelineId, TopLevelBrowsingContextId}; use base::Epoch; +use base::id::{PipelineId, TopLevelBrowsingContextId}; pub use constellation_msg::ConstellationMsg; use crossbeam_channel::{Receiver, Sender}; use embedder_traits::{EventLoopWaker, MouseButton, MouseButtonAction}; diff --git a/components/shared/embedder/webdriver.rs b/components/shared/embedder/webdriver.rs index b312339c08a..1da996038a8 100644 --- a/components/shared/embedder/webdriver.rs +++ b/components/shared/embedder/webdriver.rs @@ -12,8 +12,8 @@ use euclid::default::Rect as UntypedRect; use euclid::{Rect, Size2D}; use hyper_serde::Serde; use ipc_channel::ipc::IpcSender; -use keyboard_types::webdriver::Event as WebDriverInputEvent; use keyboard_types::KeyboardEvent; +use keyboard_types::webdriver::Event as WebDriverInputEvent; use pixels::Image; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; diff --git a/components/shared/fonts/lib.rs b/components/shared/fonts/lib.rs index 9ba8d9425ee..fa55e40f655 100644 --- a/components/shared/fonts/lib.rs +++ b/components/shared/fonts/lib.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use malloc_size_of_derive::MallocSizeOf; -use range::{int_range_index, RangeIndex}; +use range::{RangeIndex, int_range_index}; use serde::{Deserialize, Serialize}; int_range_index! { diff --git a/components/shared/net/image_cache.rs b/components/shared/net/image_cache.rs index c98b52c20d4..abe0385c71a 100644 --- a/components/shared/net/image_cache.rs +++ b/components/shared/net/image_cache.rs @@ -13,8 +13,8 @@ use serde::{Deserialize, Serialize}; use servo_url::{ImmutableOrigin, ServoUrl}; use webrender_traits::CrossProcessCompositorApi; -use crate::request::CorsSettings; use crate::FetchResponseMsg; +use crate::request::CorsSettings; // ====================================================================== // Aux structs and enums. diff --git a/components/shared/net/lib.rs b/components/shared/net/lib.rs index b6c44cad75f..c2c447d503e 100644 --- a/components/shared/net/lib.rs +++ b/components/shared/net/lib.rs @@ -12,14 +12,14 @@ use std::thread; use base::cross_process_instant::CrossProcessInstant; use base::id::HistoryStateId; use cookie::Cookie; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use headers::{ContentType, HeaderMapExt, ReferrerPolicy as ReferrerPolicyHeader}; -use http::{header, Error as HttpError, HeaderMap, HeaderValue, StatusCode}; +use http::{Error as HttpError, HeaderMap, HeaderValue, StatusCode, header}; use hyper_serde::Serde; use hyper_util::client::legacy::Error as HyperError; +use ipc_channel::Error as IpcError; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use ipc_channel::Error as IpcError; use malloc_size_of::malloc_size_of_is_0; use malloc_size_of_derive::MallocSizeOf; use mime::Mime; diff --git a/components/shared/net/request.rs b/components/shared/net/request.rs index b3b61b5dafc..c7720af7517 100644 --- a/components/shared/net/request.rs +++ b/components/shared/net/request.rs @@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex}; use base::id::{PipelineId, WebViewId}; use content_security_policy::{self as csp}; -use http::header::{HeaderName, AUTHORIZATION}; +use http::header::{AUTHORIZATION, HeaderName}; use http::{HeaderMap, Method}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use malloc_size_of_derive::MallocSizeOf; diff --git a/components/shared/net/response.rs b/components/shared/net/response.rs index 3fdc786e511..06ca0687da2 100644 --- a/components/shared/net/response.rs +++ b/components/shared/net/response.rs @@ -4,8 +4,8 @@ //! The [Response](https://fetch.spec.whatwg.org/#responses) object //! resulting from a [fetch operation](https://fetch.spec.whatwg.org/#concept-fetch) -use std::sync::atomic::AtomicBool; use std::sync::Mutex; +use std::sync::atomic::AtomicBool; use headers::{ContentType, HeaderMapExt}; use http::HeaderMap; diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs index 7ccee71153e..eaf371f72ec 100644 --- a/components/shared/script/lib.rs +++ b/components/shared/script/lib.rs @@ -19,12 +19,12 @@ use std::fmt; use std::sync::Arc; use background_hang_monitor_api::BackgroundHangMonitorRegister; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::{ BlobId, BrowsingContextId, HistoryStateId, MessagePortId, PipelineId, PipelineNamespaceId, TopLevelBrowsingContextId, WebViewId, }; -use base::Epoch; use bitflags::bitflags; #[cfg(feature = "bluetooth")] use bluetooth_traits::BluetoothRequest; @@ -35,8 +35,8 @@ use embedder_traits::input_events::InputEvent; use embedder_traits::{MediaSessionActionType, Theme, WebDriverScriptCommand}; use euclid::{Rect, Scale, Size2D, UnknownUnit, Vector2D}; use http::{HeaderMap, Method}; -use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::Error as IpcError; +use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; use log::warn; use malloc_size_of::malloc_size_of_is_0; @@ -806,7 +806,9 @@ impl StructuredSerializedData { if self.ports.is_some() { // Not panicking only because this is called from the constellation. - warn!("Attempt to broadcast structured serialized data including ports(should never happen)."); + warn!( + "Attempt to broadcast structured serialized data including ports(should never happen)." + ); } StructuredSerializedData { diff --git a/components/shared/script/script_msg.rs b/components/shared/script/script_msg.rs index 42258f6f155..f6acdd921f2 100644 --- a/components/shared/script/script_msg.rs +++ b/components/shared/script/script_msg.rs @@ -5,27 +5,27 @@ use std::collections::{HashMap, VecDeque}; use std::fmt; +use base::Epoch; use base::id::{ BroadcastChannelRouterId, BrowsingContextId, HistoryStateId, MessagePortId, MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId, TopLevelBrowsingContextId, }; -use base::Epoch; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::{ EmbedderMsg, MediaSessionEvent, TouchEventType, TouchSequenceId, TraversalDirection, }; -use euclid::default::Size2D as UntypedSize2D; use euclid::Size2D; +use euclid::default::Size2D as UntypedSize2D; use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use net_traits::storage_thread::StorageType; use net_traits::CoreResourceMsg; +use net_traits::storage_thread::StorageType; use serde::{Deserialize, Serialize}; use servo_url::{ImmutableOrigin, ServoUrl}; use style_traits::CSSPixel; #[cfg(feature = "webgpu")] -use webgpu::{wgc, WebGPU, WebGPUResponse}; +use webgpu::{WebGPU, WebGPUResponse, wgc}; use crate::{ AnimationState, AuxiliaryWebViewCreationRequest, BroadcastMsg, DocumentState, diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs index c9ff5c7c47c..de70ae64df0 100644 --- a/components/shared/script_layout/lib.rs +++ b/components/shared/script_layout/lib.rs @@ -12,17 +12,17 @@ pub mod wrapper_traits; use std::any::Any; use std::borrow::Cow; -use std::sync::atomic::{AtomicIsize, AtomicU64, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicIsize, AtomicU64, Ordering}; use app_units::Au; use atomic_refcell::AtomicRefCell; +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::{BrowsingContextId, PipelineId, WebViewId}; -use base::Epoch; use canvas_traits::canvas::{CanvasId, CanvasMsg}; -use euclid::default::{Point2D, Rect}; use euclid::Size2D; +use euclid::default::{Point2D, Rect}; use fnv::FnvHashMap; use fonts::{FontContext, SystemFontServiceProxy}; use ipc_channel::ipc::IpcSender; @@ -39,18 +39,18 @@ use script_traits::{ use serde::{Deserialize, Serialize}; use servo_arc::Arc as ServoArc; use servo_url::{ImmutableOrigin, ServoUrl}; +use style::Atom; use style::animation::DocumentAnimationSet; use style::context::QuirksMode; use style::data::ElementData; use style::dom::OpaqueNode; use style::invalidation::element::restyle_hints::RestyleHint; use style::media_queries::Device; -use style::properties::style_structs::Font; use style::properties::PropertyId; +use style::properties::style_structs::Font; use style::queries::values::PrefersColorScheme; use style::selector_parser::{PseudoElement, RestyleDamage, Snapshot}; use style::stylesheets::Stylesheet; -use style::Atom; use style_traits::CSSPixel; use webrender_api::ImageKey; use webrender_traits::CrossProcessCompositorApi; diff --git a/components/shared/script_layout/wrapper_traits.rs b/components/shared/script_layout/wrapper_traits.rs index 5c8da0315b4..bc7939d8870 100644 --- a/components/shared/script_layout/wrapper_traits.rs +++ b/components/shared/script_layout/wrapper_traits.rs @@ -11,7 +11,7 @@ use std::sync::Arc as StdArc; use atomic_refcell::AtomicRef; use base::id::{BrowsingContextId, PipelineId}; use fonts_traits::ByteIndex; -use html5ever::{local_name, namespace_url, ns, LocalName, Namespace}; +use html5ever::{LocalName, Namespace, local_name, namespace_url, ns}; use pixels::{Image, ImageMetadata}; use range::Range; use servo_arc::Arc; @@ -323,10 +323,7 @@ pub trait ThreadSafeLayoutNode<'dom>: Clone + Copy + Debug + NodeInfo + PartialE pub trait ThreadSafeLayoutElement<'dom>: Clone + Copy + Sized + Debug + ::selectors::Element<Impl = SelectorImpl> { - type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode< - 'dom, - ConcreteThreadSafeLayoutElement = Self, - >; + type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom, ConcreteThreadSafeLayoutElement = Self>; /// This type alias is just a work-around to avoid writing /// diff --git a/components/shared/webrender/rendering_context.rs b/components/shared/webrender/rendering_context.rs index 955c256bc62..46d72917510 100644 --- a/components/shared/webrender/rendering_context.rs +++ b/components/shared/webrender/rendering_context.rs @@ -17,8 +17,8 @@ use glow::NativeFramebuffer; use image::RgbaImage; use log::{debug, trace, warn}; use raw_window_handle::{DisplayHandle, WindowHandle}; -use surfman::chains::{PreserveBuffer, SwapChain}; pub use surfman::Error; +use surfman::chains::{PreserveBuffer, SwapChain}; use surfman::{ Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device, GLApi, NativeContext, NativeWidget, Surface, SurfaceAccess, SurfaceInfo, SurfaceTexture, SurfaceType, diff --git a/components/shared/webxr/layer.rs b/components/shared/webxr/layer.rs index 904091f930f..29ded7b37ed 100644 --- a/components/shared/webxr/layer.rs +++ b/components/shared/webxr/layer.rs @@ -46,7 +46,7 @@ impl GLContexts<()> for () { pub trait LayerGrandManagerAPI<GL: GLTypes> { fn create_layer_manager(&self, factory: LayerManagerFactory<GL>) - -> Result<LayerManager, Error>; + -> Result<LayerManager, Error>; fn clone_layer_grand_manager(&self) -> LayerGrandManager<GL>; } diff --git a/components/shared/webxr/lib.rs b/components/shared/webxr/lib.rs index 563d1190c47..a539fd55457 100644 --- a/components/shared/webxr/lib.rs +++ b/components/shared/webxr/lib.rs @@ -37,11 +37,11 @@ pub use input::{ Handedness, InputFrame, InputId, InputSource, SelectEvent, SelectKind, TargetRayMode, }; #[cfg(feature = "ipc")] -pub use ipc_channel::ipc::channel as webxr_channel; -#[cfg(feature = "ipc")] pub use ipc_channel::ipc::IpcReceiver as WebXrReceiver; #[cfg(feature = "ipc")] pub use ipc_channel::ipc::IpcSender as WebXrSender; +#[cfg(feature = "ipc")] +pub use ipc_channel::ipc::channel as webxr_channel; pub use layer::{ ContextId, GLContexts, GLTypes, LayerGrandManager, LayerGrandManagerAPI, LayerId, LayerInit, LayerLayout, LayerManager, LayerManagerAPI, LayerManagerFactory, SubImage, SubImages, @@ -57,9 +57,9 @@ pub use session::{ }; pub use space::{ApiSpace, BaseSpace, Space}; pub use view::{ - Capture, CubeBack, CubeBottom, CubeLeft, CubeRight, CubeTop, Display, Floor, Input, LeftEye, - Native, RightEye, SomeEye, View, Viewer, Viewport, Viewports, Views, CUBE_BACK, CUBE_BOTTOM, - CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, LEFT_EYE, RIGHT_EYE, VIEWER, + CUBE_BACK, CUBE_BOTTOM, CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, Capture, CubeBack, CubeBottom, + CubeLeft, CubeRight, CubeTop, Display, Floor, Input, LEFT_EYE, LeftEye, Native, RIGHT_EYE, + RightEye, SomeEye, VIEWER, View, Viewer, Viewport, Viewports, Views, }; #[cfg(not(feature = "ipc"))] diff --git a/components/shared/webxr/session.rs b/components/shared/webxr/session.rs index 4809ff5f17b..9871dc64b49 100644 --- a/components/shared/webxr/session.rs +++ b/components/shared/webxr/session.rs @@ -11,9 +11,9 @@ use log::warn; use serde::{Deserialize, Serialize}; use crate::{ - webxr_channel, ContextId, DeviceAPI, Error, Event, Floor, Frame, FrameUpdateEvent, HitTestId, - HitTestSource, InputSource, LayerGrandManager, LayerId, LayerInit, Native, Viewport, Viewports, - WebXrReceiver, WebXrSender, + ContextId, DeviceAPI, Error, Event, Floor, Frame, FrameUpdateEvent, HitTestId, HitTestSource, + InputSource, LayerGrandManager, LayerId, LayerInit, Native, Viewport, Viewports, WebXrReceiver, + WebXrSender, webxr_channel, }; // How long to wait for an rAF. diff --git a/components/timers/lib.rs b/components/timers/lib.rs index 4527cc83265..2d2a1079c10 100644 --- a/components/timers/lib.rs +++ b/components/timers/lib.rs @@ -12,7 +12,7 @@ use std::collections::BinaryHeap; use std::time::{Duration, Instant}; use base::id::PipelineId; -use crossbeam_channel::{after, never, Receiver}; +use crossbeam_channel::{Receiver, after, never}; use malloc_size_of_derive::MallocSizeOf; use serde::{Deserialize, Serialize}; diff --git a/components/url/lib.rs b/components/url/lib.rs index 2dfed250962..447915f36f9 100644 --- a/components/url/lib.rs +++ b/components/url/lib.rs @@ -40,7 +40,9 @@ pub struct ServoUrl(#[ignore_malloc_size_of = "Arc"] Arc<Url>); impl ToShmem for ServoUrl { fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> to_shmem::Result<Self> { - unimplemented!("If servo wants to share stylesheets across processes, ToShmem for Url must be implemented") + unimplemented!( + "If servo wants to share stylesheets across processes, ToShmem for Url must be implemented" + ) } } diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 3e4c063351a..aa106886d32 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -21,7 +21,7 @@ use base64::Engine; use capabilities::ServoCapabilities; use compositing_traits::ConstellationMsg; use cookie::{CookieBuilder, Expiration}; -use crossbeam_channel::{after, select, unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, after, select, unbounded}; use embedder_traits::{ TraversalDirection, WebDriverCommandMsg, WebDriverCookieError, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue, WebDriverLoadStatus, @@ -38,7 +38,7 @@ use pixels::PixelFormat; use serde::de::{Deserializer, MapAccess, Visitor}; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; -use serde_json::{json, Value}; +use serde_json::{Value, json}; use servo_config::prefs::{self, PrefValue, Preferences}; use servo_url::ServoUrl; use style_traits::CSSPixel; @@ -581,9 +581,11 @@ impl Handler { ); processed.insert( "platformName".to_string(), - json!(servo_capabilities - .platform_name - .unwrap_or("unknown".to_string())), + json!( + servo_capabilities + .platform_name + .unwrap_or("unknown".to_string()) + ), ); processed.insert( "setWindowRect".to_string(), diff --git a/components/webgpu/ipc_messages/recv.rs b/components/webgpu/ipc_messages/recv.rs index 6355cb932a8..62399d87e21 100644 --- a/components/webgpu/ipc_messages/recv.rs +++ b/components/webgpu/ipc_messages/recv.rs @@ -9,8 +9,8 @@ use arrayvec::ArrayVec; use base::id::PipelineId; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; use serde::{Deserialize, Serialize}; -use webrender_api::units::DeviceIntSize; use webrender_api::ImageKey; +use webrender_api::units::DeviceIntSize; use wgc::binding_model::{ BindGroupDescriptor, BindGroupLayoutDescriptor, PipelineLayoutDescriptor, }; @@ -24,15 +24,15 @@ use wgc::pipeline::{ComputePipelineDescriptor, RenderPipelineDescriptor}; use wgc::resource::{ BufferDescriptor, SamplerDescriptor, TextureDescriptor, TextureViewDescriptor, }; +use wgpu_core::Label; use wgpu_core::command::{RenderPassColorAttachment, RenderPassDepthStencilAttachment}; use wgpu_core::id::AdapterId; -use wgpu_core::Label; pub use {wgpu_core as wgc, wgpu_types as wgt}; use crate::identity::*; use crate::render_commands::RenderCommand; use crate::swapchain::WebGPUContextId; -use crate::{Error, ErrorFilter, Mapping, WebGPUResponse, PRESENTATION_BUFFER_COUNT}; +use crate::{Error, ErrorFilter, Mapping, PRESENTATION_BUFFER_COUNT, WebGPUResponse}; #[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub struct ContextConfiguration { diff --git a/components/webgpu/swapchain.rs b/components/webgpu/swapchain.rs index 4fe6cb60e7f..78b0c2bbf7e 100644 --- a/components/webgpu/swapchain.rs +++ b/components/webgpu/swapchain.rs @@ -25,7 +25,7 @@ use wgpu_core::global::Global; use wgpu_core::id; use wgpu_core::resource::{BufferAccessError, BufferMapOperation}; -use crate::{wgt, ContextConfiguration, Error, WebGPUMsg}; +use crate::{ContextConfiguration, Error, WebGPUMsg, wgt}; pub const PRESENTATION_BUFFER_COUNT: usize = 10; const DEFAULT_IMAGE_FORMAT: ImageFormat = ImageFormat::RGBA8; diff --git a/components/webxr/glwindow/mod.rs b/components/webxr/glwindow/mod.rs index 5ef352d2ade..c11805c70ca 100644 --- a/components/webxr/glwindow/mod.rs +++ b/components/webxr/glwindow/mod.rs @@ -17,11 +17,11 @@ use surfman::{ }; use webxr_api::util::ClipPlanes; use webxr_api::{ - ContextId, DeviceAPI, DiscoveryAPI, Display, Error, Event, EventBuffer, Floor, Frame, - InputSource, LayerGrandManager, LayerId, LayerInit, LayerManager, Native, Quitter, Session, - SessionBuilder, SessionInit, SessionMode, SomeEye, View, Viewer, ViewerPose, Viewport, - Viewports, Views, WebXrSender, CUBE_BACK, CUBE_BOTTOM, CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, - LEFT_EYE, RIGHT_EYE, VIEWER, + CUBE_BACK, CUBE_BOTTOM, CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, ContextId, DeviceAPI, DiscoveryAPI, + Display, Error, Event, EventBuffer, Floor, Frame, InputSource, LEFT_EYE, LayerGrandManager, + LayerId, LayerInit, LayerManager, Native, Quitter, RIGHT_EYE, Session, SessionBuilder, + SessionInit, SessionMode, SomeEye, VIEWER, View, Viewer, ViewerPose, Viewport, Viewports, + Views, WebXrSender, }; use crate::{SurfmanGL, SurfmanLayerManager}; diff --git a/components/webxr/openxr/graphics_d3d11.rs b/components/webxr/openxr/graphics_d3d11.rs index 15a472a6c3e..a22df9f5bb1 100644 --- a/components/webxr/openxr/graphics_d3d11.rs +++ b/components/webxr/openxr/graphics_d3d11.rs @@ -6,7 +6,7 @@ use std::{mem, ptr}; use euclid::{Size2D, UnknownUnit}; use log::warn; -use openxr::d3d::{Requirements, SessionCreateInfoD3D11, D3D11}; +use openxr::d3d::{D3D11, Requirements, SessionCreateInfoD3D11}; use openxr::{ ExtensionSet, FormFactor, FrameStream, FrameWaiter, Graphics, Instance, Session, SystemId, }; @@ -15,14 +15,14 @@ use surfman::{ Error as SurfmanError, SurfaceTexture, }; use webxr_api::Error; +use winapi::Interface; use winapi::shared::winerror::{DXGI_ERROR_NOT_FOUND, S_OK}; use winapi::shared::{dxgi, dxgiformat}; use winapi::um::d3d11::ID3D11Texture2D; -use winapi::Interface; use wio::com::ComPtr; use crate::openxr::graphics::{GraphicsProvider, GraphicsProviderMethods}; -use crate::openxr::{create_instance, AppInfo}; +use crate::openxr::{AppInfo, create_instance}; pub type Backend = D3D11; diff --git a/components/webxr/openxr/input.rs b/components/webxr/openxr/input.rs index 0a940aff002..16335cc01a2 100644 --- a/components/webxr/openxr/input.rs +++ b/components/webxr/openxr/input.rs @@ -8,21 +8,21 @@ use std::mem::MaybeUninit; use euclid::RigidTransform3D; use log::debug; use openxr::sys::{ - HandJointLocationsEXT, HandJointsLocateInfoEXT, HandTrackingAimStateFB, - FB_HAND_TRACKING_AIM_EXTENSION_NAME, + FB_HAND_TRACKING_AIM_EXTENSION_NAME, HandJointLocationsEXT, HandJointsLocateInfoEXT, + HandTrackingAimStateFB, }; use openxr::{ - self, Action, ActionSet, Binding, FrameState, Graphics, Hand as HandEnum, HandJoint, - HandJointLocation, HandTracker, HandTrackingAimFlagsFB, Instance, Path, Posef, Session, Space, - SpaceLocationFlags, HAND_JOINT_COUNT, + self, Action, ActionSet, Binding, FrameState, Graphics, HAND_JOINT_COUNT, Hand as HandEnum, + HandJoint, HandJointLocation, HandTracker, HandTrackingAimFlagsFB, Instance, Path, Posef, + Session, Space, SpaceLocationFlags, }; use webxr_api::{ Finger, Hand, Handedness, Input, InputFrame, InputId, InputSource, JointFrame, Native, SelectEvent, TargetRayMode, Viewer, }; -use super::interaction_profiles::InteractionProfile; use super::IDENTITY_POSE; +use super::interaction_profiles::InteractionProfile; use crate::ext_string; use crate::openxr::interaction_profiles::INTERACTION_PROFILES; diff --git a/components/webxr/openxr/interaction_profiles.rs b/components/webxr/openxr/interaction_profiles.rs index c728e958748..8fae3da3e55 100644 --- a/components/webxr/openxr/interaction_profiles.rs +++ b/components/webxr/openxr/interaction_profiles.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 https://mozilla.org/MPL/2.0/. */ +use openxr::ExtensionSet; use openxr::sys::{ BD_CONTROLLER_INTERACTION_EXTENSION_NAME, EXT_HAND_INTERACTION_EXTENSION_NAME, EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME, EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME, @@ -10,7 +11,6 @@ use openxr::sys::{ HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME, META_TOUCH_CONTROLLER_PLUS_EXTENSION_NAME, ML_ML2_CONTROLLER_INTERACTION_EXTENSION_NAME, }; -use openxr::ExtensionSet; #[macro_export] macro_rules! ext_string { diff --git a/components/webxr/openxr/mod.rs b/components/webxr/openxr/mod.rs index 7c3da3fb74b..585752dffa8 100644 --- a/components/webxr/openxr/mod.rs +++ b/components/webxr/openxr/mod.rs @@ -34,8 +34,8 @@ use webxr_api::{ ViewerPose, Viewport, Viewports, Views, Visibility, WebXrSender, }; -use crate::gl_utils::GlClearer; use crate::SurfmanGL; +use crate::gl_utils::GlClearer; mod input; use input::OpenXRInput; diff --git a/ports/servoshell/desktop/accelerated_gl_media.rs b/ports/servoshell/desktop/accelerated_gl_media.rs index 1ee9011a48c..fe0267a5b2a 100644 --- a/ports/servoshell/desktop/accelerated_gl_media.rs +++ b/ports/servoshell/desktop/accelerated_gl_media.rs @@ -14,8 +14,8 @@ pub(crate) fn setup_gl_accelerated_media(_: RefMut<Device>, _: RefMut<Context>) #[cfg(all(target_os = "linux", not(target_env = "ohos")))] pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut<Context>) { - use servo::media::{GlContext, NativeDisplay}; use servo::Servo; + use servo::media::{GlContext, NativeDisplay}; use surfman::platform::generic::multi::connection::NativeConnection; use surfman::platform::generic::multi::context::NativeContext; @@ -43,8 +43,8 @@ pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut #[cfg(target_os = "windows")] pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut<Context>) { - use servo::media::{GlContext, NativeDisplay}; use servo::Servo; + use servo::media::{GlContext, NativeDisplay}; let api = api(&device, &context); let context = GlContext::Egl(device.native_context(&context).egl_context as usize); diff --git a/ports/servoshell/desktop/app_state.rs b/ports/servoshell/desktop/app_state.rs index e4fa041d1fc..71881d41059 100644 --- a/ports/servoshell/desktop/app_state.rs +++ b/ports/servoshell/desktop/app_state.rs @@ -14,8 +14,8 @@ use log::{error, info}; use servo::base::id::WebViewId; use servo::config::pref; use servo::ipc_channel::ipc::IpcSender; -use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize}; use servo::webrender_api::ScrollLocation; +use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize}; use servo::{ AllowOrDenyRequest, AuthenticationRequest, FilterPattern, GamepadHapticEffectType, LoadStatus, PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog, TouchEventType, WebView, @@ -27,7 +27,7 @@ use super::app::PumpResult; use super::dialog::Dialog; use super::gamepad::GamepadSupport; use super::keyutils::CMD_OR_CONTROL; -use super::window_trait::{WindowPortsMethods, LINE_HEIGHT}; +use super::window_trait::{LINE_HEIGHT, WindowPortsMethods}; use crate::prefs::ServoShellPreferences; pub(crate) enum AppState { diff --git a/ports/servoshell/desktop/cli.rs b/ports/servoshell/desktop/cli.rs index a77e20a5009..88de5086504 100644 --- a/ports/servoshell/desktop/cli.rs +++ b/ports/servoshell/desktop/cli.rs @@ -7,7 +7,7 @@ use std::{env, panic}; use crate::desktop::app::App; use crate::desktop::events_loop::EventsLoop; use crate::panic_hook; -use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult}; +use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments}; pub fn main() { crate::crash_handler::install(); diff --git a/ports/servoshell/desktop/egui_glue.rs b/ports/servoshell/desktop/egui_glue.rs index 6cc43ca3a66..78ccfdfae2d 100644 --- a/ports/servoshell/desktop/egui_glue.rs +++ b/ports/servoshell/desktop/egui_glue.rs @@ -36,8 +36,8 @@ use egui::{ViewportId, ViewportOutput}; use egui_glow::ShaderVersion; pub use egui_winit; -use egui_winit::winit; pub use egui_winit::EventResponse; +use egui_winit::winit; use winit::event_loop::ActiveEventLoop; /// Use [`egui`] from a [`glow`] app based on [`winit`]. diff --git a/ports/servoshell/desktop/headed_window.rs b/ports/servoshell/desktop/headed_window.rs index 74ea438118e..16492d355a9 100644 --- a/ports/servoshell/desktop/headed_window.rs +++ b/ports/servoshell/desktop/headed_window.rs @@ -19,8 +19,8 @@ use servo::compositing::windowing::{ }; use servo::servo_config::pref; use servo::servo_geometry::DeviceIndependentPixel; -use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel}; use servo::webrender_api::ScrollLocation; +use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel}; use servo::{ Cursor, ImeEvent, InputEvent, Key, KeyState, KeyboardEvent, MouseButton as ServoMouseButton, MouseButtonAction, MouseButtonEvent, MouseMoveEvent, OffscreenRenderingContext, @@ -40,8 +40,8 @@ use winit::window::Icon; use super::app_state::RunningAppState; use super::geometry::{winit_position_to_euclid_point, winit_size_to_euclid_size}; -use super::keyutils::{keyboard_event_from_winit, CMD_OR_ALT}; -use super::window_trait::{WindowPortsMethods, LINE_HEIGHT}; +use super::keyutils::{CMD_OR_ALT, keyboard_event_from_winit}; +use super::window_trait::{LINE_HEIGHT, WindowPortsMethods}; use crate::desktop::accelerated_gl_media::setup_gl_accelerated_media; use crate::desktop::keyutils::CMD_OR_CONTROL; use crate::prefs::ServoShellPreferences; diff --git a/ports/servoshell/desktop/minibrowser.rs b/ports/servoshell/desktop/minibrowser.rs index 3b6ccc42922..5eac3005048 100644 --- a/ports/servoshell/desktop/minibrowser.rs +++ b/ports/servoshell/desktop/minibrowser.rs @@ -11,8 +11,8 @@ use dpi::PhysicalSize; use egui::text::{CCursor, CCursorRange}; use egui::text_edit::TextEditState; use egui::{ - pos2, CentralPanel, Frame, Key, Label, Modifiers, PaintCallback, SelectableLabel, - TopBottomPanel, Vec2, + CentralPanel, Frame, Key, Label, Modifiers, PaintCallback, SelectableLabel, TopBottomPanel, + Vec2, pos2, }; use egui_glow::CallbackFn; use egui_winit::EventResponse; diff --git a/ports/servoshell/desktop/protocols/resource.rs b/ports/servoshell/desktop/protocols/resource.rs index 3a719193e8e..d75966f7e97 100644 --- a/ports/servoshell/desktop/protocols/resource.rs +++ b/ports/servoshell/desktop/protocols/resource.rs @@ -16,10 +16,10 @@ use headers::{ContentType, HeaderMapExt}; use net::fetch::methods::{DoneChannel, FetchContext}; use net::filemanager_thread::FILE_CHUNK_SIZE; use net::protocols::ProtocolHandler; +use net_traits::ResourceFetchTiming; use net_traits::filemanager_thread::RelativePos; use net_traits::request::Request; use net_traits::response::{Response, ResponseBody}; -use net_traits::ResourceFetchTiming; use tokio::sync::mpsc::unbounded_channel; #[derive(Default)] diff --git a/ports/servoshell/desktop/protocols/urlinfo.rs b/ports/servoshell/desktop/protocols/urlinfo.rs index a6efe5e57c4..4408ce47e52 100644 --- a/ports/servoshell/desktop/protocols/urlinfo.rs +++ b/ports/servoshell/desktop/protocols/urlinfo.rs @@ -8,10 +8,10 @@ use std::pin::Pin; use headers::{ContentType, HeaderMapExt}; use net::fetch::methods::{DoneChannel, FetchContext}; use net::protocols::ProtocolHandler; +use net_traits::ResourceFetchTiming; use net_traits::http_status::HttpStatus; use net_traits::request::Request; use net_traits::response::{Response, ResponseBody}; -use net_traits::ResourceFetchTiming; #[derive(Default)] pub struct UrlInfoProtocolHander {} diff --git a/ports/servoshell/desktop/window_trait.rs b/ports/servoshell/desktop/window_trait.rs index 4c7b794412a..678e5142f75 100644 --- a/ports/servoshell/desktop/window_trait.rs +++ b/ports/servoshell/desktop/window_trait.rs @@ -35,7 +35,7 @@ pub trait WindowPortsMethods: WindowMethods { fn set_title(&self, _title: &str) {} /// Request a new inner size for the window, not including external decorations. fn request_resize(&self, webview: &WebView, inner_size: DeviceIntSize) - -> Option<DeviceIntSize>; + -> Option<DeviceIntSize>; fn set_position(&self, _point: DeviceIntPoint) {} fn set_fullscreen(&self, _state: bool) {} fn set_cursor(&self, _cursor: Cursor) {} diff --git a/ports/servoshell/egl/android.rs b/ports/servoshell/egl/android.rs index 0f84dadfc14..3713c7c6f48 100644 --- a/ports/servoshell/egl/android.rs +++ b/ports/servoshell/egl/android.rs @@ -23,7 +23,7 @@ use servo::{ AlertResponse, LoadStatus, MediaSessionActionType, PermissionRequest, SimpleDialog, WebView, }; use simpleservo::{ - DeviceIntRect, EventLoopWaker, InitOptions, InputMethodType, MediaSessionPlaybackState, APP, + APP, DeviceIntRect, EventLoopWaker, InitOptions, InputMethodType, MediaSessionPlaybackState, }; use super::app_state::{Coordinates, RunningAppState}; diff --git a/ports/servoshell/egl/android/simpleservo.rs b/ports/servoshell/egl/android/simpleservo.rs index 1dd255402d9..6ef42c95789 100644 --- a/ports/servoshell/egl/android/simpleservo.rs +++ b/ports/servoshell/egl/android/simpleservo.rs @@ -8,12 +8,12 @@ use std::rc::Rc; use dpi::PhysicalSize; use raw_window_handle::{DisplayHandle, RawDisplayHandle, RawWindowHandle, WindowHandle}; -pub use servo::webrender_api::units::DeviceIntRect; /// The EventLoopWaker::wake function will be called from any thread. /// It will be called to notify embedder that some events are available, /// and that perform_updates need to be called pub use servo::EventLoopWaker; -use servo::{self, resources, Servo}; +pub use servo::webrender_api::units::DeviceIntRect; +use servo::{self, Servo, resources}; pub use servo::{InputMethodType, MediaSessionPlaybackState, WindowRenderingContext}; use crate::egl::android::resources::ResourceReaderInstance; @@ -21,7 +21,7 @@ use crate::egl::app_state::{ Coordinates, RunningAppState, ServoEmbedderCallbacks, ServoWindowCallbacks, }; use crate::egl::host_trait::HostTrait; -use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult}; +use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments}; thread_local! { pub static APP: RefCell<Option<Rc<RunningAppState>>> = const { RefCell::new(None) }; diff --git a/ports/servoshell/egl/app_state.rs b/ports/servoshell/egl/app_state.rs index d7b2e0a5333..bc3ea56a708 100644 --- a/ports/servoshell/egl/app_state.rs +++ b/ports/servoshell/egl/app_state.rs @@ -16,8 +16,8 @@ use servo::compositing::windowing::{ }; use servo::euclid::{Box2D, Point2D, Rect, Scale, Size2D, Vector2D}; use servo::servo_geometry::DeviceIndependentPixel; -use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize, DevicePixel}; use servo::webrender_api::ScrollLocation; +use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize, DevicePixel}; use servo::{ AllowOrDenyRequest, ContextMenuResult, EmbedderProxy, EventLoopWaker, ImeEvent, InputEvent, InputMethodType, Key, KeyState, KeyboardEvent, LoadStatus, MediaSessionActionType, diff --git a/ports/servoshell/egl/log.rs b/ports/servoshell/egl/log.rs index db21de6d14c..86c86356a52 100644 --- a/ports/servoshell/egl/log.rs +++ b/ports/servoshell/egl/log.rs @@ -63,7 +63,9 @@ pub(crate) fn redirect_stdout_and_stderr() -> Result<(), LogRedirectError> { Ok(bytes) => bytes + cursor, Err(nix::errno::Errno::EINTR) => continue, Err(e) => { - error!("Failed to read from redirected stdout/stderr pipe due to {e:?}. Closing log thread"); + error!( + "Failed to read from redirected stdout/stderr pipe due to {e:?}. Closing log thread" + ); return; }, }; diff --git a/ports/servoshell/egl/ohos.rs b/ports/servoshell/egl/ohos.rs index ebaab2c4d33..b40657925bc 100644 --- a/ports/servoshell/egl/ohos.rs +++ b/ports/servoshell/egl/ohos.rs @@ -7,13 +7,13 @@ use std::cell::RefCell; use std::mem::MaybeUninit; use std::os::raw::c_void; use std::sync::mpsc::{Receiver, Sender}; -use std::sync::{mpsc, Once, OnceLock}; +use std::sync::{Once, OnceLock, mpsc}; use std::thread; use std::thread::sleep; use std::time::Duration; use keyboard_types::Key; -use log::{debug, error, info, trace, warn, LevelFilter}; +use log::{LevelFilter, debug, error, info, trace, warn}; use napi_derive_ohos::{module_exports, napi}; use napi_ohos::bindgen_prelude::Function; use napi_ohos::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode}; diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs index 77719eaa5f8..c4ccec07fce 100644 --- a/ports/servoshell/egl/ohos/simpleservo.rs +++ b/ports/servoshell/egl/ohos/simpleservo.rs @@ -17,16 +17,16 @@ use raw_window_handle::{ /// It will be called to notify embedder that some events are available, /// and that perform_updates need to be called pub use servo::EventLoopWaker; -use servo::{self, resources, Servo, WindowRenderingContext}; +use servo::{self, Servo, WindowRenderingContext, resources}; use xcomponent_sys::OH_NativeXComponent; use crate::egl::app_state::{ Coordinates, RunningAppState, ServoEmbedderCallbacks, ServoWindowCallbacks, }; use crate::egl::host_trait::HostTrait; -use crate::egl::ohos::resources::ResourceReaderInstance; use crate::egl::ohos::InitOpts; -use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult}; +use crate::egl::ohos::resources::ResourceReaderInstance; +use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments}; /// Initialize Servo. At that point, we need a valid GL context. /// In the future, this will be done in multiple steps. diff --git a/ports/servoshell/prefs.rs b/ports/servoshell/prefs.rs index 1aba21e267b..3b433d5beb7 100644 --- a/ports/servoshell/prefs.rs +++ b/ports/servoshell/prefs.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::collections::HashMap; -use std::fs::{read_to_string, File}; +use std::fs::{File, read_to_string}; use std::io::Read; use std::path::{Path, PathBuf}; #[cfg(any(target_os = "android", target_env = "ohos"))] diff --git a/rustfmt.toml b/rustfmt.toml index ecd1b1465d0..0bb4f6d7f0c 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,3 @@ match_block_trailing_comma = true reorder_imports = true +style_edition = "2024" diff --git a/tests/unit/metrics/paint_time.rs b/tests/unit/metrics/paint_time.rs index 3da7f86dcf0..e39319da397 100644 --- a/tests/unit/metrics/paint_time.rs +++ b/tests/unit/metrics/paint_time.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 https://mozilla.org/MPL/2.0/. */ +use base::Epoch; use base::cross_process_instant::CrossProcessInstant; use base::id::TEST_PIPELINE_ID; -use base::Epoch; use ipc_channel::ipc; use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric}; use profile_traits::time::{ProfilerChan, TimerMetadata}; diff --git a/tests/unit/script/headers.rs b/tests/unit/script/headers.rs index 6bf1da0df3a..530559af7ff 100644 --- a/tests/unit/script/headers.rs +++ b/tests/unit/script/headers.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use script::test::{normalize_value, ByteString}; +use script::test::{ByteString, normalize_value}; #[test] fn test_normalize_empty_bytestring() { diff --git a/tests/unit/script/htmlimageelement.rs b/tests/unit/script/htmlimageelement.rs index 48fb0b691a6..d8eaadaa0cd 100644 --- a/tests/unit/script/htmlimageelement.rs +++ b/tests/unit/script/htmlimageelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use script::test::srcset::{parse_a_srcset_attribute, Descriptor, ImageSource}; +use script::test::srcset::{Descriptor, ImageSource, parse_a_srcset_attribute}; #[test] fn no_value() { diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 7822dbd785e..ad938475690 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -8,11 +8,11 @@ // except according to those terms. use keyboard_types::{Key, Modifiers}; +use script::test::DOMString; use script::test::textinput::{ ClipboardProvider, Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint, - UTF16CodeUnits, UTF8Bytes, + UTF8Bytes, UTF16CodeUnits, }; -use script::test::DOMString; pub struct DummyClipboardContext { content: String, @@ -104,8 +104,8 @@ fn test_textinput_when_inserting_multiple_lines_still_respects_max_length() { } #[test] -fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_selection_dont_insert_anything( -) { +fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_selection_dont_insert_anything() + { let mut textinput = TextInput::new( Lines::Single, DOMString::from("abc"), @@ -121,8 +121,8 @@ fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_s } #[test] -fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_when_input_spans_lines( -) { +fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_when_input_spans_lines() + { let mut textinput = TextInput::new( Lines::Multiple, DOMString::from("abc\nd"), @@ -138,8 +138,8 @@ fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_wh } #[test] -fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_when_replacing_a_selection( -) { +fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_when_replacing_a_selection() + { let mut textinput = TextInput::new( Lines::Single, DOMString::from("abcde"), @@ -238,8 +238,8 @@ fn test_single_line_textinput_with_max_length_inside_char() { } #[test] -fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_after_max_length_is_reached( -) { +fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_after_max_length_is_reached() + { let mut textinput = TextInput::new( Lines::Single, DOMString::from("a"), diff --git a/tests/unit/style/animated_properties.rs b/tests/unit/style/animated_properties.rs index cf7c9ac8c9a..2d07cc59e74 100644 --- a/tests/unit/style/animated_properties.rs +++ b/tests/unit/style/animated_properties.rs @@ -3,8 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use style::color::{AbsoluteColor, ColorSpace}; -use style::properties::style_structs::Font; use style::properties::ComputedValues; +use style::properties::style_structs::Font; use style::values::animated::{Animate, Context, Procedure, ToAnimatedValue}; fn interpolate_color(from: AbsoluteColor, to: AbsoluteColor, progress: f64) -> AbsoluteColor { diff --git a/tests/unit/style/attr.rs b/tests/unit/style/attr.rs index 9bcfa2be522..37d5d193ac8 100644 --- a/tests/unit/style/attr.rs +++ b/tests/unit/style/attr.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use style::attr::{parse_length, AttrValue, LengthOrPercentageOrAuto}; +use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_length}; #[test] fn test_parse_double() { diff --git a/tests/unit/style/custom_properties.rs b/tests/unit/style/custom_properties.rs index 138da39454f..4556e930d02 100644 --- a/tests/unit/style/custom_properties.rs +++ b/tests/unit/style/custom_properties.rs @@ -19,9 +19,9 @@ use style::queries::values::PrefersColorScheme; use style::rule_cache::RuleCacheConditions; use style::rule_tree::CascadeLevel; use style::servo::media_queries::FontMetricsProvider; +use style::stylesheets::UrlExtraData; use style::stylesheets::container_rule::ContainerSizeQuery; use style::stylesheets::layer_rule::LayerOrder; -use style::stylesheets::UrlExtraData; use style::stylist::Stylist; use style::values::computed::font::GenericFontFamily; use style::values::computed::{Context, Length}; diff --git a/tests/unit/style/parsing/background.rs b/tests/unit/style/parsing/background.rs index c9ddb5a73d5..f677a2be7d7 100644 --- a/tests/unit/style/parsing/background.rs +++ b/tests/unit/style/parsing/background.rs @@ -110,8 +110,7 @@ fn background_shorthand_should_parse_when_some_fields_set() { #[test] fn background_shorthand_should_parse_comma_separated_declarations() { - let input = - "url(\"http://servo/test.png\") top left no-repeat, url(\"http://servo/test.png\") \ + let input = "url(\"http://servo/test.png\") top left no-repeat, url(\"http://servo/test.png\") \ center / 100% 100% no-repeat, white"; let result = parse(background::parse_value, input).unwrap(); diff --git a/tests/unit/style/parsing/border.rs b/tests/unit/style/parsing/border.rs index cdd45d022bd..56bd8e8fee0 100644 --- a/tests/unit/style/parsing/border.rs +++ b/tests/unit/style/parsing/border.rs @@ -3,12 +3,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use style::parser::Parse; +use style::properties::MaybeBoxed; use style::properties::longhands::{ border_image_outset, border_image_repeat, border_image_slice, border_image_source, border_image_width, }; use style::properties::shorthands::border_image; -use style::properties::MaybeBoxed; use style::values::specified::BorderRadius; use style_traits::ToCss; diff --git a/tests/unit/style/parsing/inherited_text.rs b/tests/unit/style/parsing/inherited_text.rs index d38da02515e..afe63cd1f30 100644 --- a/tests/unit/style/parsing/inherited_text.rs +++ b/tests/unit/style/parsing/inherited_text.rs @@ -9,8 +9,8 @@ use crate::parsing::parse; #[test] fn negative_letter_spacing_should_parse_properly() { use style::properties::longhands::letter_spacing; - use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength}; use style::values::specified::LetterSpacing; + use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength}; let negative_value = parse_longhand!(letter_spacing, "-0.5em"); let expected = LetterSpacing(Spacing::Value(LengthPercentage::Length( @@ -22,8 +22,8 @@ fn negative_letter_spacing_should_parse_properly() { #[test] fn negative_word_spacing_should_parse_properly() { use style::properties::longhands::word_spacing; - use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength}; use style::values::specified::WordSpacing; + use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength}; let negative_value = parse_longhand!(word_spacing, "-0.5em"); let expected = WordSpacing(Spacing::Value(LengthPercentage::Length( diff --git a/tests/unit/style/parsing/transition_timing_function.rs b/tests/unit/style/parsing/transition_timing_function.rs index 5dd022f7093..39c3127e2a3 100644 --- a/tests/unit/style/parsing/transition_timing_function.rs +++ b/tests/unit/style/parsing/transition_timing_function.rs @@ -23,21 +23,27 @@ fn test_cubic_bezier() { ); // p1x and p2x values must be in range [0, 1] - assert!(parse( - transition_timing_function::parse, - "cubic-bezier(-1, 0, 0, 0" - ) - .is_err()); - assert!(parse( - transition_timing_function::parse, - "cubic-bezier(0, 0, -1, 0" - ) - .is_err()); - assert!(parse( - transition_timing_function::parse, - "cubic-bezier(-1, 0, -1, 0" - ) - .is_err()); + assert!( + parse( + transition_timing_function::parse, + "cubic-bezier(-1, 0, 0, 0" + ) + .is_err() + ); + assert!( + parse( + transition_timing_function::parse, + "cubic-bezier(0, 0, -1, 0" + ) + .is_err() + ); + assert!( + parse( + transition_timing_function::parse, + "cubic-bezier(-1, 0, -1, 0" + ) + .is_err() + ); assert!(parse(transition_timing_function::parse, "cubic-bezier(2, 0, 0, 0").is_err()); assert!(parse(transition_timing_function::parse, "cubic-bezier(0, 0, 2, 0").is_err()); diff --git a/tests/unit/style/rule_tree/bench.rs b/tests/unit/style/rule_tree/bench.rs index b288d7402f9..cf80d249f0e 100644 --- a/tests/unit/style/rule_tree/bench.rs +++ b/tests/unit/style/rule_tree/bench.rs @@ -9,7 +9,7 @@ use style::applicable_declarations::CascadePriority; use style::context::QuirksMode; use style::error_reporting::{ContextualParseError, ParseErrorReporter}; use style::media_queries::MediaList; -use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock}; +use style::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, longhands}; use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource}; use style::shared_lock::{SharedRwLock, StylesheetGuards}; use style::stylesheets::layer_rule::LayerOrder; diff --git a/tests/unit/style/stylist.rs b/tests/unit/style/stylist.rs index 0eaa02e382d..b7d9a4cbc77 100644 --- a/tests/unit/style/stylist.rs +++ b/tests/unit/style/stylist.rs @@ -12,7 +12,7 @@ use style::font_metrics::FontMetrics; use style::media_queries::{Device, MediaType}; use style::properties::style_structs::Font; use style::properties::{ - longhands, ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock, + ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock, longhands, }; use style::queries::values::PrefersColorScheme; use style::rule_tree::StyleSource; @@ -22,11 +22,11 @@ use style::servo::media_queries::FontMetricsProvider; use style::shared_lock::SharedRwLock; use style::stylesheets::StyleRule; use style::stylist::{ - needs_revalidation_for_testing, ContainerConditionId, LayerId, Rule, ScopeConditionId, Stylist, + ContainerConditionId, LayerId, Rule, ScopeConditionId, Stylist, needs_revalidation_for_testing, }; use style::thread_state::{self, ThreadState}; -use style::values::computed::font::GenericFontFamily; use style::values::computed::Length; +use style::values::computed::font::GenericFontFamily; use url::Url; #[derive(Debug)] @@ -242,10 +242,12 @@ fn test_insert() { .unwrap()[0] .source_order ); - assert!(selector_map - .class_hash - .get(&Atom::from("intro"), QuirksMode::NoQuirks) - .is_none()); + assert!( + selector_map + .class_hash + .get(&Atom::from("intro"), QuirksMode::NoQuirks) + .is_none() + ); } fn mock_stylist() -> Stylist { diff --git a/third_party/blurmac/src/adapter.rs b/third_party/blurmac/src/adapter.rs index dce2927f4a2..e51b90345a1 100644 --- a/third_party/blurmac/src/adapter.rs +++ b/third_party/blurmac/src/adapter.rs @@ -11,7 +11,7 @@ use std::os::raw::c_int; use delegate::bm; use framework::{cb, io, ns}; use objc::runtime::{Object, YES}; -use utils::{nsx, NOT_SUPPORTED_ERROR}; +use utils::{NOT_SUPPORTED_ERROR, nsx}; #[derive(Clone, Debug)] pub struct BluetoothAdapter { diff --git a/third_party/blurmac/src/delegate.rs b/third_party/blurmac/src/delegate.rs index 6ba36d1c846..2b97e577dd8 100644 --- a/third_party/blurmac/src/delegate.rs +++ b/third_party/blurmac/src/delegate.rs @@ -11,7 +11,7 @@ use std::sync::Once; use framework::{cb, nil, ns}; use objc::declare::ClassDecl; use objc::runtime::{Class, Object, Protocol, Sel}; -use utils::{cbx, nsx, wait, NO_PERIPHERAL_FOUND}; +use utils::{NO_PERIPHERAL_FOUND, cbx, nsx, wait}; pub mod bm { use super::*; diff --git a/third_party/blurmac/src/device.rs b/third_party/blurmac/src/device.rs index 666cd0d66c6..04c48712b2e 100644 --- a/third_party/blurmac/src/device.rs +++ b/third_party/blurmac/src/device.rs @@ -13,7 +13,7 @@ use adapter::BluetoothAdapter; use delegate::{bm, bmx}; use framework::{cb, nil, ns}; use objc::runtime::Object; -use utils::{cbx, nsx, wait, NOT_SUPPORTED_ERROR, NO_PERIPHERAL_FOUND}; +use utils::{NO_PERIPHERAL_FOUND, NOT_SUPPORTED_ERROR, cbx, nsx, wait}; #[derive(Clone, Debug)] pub struct BluetoothDevice { diff --git a/third_party/blurmac/src/framework.rs b/third_party/blurmac/src/framework.rs index 23f429a422c..e24c19ef15c 100644 --- a/third_party/blurmac/src/framework.rs +++ b/third_party/blurmac/src/framework.rs @@ -7,7 +7,7 @@ use std::os::raw::{c_char, c_int, c_uint}; -use objc::runtime::{Class, Object, BOOL}; +use objc::runtime::{BOOL, Class, Object}; #[allow(non_upper_case_globals)] pub const nil: *mut Object = 0 as *mut Object; diff --git a/third_party/blurmac/src/gatt_characteristic.rs b/third_party/blurmac/src/gatt_characteristic.rs index 0a8749e07f3..bb2d95097d7 100644 --- a/third_party/blurmac/src/gatt_characteristic.rs +++ b/third_party/blurmac/src/gatt_characteristic.rs @@ -13,8 +13,8 @@ use std::sync::Arc; use delegate::bmx; use framework::{cb, nil, ns}; use gatt_service::BluetoothGATTService; -use objc::runtime::{Object, NO, YES}; -use utils::{cbx, wait, NOT_SUPPORTED_ERROR, NO_CHARACTERISTIC_FOUND}; +use objc::runtime::{NO, Object, YES}; +use utils::{NO_CHARACTERISTIC_FOUND, NOT_SUPPORTED_ERROR, cbx, wait}; #[derive(Clone, Debug)] pub struct BluetoothGATTCharacteristic { diff --git a/third_party/blurmac/src/gatt_service.rs b/third_party/blurmac/src/gatt_service.rs index 9c4f86327ea..cc46544d1e4 100644 --- a/third_party/blurmac/src/gatt_service.rs +++ b/third_party/blurmac/src/gatt_service.rs @@ -12,7 +12,7 @@ use delegate::bmx; use device::BluetoothDevice; use framework::{cb, nil, ns}; use objc::runtime::Object; -use utils::{cbx, wait, NO_SERVICE_FOUND}; +use utils::{NO_SERVICE_FOUND, cbx, wait}; #[derive(Clone, Debug)] pub struct BluetoothGATTService { |