aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-08 14:11:31 +0200
committerGitHub <noreply@github.com>2023-09-08 12:11:31 +0000
commit711dbbd4afe161fc334db198357d814e99e5ac57 (patch)
tree5c0e3a6a18dd26c9e39a47a790c6ec36f0ff8d4d /components
parenta0cff6a0858e675b805a71238ab96fa295a271f8 (diff)
downloadservo-711dbbd4afe161fc334db198357d814e99e5ac57.tar.gz
servo-711dbbd4afe161fc334db198357d814e99e5ac57.zip
remove `extern crate` (#30311)
* remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components')
-rw-r--r--components/background_hang_monitor/background_hang_monitor.rs3
-rw-r--r--components/background_hang_monitor/lib.rs5
-rw-r--r--components/background_hang_monitor/tests/hang_monitor_tests.rs5
-rw-r--r--components/bluetooth/lib.rs7
-rw-r--r--components/bluetooth_traits/lib.rs4
-rw-r--r--components/bluetooth_traits/scanfilter.rs2
-rw-r--r--components/canvas/canvas_data.rs1
-rw-r--r--components/canvas/canvas_paint_thread.rs1
-rw-r--r--components/canvas/lib.rs5
-rw-r--r--components/canvas/raqote_backend.rs1
-rw-r--r--components/canvas/webgl_mode/inprocess.rs1
-rw-r--r--components/canvas/webgl_thread.rs2
-rw-r--r--components/canvas_traits/canvas.rs2
-rw-r--r--components/canvas_traits/lib.rs7
-rw-r--r--components/canvas_traits/webgl.rs3
-rw-r--r--components/canvas_traits/webgl_channel/mod.rs1
-rw-r--r--components/compositing/compositor.rs2
-rw-r--r--components/compositing/lib.rs3
-rw-r--r--components/compositing/touch.rs1
-rw-r--r--components/compositing_traits/lib.rs4
-rw-r--r--components/config/lib.rs8
-rw-r--r--components/config/opts.rs5
-rw-r--r--components/config/pref_util.rs1
-rw-r--r--components/config/prefs.rs2
-rw-r--r--components/config/tests/prefs.rs4
-rw-r--r--components/constellation/browsingcontext.rs1
-rw-r--r--components/constellation/constellation.rs3
-rw-r--r--components/constellation/lib.rs7
-rw-r--r--components/constellation/logging.rs2
-rw-r--r--components/constellation/network_listener.rs1
-rw-r--r--components/constellation/pipeline.rs2
-rw-r--r--components/constellation/sandboxing.rs5
-rw-r--r--components/constellation/serviceworker.rs1
-rw-r--r--components/constellation/session_history.rs1
-rw-r--r--components/devtools/actor.rs1
-rw-r--r--components/devtools/actors/browsing_context.rs1
-rw-r--r--components/devtools/actors/console.rs2
-rw-r--r--components/devtools/actors/device.rs1
-rw-r--r--components/devtools/actors/inspector.rs1
-rw-r--r--components/devtools/actors/memory.rs1
-rw-r--r--components/devtools/actors/network_event.rs1
-rw-r--r--components/devtools/actors/performance.rs1
-rw-r--r--components/devtools/actors/preference.rs1
-rw-r--r--components/devtools/actors/process.rs1
-rw-r--r--components/devtools/actors/root.rs1
-rw-r--r--components/devtools/actors/stylesheets.rs1
-rw-r--r--components/devtools/actors/tab.rs1
-rw-r--r--components/devtools/actors/thread.rs1
-rw-r--r--components/devtools/actors/worker.rs1
-rw-r--r--components/devtools/lib.rs7
-rw-r--r--components/devtools/protocol.rs1
-rw-r--r--components/devtools_traits/lib.rs11
-rw-r--r--components/dom_struct/lib.rs2
-rw-r--r--components/domobject_derive/lib.rs7
-rw-r--r--components/embedder_traits/lib.rs12
-rw-r--r--components/embedder_traits/resources.rs1
-rw-r--r--components/geometry/lib.rs4
-rw-r--r--components/gfx/font.rs6
-rw-r--r--components/gfx/font_cache_thread.rs2
-rw-r--r--components/gfx/font_context.rs1
-rw-r--r--components/gfx/font_template.rs1
-rw-r--r--components/gfx/lib.rs12
-rw-r--r--components/gfx/platform/freetype/font.rs1
-rw-r--r--components/gfx/platform/freetype/font_list.rs1
-rw-r--r--components/gfx/platform/freetype/font_template.rs1
-rw-r--r--components/gfx/platform/macos/font.rs1
-rw-r--r--components/gfx/platform/macos/font_list.rs1
-rw-r--r--components/gfx/platform/windows/font.rs1
-rw-r--r--components/gfx/platform/windows/font_list.rs1
-rw-r--r--components/gfx/platform/windows/font_template.rs1
-rw-r--r--components/gfx/text/glyph.rs2
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs3
-rw-r--r--components/gfx/text/text_run.rs2
-rw-r--r--components/gfx_traits/lib.rs11
-rw-r--r--components/jstraceable_derive/lib.rs7
-rw-r--r--components/layout/block.rs4
-rw-r--r--components/layout/construct.rs2
-rw-r--r--components/layout/data.rs1
-rw-r--r--components/layout/display_list/builder.rs2
-rw-r--r--components/layout/display_list/items.rs1
-rw-r--r--components/layout/display_list/webrender_helpers.rs1
-rw-r--r--components/layout/flex.rs4
-rw-r--r--components/layout/floats.rs2
-rw-r--r--components/layout/flow.rs5
-rw-r--r--components/layout/fragment.rs4
-rw-r--r--components/layout/generated_content.rs1
-rw-r--r--components/layout/incremental.rs1
-rw-r--r--components/layout/inline.rs7
-rw-r--r--components/layout/layout_debug.rs1
-rw-r--r--components/layout/lib.rs16
-rw-r--r--components/layout/model.rs1
-rw-r--r--components/layout/multicol.rs1
-rw-r--r--components/layout/table.rs4
-rw-r--r--components/layout/table_caption.rs1
-rw-r--r--components/layout/table_cell.rs4
-rw-r--r--components/layout/table_colgroup.rs2
-rw-r--r--components/layout/table_row.rs3
-rw-r--r--components/layout/table_rowgroup.rs3
-rw-r--r--components/layout/table_wrapper.rs2
-rw-r--r--components/layout/text.rs1
-rw-r--r--components/layout/traversal.rs1
-rw-r--r--components/layout_2020/flexbox/mod.rs2
-rw-r--r--components/layout_2020/flow/float.rs1
-rw-r--r--components/layout_2020/flow/inline.rs1
-rw-r--r--components/layout_2020/flow/mod.rs1
-rw-r--r--components/layout_2020/flow/root.rs1
-rw-r--r--components/layout_2020/formatting_contexts.rs1
-rw-r--r--components/layout_2020/fragment_tree/base_fragment.rs1
-rw-r--r--components/layout_2020/fragment_tree/box_fragment.rs1
-rw-r--r--components/layout_2020/fragment_tree/fragment.rs1
-rw-r--r--components/layout_2020/fragment_tree/fragment_tree.rs1
-rw-r--r--components/layout_2020/fragment_tree/hoisted_shared_fragment.rs1
-rw-r--r--components/layout_2020/geom.rs2
-rw-r--r--components/layout_2020/layout_debug.rs3
-rw-r--r--components/layout_2020/lib.rs5
-rw-r--r--components/layout_2020/positioned.rs1
-rw-r--r--components/layout_2020/query.rs1
-rw-r--r--components/layout_2020/replaced.rs1
-rw-r--r--components/layout_2020/sizing.rs1
-rw-r--r--components/layout_2020/tests/floats.rs3
-rw-r--r--components/layout_thread/lib.rs18
-rw-r--r--components/layout_thread_2020/lib.rs13
-rw-r--r--components/media/lib.rs8
-rw-r--r--components/media/media_channel/mod.rs1
-rw-r--r--components/media/media_thread.rs1
-rw-r--r--components/metrics/lib.rs7
-rw-r--r--components/msg/constellation_msg.rs5
-rw-r--r--components/msg/lib.rs11
-rw-r--r--components/net/connector.rs1
-rw-r--r--components/net/cookie.rs1
-rw-r--r--components/net/cookie_storage.rs2
-rw-r--r--components/net/fetch/methods.rs3
-rw-r--r--components/net/filemanager_thread.rs2
-rw-r--r--components/net/hosts.rs1
-rw-r--r--components/net/hsts.rs2
-rw-r--r--components/net/http_cache.rs3
-rw-r--r--components/net/http_loader.rs2
-rw-r--r--components/net/image_cache.rs1
-rw-r--r--components/net/lib.rs13
-rw-r--r--components/net/resource_thread.rs2
-rw-r--r--components/net/tests/main.rs4
-rw-r--r--components/net/websocket_loader.rs2
-rw-r--r--components/net_traits/blob_url_store.rs1
-rw-r--r--components/net_traits/filemanager_thread.rs2
-rw-r--r--components/net_traits/image/base.rs3
-rw-r--r--components/net_traits/image_cache.rs3
-rw-r--r--components/net_traits/lib.rs16
-rw-r--r--components/net_traits/pub_domains.rs1
-rw-r--r--components/net_traits/request.rs3
-rw-r--r--components/net_traits/response.rs2
-rw-r--r--components/net_traits/storage_thread.rs2
-rw-r--r--components/pixels/lib.rs4
-rw-r--r--components/profile/lib.rs5
-rw-r--r--components/profile/mem.rs2
-rw-r--r--components/profile/trace_dump.rs1
-rw-r--r--components/profile_traits/lib.rs5
-rw-r--r--components/profile_traits/mem.rs2
-rw-r--r--components/profile_traits/time.rs2
-rw-r--r--components/rand/lib.rs8
-rw-r--r--components/range/lib.rs7
-rw-r--r--components/remutex/lib.rs9
-rw-r--r--components/script/animation_timeline.rs1
-rw-r--r--components/script/animations.rs1
-rw-r--r--components/script/dom/abstractworkerglobalscope.rs2
-rw-r--r--components/script/dom/attr.rs2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py2
-rw-r--r--components/script/dom/bindings/htmlconstructor.rs2
-rw-r--r--components/script/dom/bindings/str.rs1
-rw-r--r--components/script/dom/bindings/xmlname.rs2
-rw-r--r--components/script/dom/create.rs2
-rw-r--r--components/script/dom/cssrulelist.rs2
-rw-r--r--components/script/dom/cssstyledeclaration.rs3
-rw-r--r--components/script/dom/customelementregistry.rs2
-rw-r--r--components/script/dom/document.rs4
-rw-r--r--components/script/dom/domimplementation.rs1
-rw-r--r--components/script/dom/domtokenlist.rs2
-rw-r--r--components/script/dom/element.rs5
-rw-r--r--components/script/dom/eventtarget.rs1
-rw-r--r--components/script/dom/htmlanchorelement.rs2
-rw-r--r--components/script/dom/htmlareaelement.rs3
-rw-r--r--components/script/dom/htmlaudioelement.rs2
-rw-r--r--components/script/dom/htmlbaseelement.rs2
-rw-r--r--components/script/dom/htmlbodyelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlbuttonelement.rs2
-rw-r--r--components/script/dom/htmlcanvaselement.rs2
-rw-r--r--components/script/dom/htmlcollection.rs2
-rw-r--r--components/script/dom/htmldetailselement.rs2
-rw-r--r--components/script/dom/htmldialogelement.rs2
-rw-r--r--components/script/dom/htmlelement.rs2
-rw-r--r--components/script/dom/htmlfieldsetelement.rs2
-rw-r--r--components/script/dom/htmlfontelement.rs2
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/script/dom/htmlheadelement.rs2
-rw-r--r--components/script/dom/htmlhrelement.rs2
-rw-r--r--components/script/dom/htmliframeelement.rs3
-rw-r--r--components/script/dom/htmlimageelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs2
-rw-r--r--components/script/dom/htmllabelelement.rs2
-rw-r--r--components/script/dom/htmllielement.rs2
-rw-r--r--components/script/dom/htmllinkelement.rs2
-rw-r--r--components/script/dom/htmlmediaelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlobjectelement.rs2
-rw-r--r--components/script/dom/htmloptgroupelement.rs2
-rw-r--r--components/script/dom/htmloptionelement.rs2
-rw-r--r--components/script/dom/htmloptionscollection.rs1
-rw-r--r--components/script/dom/htmloutputelement.rs2
-rw-r--r--components/script/dom/htmlprogresselement.rs2
-rw-r--r--components/script/dom/htmlscriptelement.rs2
-rwxr-xr-xcomponents/script/dom/htmlselectelement.rs2
-rw-r--r--components/script/dom/htmlsourceelement.rs2
-rw-r--r--components/script/dom/htmlstyleelement.rs2
-rw-r--r--components/script/dom/htmltablecellelement.rs2
-rw-r--r--components/script/dom/htmltableelement.rs2
-rw-r--r--components/script/dom/htmltablerowelement.rs2
-rw-r--r--components/script/dom/htmltablesectionelement.rs2
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs2
-rw-r--r--components/script/dom/htmltrackelement.rs2
-rw-r--r--components/script/dom/htmlvideoelement.rs2
-rw-r--r--components/script/dom/macros.rs36
-rw-r--r--components/script/dom/mutationobserver.rs2
-rw-r--r--components/script/dom/node.rs4
-rw-r--r--components/script/dom/range.rs1
-rw-r--r--components/script/dom/request.rs1
-rw-r--r--components/script/dom/servoparser/async_html.rs4
-rw-r--r--components/script/dom/servoparser/mod.rs2
-rw-r--r--components/script/dom/servoparser/prefetch.rs2
-rw-r--r--components/script/dom/svgelement.rs2
-rw-r--r--components/script/dom/svgsvgelement.rs2
-rwxr-xr-xcomponents/script/dom/validitystate.rs1
-rw-r--r--components/script/dom/webgl_validations/types.rs1
-rw-r--r--components/script/dom/webglrenderingcontext.rs1
-rw-r--r--components/script/dom/window.rs2
-rw-r--r--components/script/dom/windowproxy.rs2
-rw-r--r--components/script/dom/worklet.rs1
-rw-r--r--components/script/layout_dom/element.rs2
-rw-r--r--components/script/layout_dom/node.rs1
-rw-r--r--components/script/lib.rs23
-rw-r--r--components/script/script_module.rs1
-rw-r--r--components/script/script_runtime.rs2
-rw-r--r--components/script/script_thread.rs3
-rw-r--r--components/script/serviceworker_manager.rs2
-rw-r--r--components/script/timers.rs1
-rw-r--r--components/script/window_named_properties.rs2
-rw-r--r--components/script_layout_interface/lib.rs6
-rw-r--r--components/script_layout_interface/message.rs1
-rw-r--r--components/script_layout_interface/wrapper_traits.rs3
-rw-r--r--components/script_plugins/lib.rs1
-rw-r--r--components/script_traits/compositor.rs1
-rw-r--r--components/script_traits/lib.rs12
-rw-r--r--components/script_traits/script_msg.rs2
-rw-r--r--components/script_traits/serializable.rs2
-rw-r--r--components/script_traits/transferable.rs2
-rw-r--r--components/script_traits/webdriver_msg.rs1
-rw-r--r--components/selectors/lib.rs3
-rw-r--r--components/selectors/parser.rs1
-rw-r--r--components/servo/lib.rs5
-rw-r--r--components/style_traits/lib.rs4
-rw-r--r--components/url/lib.rs9
-rw-r--r--components/url/origin.rs3
-rw-r--r--components/webdriver_server/lib.rs15
-rw-r--r--components/webgpu/identity.rs12
-rw-r--r--components/webgpu/lib.rs9
262 files changed, 407 insertions, 406 deletions
diff --git a/components/background_hang_monitor/background_hang_monitor.rs b/components/background_hang_monitor/background_hang_monitor.rs
index ab1e4e5940c..fab2b406ce2 100644
--- a/components/background_hang_monitor/background_hang_monitor.rs
+++ b/components/background_hang_monitor/background_hang_monitor.rs
@@ -3,9 +3,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::sampler::{NativeStack, Sampler};
-use crossbeam_channel::{after, never, unbounded, Receiver, Sender};
+use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
+use log::warn;
use msg::constellation_msg::MonitoredComponentId;
use msg::constellation_msg::{
BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorExitSignal,
diff --git a/components/background_hang_monitor/lib.rs b/components/background_hang_monitor/lib.rs
index 1e7d05cc167..dab79b477ff 100644
--- a/components/background_hang_monitor/lib.rs
+++ b/components/background_hang_monitor/lib.rs
@@ -4,11 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate log;
-
pub mod background_hang_monitor;
mod sampler;
#[cfg(all(
diff --git a/components/background_hang_monitor/tests/hang_monitor_tests.rs b/components/background_hang_monitor/tests/hang_monitor_tests.rs
index b92344039bd..31ac269a8c1 100644
--- a/components/background_hang_monitor/tests/hang_monitor_tests.rs
+++ b/components/background_hang_monitor/tests/hang_monitor_tests.rs
@@ -4,9 +4,6 @@
#![allow(unused_imports)]
-#[macro_use]
-extern crate lazy_static;
-
use background_hang_monitor::HangMonitorRegister;
use ipc_channel::ipc;
use msg::constellation_msg::ScriptHangAnnotation;
@@ -22,7 +19,7 @@ use std::sync::Mutex;
use std::thread;
use std::time::Duration;
-lazy_static! {
+lazy_static::lazy_static! {
static ref SERIAL: Mutex<()> = Mutex::new(());
}
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs
index 9a48d19eec9..89bfa97404b 100644
--- a/components/bluetooth/lib.rs
+++ b/components/bluetooth/lib.rs
@@ -2,13 +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/. */
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate log;
-
pub mod test;
+use bitflags::bitflags;
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{
BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions,
@@ -20,6 +16,7 @@ use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacte
use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use log::warn;
use servo_config::pref;
use servo_rand::{self, Rng};
use std::borrow::ToOwned;
diff --git a/components/bluetooth_traits/lib.rs b/components/bluetooth_traits/lib.rs
index 14965a55e6d..a4e54e25808 100644
--- a/components/bluetooth_traits/lib.rs
+++ b/components/bluetooth_traits/lib.rs
@@ -2,14 +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/. */
-#[macro_use]
-extern crate serde;
-
pub mod blocklist;
pub mod scanfilter;
use crate::scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
use ipc_channel::ipc::IpcSender;
+use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothError {
diff --git a/components/bluetooth_traits/scanfilter.rs b/components/bluetooth_traits/scanfilter.rs
index 29e6667f8f6..b5590e1aa40 100644
--- a/components/bluetooth_traits/scanfilter.rs
+++ b/components/bluetooth_traits/scanfilter.rs
@@ -5,6 +5,8 @@
use std::collections::{HashMap, HashSet};
use std::slice::Iter;
+use serde::{Deserialize, Serialize};
+
// A device name can never be longer than 29 bytes. An adv packet is at most
// 31 bytes long. The length and identifier of the length field take 2 bytes.
// That leaves 29 bytes for the name.
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs
index 0a86bcd1c3c..e70602493fb 100644
--- a/components/canvas/canvas_data.rs
+++ b/components/canvas/canvas_data.rs
@@ -17,6 +17,7 @@ use gfx::font::FontHandleMethods;
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context::FontContext;
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
+use log::{debug, error, warn};
use num_traits::ToPrimitive;
use servo_arc::Arc as ServoArc;
use std::cell::RefCell;
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs
index df2b62971ca..f2918f19c4b 100644
--- a/components/canvas/canvas_paint_thread.rs
+++ b/components/canvas/canvas_paint_thread.rs
@@ -10,6 +10,7 @@ use euclid::default::Size2D;
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
+use log::warn;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::thread;
diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs
index 1e5872420bc..5a1716fcd49 100644
--- a/components/canvas/lib.rs
+++ b/components/canvas/lib.rs
@@ -4,11 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate log;
-
mod raqote_backend;
pub use webgl_mode::WebGLComm;
diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs
index da14d3b1673..1c81b6ea694 100644
--- a/components/canvas/raqote_backend.rs
+++ b/components/canvas/raqote_backend.rs
@@ -14,6 +14,7 @@ use cssparser::RGBA;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::Angle;
use font_kit::font::Font;
+use log::warn;
use lyon_geom::Arc;
use raqote::PathOp;
use std::marker::PhantomData;
diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs
index 985ca90763a..4d143515dea 100644
--- a/components/canvas/webgl_mode/inprocess.rs
+++ b/components/canvas/webgl_mode/inprocess.rs
@@ -7,6 +7,7 @@ use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::{WebGLContextId, WebGLMsg, WebGLThreads};
use euclid::default::Size2D;
use fnv::FnvHashMap;
+use log::debug;
use sparkle::gl::GlType;
use std::default::Default;
use std::sync::{Arc, Mutex};
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs
index eec824f3cf2..f0779662066 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::webgl_limits::GLLimitsDetect;
+use bitflags::bitflags;
use byteorder::{ByteOrder, NativeEndian, WriteBytesExt};
use canvas_traits::webgl;
use canvas_traits::webgl::webgl_channel;
@@ -45,6 +46,7 @@ use canvas_traits::webgl::YAxisTreatment;
use euclid::default::Size2D;
use fnv::FnvHashMap;
use half::f16;
+use log::{debug, error, trace, warn};
use pixels::{self, PixelFormat};
use sparkle::gl;
use sparkle::gl::GLint;
diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs
index a7a8ec12a0a..6065b714ce0 100644
--- a/components/canvas_traits/canvas.rs
+++ b/components/canvas_traits/canvas.rs
@@ -5,6 +5,8 @@
use cssparser::RGBA;
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use serde_bytes::ByteBuf;
use std::default::Default;
use std::str::FromStr;
diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs
index 467eb432e0f..e7aeef0fb67 100644
--- a/components/canvas_traits/lib.rs
+++ b/components/canvas_traits/lib.rs
@@ -10,13 +10,6 @@ use crate::canvas::CanvasId;
use crossbeam_channel::Sender;
use euclid::default::Size2D;
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
pub mod canvas;
#[macro_use]
pub mod webgl;
diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs
index 0ea7fb1edde..914b06e7b9f 100644
--- a/components/canvas_traits/webgl.rs
+++ b/components/canvas_traits/webgl.rs
@@ -4,6 +4,7 @@
use euclid::default::{Rect, Size2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory};
+use malloc_size_of_derive::MallocSizeOf;
use pixels::PixelFormat;
use serde::{Deserialize, Serialize};
use sparkle::gl;
@@ -889,7 +890,7 @@ parameters! {
macro_rules! gl_enums {
($(pub enum $name:ident { $($variant:ident = $mod:ident::$constant:ident,)+ })*) => {
$(
- #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf)]
+ #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, malloc_size_of_derive::MallocSizeOf)]
#[derive(PartialEq, Serialize)]
#[repr(u32)]
pub enum $name { $($variant = $mod::$constant,)+ }
diff --git a/components/canvas_traits/webgl_channel/mod.rs b/components/canvas_traits/webgl_channel/mod.rs
index 30dc9543f91..6aa14187699 100644
--- a/components/canvas_traits/webgl_channel/mod.rs
+++ b/components/canvas_traits/webgl_channel/mod.rs
@@ -10,6 +10,7 @@ mod mpsc;
use crate::webgl::WebGLMsg;
use ipc_channel::ipc::IpcSender;
use ipc_channel::router::ROUTER;
+use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use servo_config::opts;
use std::fmt;
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 829385c522f..08c78bbe405 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -23,7 +23,7 @@ use gfx_traits::{Epoch, FontData};
use image::{DynamicImage, ImageFormat};
use ipc_channel::ipc;
use libc::c_void;
-use log::warn;
+use log::{debug, error, info, warn};
use msg::constellation_msg::{
PipelineId, PipelineIndex, PipelineNamespaceId, TopLevelBrowsingContextId,
};
diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs
index a91d08c9247..aab07594dde 100644
--- a/components/compositing/lib.rs
+++ b/components/compositing/lib.rs
@@ -4,9 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate log;
-
pub use crate::compositor::IOCompositor;
pub use crate::compositor::ShutdownState;
diff --git a/components/compositing/touch.rs b/components/compositing/touch.rs
index 24082054b51..ac8e3690d96 100644
--- a/components/compositing/touch.rs
+++ b/components/compositing/touch.rs
@@ -4,6 +4,7 @@
use self::TouchState::*;
use euclid::{Point2D, Scale, Vector2D};
+use log::warn;
use script_traits::{EventResult, TouchId};
use style_traits::DevicePixel;
diff --git a/components/compositing_traits/lib.rs b/components/compositing_traits/lib.rs
index 41ef1ed723d..cb715337c39 100644
--- a/components/compositing_traits/lib.rs
+++ b/components/compositing_traits/lib.rs
@@ -4,9 +4,6 @@
//! Communication with the compositor thread.
-#[macro_use]
-extern crate log;
-
mod constellation_msg;
pub use constellation_msg::ConstellationMsg;
@@ -17,6 +14,7 @@ use embedder_traits::EventLoopWaker;
use euclid::Rect;
use gfx_traits::Epoch;
use ipc_channel::ipc::IpcSender;
+use log::warn;
use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId};
use net_traits::image::base::Image;
use script_traits::{
diff --git a/components/config/lib.rs b/components/config/lib.rs
index 0da6c32f0e6..ce19ea49849 100644
--- a/components/config/lib.rs
+++ b/components/config/lib.rs
@@ -4,15 +4,7 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
pub mod pref_util;
-#[macro_use]
pub mod prefs;
pub mod basedir;
diff --git a/components/config/opts.rs b/components/config/opts.rs
index 95675c0b9c1..9d3806d67b5 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -7,6 +7,9 @@
use euclid::Size2D;
use getopts::{Matches, Options};
+use lazy_static::lazy_static;
+use log::error;
+use serde::{Deserialize, Serialize};
use servo_geometry::DeviceIndependentPixel;
use servo_url::ServoUrl;
use std::default::Default;
@@ -19,6 +22,8 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{RwLock, RwLockReadGuard};
use url::{self, Url};
+use crate::{pref, set_pref};
+
/// Global flags for Servo, currently set on the command line.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Opts {
diff --git a/components/config/pref_util.rs b/components/config/pref_util.rs
index 75b83efae88..a052147e427 100644
--- a/components/config/pref_util.rs
+++ b/components/config/pref_util.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 serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
use std::fmt;
diff --git a/components/config/prefs.rs b/components/config/prefs.rs
index 82f3884bf70..13d8d6753ce 100644
--- a/components/config/prefs.rs
+++ b/components/config/prefs.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use embedder_traits::resources::{self, Resource};
+use lazy_static::lazy_static;
use serde_json::{self, Value};
use std::borrow::ToOwned;
use std::collections::HashMap;
@@ -85,6 +86,7 @@ pub fn read_prefs_map(txt: &str) -> Result<HashMap<String, PrefValue>, PrefError
}
mod gen {
+ use serde::{Deserialize, Serialize};
use servo_config_plugins::build_structs;
// The number of layout threads is calculated if it is not present in `prefs.json`.
diff --git a/components/config/tests/prefs.rs b/components/config/tests/prefs.rs
index 63d4475769b..f19b7e84676 100644
--- a/components/config/tests/prefs.rs
+++ b/components/config/tests/prefs.rs
@@ -2,9 +2,6 @@
* 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/. */
-#[macro_use]
-extern crate serde;
-
use servo_config::basedir;
use servo_config::pref_util::Preferences;
use servo_config::prefs::{read_prefs_map, PrefValue};
@@ -303,6 +300,7 @@ static WITHOUT_DEFAULTS_JSON_STR: &'static str = r#"{
}"#;
mod gen {
+ use serde::{Deserialize, Serialize};
use servo_config::pref_util::{Accessor, PrefValue};
use servo_config_plugins::build_structs;
diff --git a/components/constellation/browsingcontext.rs b/components/constellation/browsingcontext.rs
index 4f15638fcff..71db7487852 100644
--- a/components/constellation/browsingcontext.rs
+++ b/components/constellation/browsingcontext.rs
@@ -4,6 +4,7 @@
use crate::pipeline::Pipeline;
use euclid::Size2D;
+use log::warn;
use msg::constellation_msg::{
BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId,
};
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 50a18ade6ba..f0a446485a4 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -110,7 +110,7 @@ use compositing_traits::{
CompositorMsg, CompositorProxy, ConstellationMsg as FromCompositorMsg, SendableFrameTree,
WebrenderMsg,
};
-use crossbeam_channel::{after, never, unbounded, Receiver, Sender};
+use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender};
use devtools_traits::{
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState,
ScriptToDevtoolsControlMsg,
@@ -126,6 +126,7 @@ use ipc_channel::Error as IpcError;
use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::KeyboardEvent;
use layout_traits::LayoutThreadFactory;
+use log::{debug, error, info, warn};
use media::{GLPlayerThreads, WindowGLContext};
use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert,
diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs
index 837c7235169..17b83ba9a13 100644
--- a/components/constellation/lib.rs
+++ b/components/constellation/lib.rs
@@ -4,13 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
mod browsingcontext;
mod constellation;
mod event_loop;
diff --git a/components/constellation/logging.rs b/components/constellation/logging.rs
index 5fbd75d86cf..d47265a62c7 100644
--- a/components/constellation/logging.rs
+++ b/components/constellation/logging.rs
@@ -5,7 +5,7 @@
use backtrace::Backtrace;
use compositing_traits::ConstellationMsg as FromCompositorMsg;
use crossbeam_channel::Sender;
-use log::{Level, LevelFilter, Log, Metadata, Record};
+use log::{debug, Level, LevelFilter, Log, Metadata, Record};
use msg::constellation_msg::TopLevelBrowsingContextId;
use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan};
use servo_remutex::ReentrantMutex;
diff --git a/components/constellation/network_listener.rs b/components/constellation/network_listener.rs
index cae32c51f0b..8e42cc639a2 100644
--- a/components/constellation/network_listener.rs
+++ b/components/constellation/network_listener.rs
@@ -10,6 +10,7 @@ use crossbeam_channel::Sender;
use http::HeaderMap;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
+use log::warn;
use msg::constellation_msg::PipelineId;
use net::http_loader::{set_default_accept, set_default_accept_language};
use net_traits::request::{Destination, Referrer, RequestBuilder};
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index b20003ea66a..adf5ec5ba35 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -18,6 +18,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error;
use layout_traits::LayoutThreadFactory;
+use log::{debug, error, warn};
use media::WindowGLContext;
use metrics::PaintTimeMetrics;
use msg::constellation_msg::TopLevelBrowsingContextId;
@@ -40,6 +41,7 @@ use script_traits::{DocumentActivity, InitialScriptState};
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData};
use script_traits::{NewLayoutInfo, SWManagerMsg};
use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
+use serde::{Deserialize, Serialize};
use servo_config::opts::{self, Opts};
use servo_config::{prefs, prefs::PrefValue};
use servo_url::ServoUrl;
diff --git a/components/constellation/sandboxing.rs b/components/constellation/sandboxing.rs
index 0e7858eb468..c12917c6a42 100644
--- a/components/constellation/sandboxing.rs
+++ b/components/constellation/sandboxing.rs
@@ -16,6 +16,7 @@ use crate::serviceworker::ServiceWorkerUnprivilegedContent;
))]
use gaol::profile::{Operation, PathPattern, Profile};
use ipc_channel::Error;
+use serde::{Deserialize, Serialize};
use servo_config::opts::Opts;
use servo_config::prefs::PrefValue;
use std::collections::HashMap;
@@ -128,7 +129,7 @@ pub fn content_process_sandbox_profile() -> Profile {
all(target_arch = "aarch64", not(target_os = "macos"))
))]
pub fn content_process_sandbox_profile() {
- error!("Sandboxed multiprocess is not supported on this platform.");
+ log::error!("Sandboxed multiprocess is not supported on this platform.");
process::exit(1);
}
@@ -218,7 +219,7 @@ pub fn spawn_multiprocess(content: UnprivilegedContent) -> Result<(), Error> {
#[cfg(any(target_os = "windows", target_os = "ios"))]
pub fn spawn_multiprocess(_content: UnprivilegedContent) -> Result<(), Error> {
- error!("Multiprocess is not supported on Windows or iOS.");
+ log::error!("Multiprocess is not supported on Windows or iOS.");
process::exit(1);
}
diff --git a/components/constellation/serviceworker.rs b/components/constellation/serviceworker.rs
index 95bb8571b3a..f3733cfa238 100644
--- a/components/constellation/serviceworker.rs
+++ b/components/constellation/serviceworker.rs
@@ -5,6 +5,7 @@
use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent};
use ipc_channel::Error;
use script_traits::{SWManagerSenders, ServiceWorkerManagerFactory};
+use serde::{Deserialize, Serialize};
use servo_config::opts::{self, Opts};
use servo_config::prefs::{self, PrefValue};
use servo_url::ImmutableOrigin;
diff --git a/components/constellation/session_history.rs b/components/constellation/session_history.rs
index 3e15591215e..3a3e40fcc9c 100644
--- a/components/constellation/session_history.rs
+++ b/components/constellation/session_history.rs
@@ -4,6 +4,7 @@
use crate::browsingcontext::NewBrowsingContextInfo;
use euclid::Size2D;
+use log::debug;
use msg::constellation_msg::{
BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId,
};
diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs
index 641c6f717d4..bda4429053f 100644
--- a/components/devtools/actor.rs
+++ b/components/devtools/actor.rs
@@ -5,6 +5,7 @@
/// General actor system infrastructure.
use crate::StreamId;
use devtools_traits::PreciseTime;
+use log::{debug, warn};
use serde_json::{Map, Value};
use std::any::Any;
use std::cell::{Cell, RefCell};
diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs
index e301abc98d7..3095d442ce1 100644
--- a/components/devtools/actors/browsing_context.rs
+++ b/components/devtools/actors/browsing_context.rs
@@ -23,6 +23,7 @@ use devtools_traits::DevtoolsPageInfo;
use devtools_traits::NavigationState;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use serde::Serialize;
use serde_json::{Map, Value};
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs
index 86e4f39dd33..6700ee66955 100644
--- a/components/devtools/actors/console.rs
+++ b/components/devtools/actors/console.rs
@@ -21,7 +21,9 @@ use devtools_traits::{
CachedConsoleMessageTypes, ConsoleAPI, DevtoolScriptControlMsg, LogLevel, PageError,
};
use ipc_channel::ipc::{self, IpcSender};
+use log::debug;
use msg::constellation_msg::TEST_PIPELINE_ID;
+use serde::Serialize;
use serde_json::{self, Map, Number, Value};
use std::cell::RefCell;
use std::collections::HashMap;
diff --git a/components/devtools/actors/device.rs b/components/devtools/actors/device.rs
index c54b72b6d5d..a6defc234b0 100644
--- a/components/devtools/actors/device.rs
+++ b/components/devtools/actors/device.rs
@@ -6,6 +6,7 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::protocol::{ActorDescription, Method};
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs
index d01267b68e7..65820fa8c56 100644
--- a/components/devtools/actors/inspector.rs
+++ b/components/devtools/actors/inspector.rs
@@ -14,6 +14,7 @@ use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute};
use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo};
use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::PipelineId;
+use serde::Serialize;
use serde_json::{self, Map, Value};
use std::cell::RefCell;
use std::net::TcpStream;
diff --git a/components/devtools/actors/memory.rs b/components/devtools/actors/memory.rs
index 67f83548f9c..bcc44da38e7 100644
--- a/components/devtools/actors/memory.rs
+++ b/components/devtools/actors/memory.rs
@@ -4,6 +4,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs
index 1c593e3dcb6..ea0ef36ccb2 100644
--- a/components/devtools/actors/network_event.rs
+++ b/components/devtools/actors/network_event.rs
@@ -13,6 +13,7 @@ use devtools_traits::HttpRequest as DevtoolsHttpRequest;
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
use headers::{ContentType, Cookie, HeaderMapExt};
use http::{header, HeaderMap, Method, StatusCode};
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
use time::Tm;
diff --git a/components/devtools/actors/performance.rs b/components/devtools/actors/performance.rs
index 497922a2745..07c04c5f90b 100644
--- a/components/devtools/actors/performance.rs
+++ b/components/devtools/actors/performance.rs
@@ -5,6 +5,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::{ActorDescription, JsonPacketStream, Method};
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/preference.rs b/components/devtools/actors/preference.rs
index 1c8e9129787..49d0b22fb8a 100644
--- a/components/devtools/actors/preference.rs
+++ b/components/devtools/actors/preference.rs
@@ -5,6 +5,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use servo_config::pref_util::PrefValue;
use servo_config::prefs::pref_map;
diff --git a/components/devtools/actors/process.rs b/components/devtools/actors/process.rs
index 8b2d54d5ee7..d89092ca314 100644
--- a/components/devtools/actors/process.rs
+++ b/components/devtools/actors/process.rs
@@ -5,6 +5,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs
index 915d3d1495a..c1a65a546aa 100644
--- a/components/devtools/actors/root.rs
+++ b/components/devtools/actors/root.rs
@@ -13,6 +13,7 @@ use crate::actors::tab::{TabDescriptorActor, TabDescriptorActorMsg};
use crate::actors::worker::{WorkerActor, WorkerMsg};
use crate::protocol::{ActorDescription, JsonPacketStream};
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/stylesheets.rs b/components/devtools/actors/stylesheets.rs
index 141a30ae106..c7937d6f123 100644
--- a/components/devtools/actors/stylesheets.rs
+++ b/components/devtools/actors/stylesheets.rs
@@ -5,6 +5,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs
index bd2ab331769..5b3a09f47ba 100644
--- a/components/devtools/actors/tab.rs
+++ b/components/devtools/actors/tab.rs
@@ -7,6 +7,7 @@ use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActor
use crate::actors::root::RootActor;
use crate::protocol::JsonPacketStream;
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/thread.rs b/components/devtools/actors/thread.rs
index 084a7bcf506..742c06c0950 100644
--- a/components/devtools/actors/thread.rs
+++ b/components/devtools/actors/thread.rs
@@ -5,6 +5,7 @@
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
+use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
diff --git a/components/devtools/actors/worker.rs b/components/devtools/actors/worker.rs
index cf7b26448fa..4bfa8e76e9b 100644
--- a/components/devtools/actors/worker.rs
+++ b/components/devtools/actors/worker.rs
@@ -9,6 +9,7 @@ use devtools_traits::DevtoolScriptControlMsg::WantsLiveNotifications;
use devtools_traits::{DevtoolScriptControlMsg, WorkerId};
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::TEST_PIPELINE_ID;
+use serde::Serialize;
use serde_json::{Map, Value};
use servo_url::ServoUrl;
use std::cell::RefCell;
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index 4b675191c8b..94e0e303028 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -12,11 +12,6 @@
#![allow(non_snake_case)]
#![deny(unsafe_code)]
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
use crate::actor::{Actor, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor;
use crate::actors::console::{ConsoleActor, Root};
@@ -38,7 +33,9 @@ use devtools_traits::{
use devtools_traits::{PageError, ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult};
use ipc_channel::ipc::{self, IpcSender};
+use log::{debug, warn};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use serde::Serialize;
use servo_rand::RngCore;
use std::borrow::ToOwned;
use std::collections::hash_map::Entry::{Occupied, Vacant};
diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs
index b01c982a762..b2b8ffecec9 100644
--- a/components/devtools/protocol.rs
+++ b/components/devtools/protocol.rs
@@ -6,6 +6,7 @@
//! [JSON packets]
//! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
+use log::debug;
use serde::Serialize;
use serde_json::{self, Value};
use std::error::Error;
diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs
index 9abbf5d1cc9..1b87f19f293 100644
--- a/components/devtools_traits/lib.rs
+++ b/components/devtools_traits/lib.rs
@@ -11,17 +11,14 @@
#![allow(non_snake_case)]
#![deny(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
+use bitflags::bitflags;
use http::HeaderMap;
use http::Method;
use ipc_channel::ipc::IpcSender;
+use malloc_size_of_derive::MallocSizeOf;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use serde::Deserialize;
+use serde::Serialize;
use servo_url::ServoUrl;
use std::net::TcpStream;
use time::{self, Duration, Tm};
diff --git a/components/dom_struct/lib.rs b/components/dom_struct/lib.rs
index 8d852e8fb7c..d501a1a63a5 100644
--- a/components/dom_struct/lib.rs
+++ b/components/dom_struct/lib.rs
@@ -12,7 +12,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
panic!("#[dom_struct] takes no arguments");
}
let attributes = quote! {
- #[derive(DenyPublicFields, DomObject, JSTraceable, MallocSizeOf)]
+ #[derive(deny_public_fields::DenyPublicFields, domobject_derive::DomObject, JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
#[repr(C)]
};
diff --git a/components/domobject_derive/lib.rs b/components/domobject_derive/lib.rs
index c103bb73ece..e4d354f1708 100644
--- a/components/domobject_derive/lib.rs
+++ b/components/domobject_derive/lib.rs
@@ -4,13 +4,10 @@
#![recursion_limit = "128"]
-#[macro_use]
-extern crate quote;
-#[macro_use]
-extern crate syn;
-
use proc_macro2;
+use quote::quote;
use quote::TokenStreamExt;
+use syn::parse_quote;
#[proc_macro_derive(DomObject)]
pub fn expand_token_stream(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
diff --git a/components/embedder_traits/lib.rs b/components/embedder_traits/lib.rs
index da117823340..b5154948f48 100644
--- a/components/embedder_traits/lib.rs
+++ b/components/embedder_traits/lib.rs
@@ -2,21 +2,15 @@
* 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/. */
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate num_derive;
-#[macro_use]
-extern crate serde;
-
pub mod resources;
use crossbeam_channel::{Receiver, Sender};
use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent;
+use log::warn;
use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId};
+use num_derive::FromPrimitive;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
diff --git a/components/embedder_traits/resources.rs b/components/embedder_traits/resources.rs
index 6cee8029076..c51a50d5937 100644
--- a/components/embedder_traits/resources.rs
+++ b/components/embedder_traits/resources.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 lazy_static::lazy_static;
use std::path::PathBuf;
use std::sync::{Once, RwLock};
diff --git a/components/geometry/lib.rs b/components/geometry/lib.rs
index 81e0eddc028..a594a8613cd 100644
--- a/components/geometry/lib.rs
+++ b/components/geometry/lib.rs
@@ -2,14 +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/. */
-#[macro_use]
-extern crate malloc_size_of_derive;
-
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::{
default::{Point2D, Rect, Size2D},
Length,
};
+use malloc_size_of_derive::MallocSizeOf;
use std::f32;
use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};
diff --git a/components/gfx/font.rs b/components/gfx/font.rs
index 054b732b779..3d0bc816fb3 100644
--- a/components/gfx/font.rs
+++ b/components/gfx/font.rs
@@ -12,8 +12,11 @@ use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods;
use crate::text::Shaper;
use app_units::Au;
+use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
-use servo_atoms::Atom;
+use log::debug;
+use serde::{Deserialize, Serialize};
+use servo_atoms::{atom, Atom};
use smallvec::SmallVec;
use std::borrow::ToOwned;
use std::cell::RefCell;
@@ -29,6 +32,7 @@ use style::values::computed::font::{GenericFontFamily, SingleFontFamily};
use unicode_script::Script;
use webrender_api::FontInstanceKey;
+#[macro_export]
macro_rules! ot_tag {
($t1:expr, $t2:expr, $t3:expr, $t4:expr) => {
(($t1 as u32) << 24) | (($t2 as u32) << 16) | (($t3 as u32) << 8) | ($t4 as u32)
diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs
index 325018102c9..ad1c5f6026b 100644
--- a/components/gfx/font_cache_thread.rs
+++ b/components/gfx/font_cache_thread.rs
@@ -14,8 +14,10 @@ use crate::platform::font_template::FontTemplateData;
use app_units::Au;
use gfx_traits::{FontData, WebrenderApi};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use log::{debug, trace};
use net_traits::request::{Destination, Referrer, RequestBuilder};
use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
+use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::borrow::ToOwned;
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index 6a975e6b12f..0e6d0ce12e7 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -11,6 +11,7 @@ use crate::platform::font::FontHandle;
pub use crate::platform::font_context::FontContextHandle;
use app_units::Au;
use fnv::FnvHasher;
+use log::debug;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_arc::Arc;
use std::cell::RefCell;
diff --git a/components/gfx/font_template.rs b/components/gfx/font_template.rs
index c01f58460d8..25b2e60f117 100644
--- a/components/gfx/font_template.rs
+++ b/components/gfx/font_template.rs
@@ -6,6 +6,7 @@ use crate::font::FontHandleMethods;
use crate::platform::font::FontHandle;
use crate::platform::font_context::FontContextHandle;
use crate::platform::font_template::FontTemplateData;
+use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use std::fmt::{Debug, Error, Formatter};
use std::io::Error as IoError;
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index 15148328bf6..c13d9663079 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -4,19 +4,7 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-#[macro_use]
-extern crate servo_atoms;
-
// Fonts
-#[macro_use]
pub mod font;
pub mod font_cache_thread;
pub mod font_context;
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index 63cda12c7a9..bbfc94d7e8a 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -21,6 +21,7 @@ use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size};
use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector};
use freetype::succeeded;
use freetype::tt_os2::TT_OS2;
+use log::debug;
use servo_atoms::Atom;
use std::ffi::CString;
use std::os::raw::{c_char, c_long};
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index fded1d160d5..c0809ece5ed 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.rs
@@ -11,6 +11,7 @@ use fontconfig_sys::{FcFontSetDestroy, FcMatchPattern, FcPatternCreate, FcPatter
use fontconfig_sys::{FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString};
use fontconfig_sys::{FcObjectSetAdd, FcPatternGetInteger};
use libc::{c_char, c_int};
+use log::debug;
use std::ffi::CString;
use std::ptr;
diff --git a/components/gfx/platform/freetype/font_template.rs b/components/gfx/platform/freetype/font_template.rs
index 52654ed6d5a..2524cf9bb69 100644
--- a/components/gfx/platform/freetype/font_template.rs
+++ b/components/gfx/platform/freetype/font_template.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 serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use std::fmt;
use std::fs::File;
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index eff3d51789d..ca94c384a78 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -20,6 +20,7 @@ use core_graphics::geometry::CGRect;
use core_text::font::CTFont;
use core_text::font_descriptor::kCTFontDefaultOrientation;
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
+use log::debug;
use servo_atoms::Atom;
use std::ops::Range;
use std::sync::Arc;
diff --git a/components/gfx/platform/macos/font_list.rs b/components/gfx/platform/macos/font_list.rs
index d02fbdc7dbc..70d46edd2b0 100644
--- a/components/gfx/platform/macos/font_list.rs
+++ b/components/gfx/platform/macos/font_list.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::text::util::unicode_plane;
+use log::debug;
use ucd::{Codepoint, UnicodeBlock};
pub fn for_each_available_family<F>(mut callback: F)
diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs
index 5b41b0c21f0..9e371685491 100644
--- a/components/gfx/platform/windows/font.rs
+++ b/components/gfx/platform/windows/font.rs
@@ -15,6 +15,7 @@ use crate::text::glyph::GlyphId;
use app_units::Au;
use dwrote::{Font, FontFace, FontFile};
use dwrote::{FontStretch, FontStyle};
+use log::debug;
use servo_atoms::Atom;
use std::fmt;
use std::ops::Deref;
diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs
index d9d1261dba9..9de2073d6b8 100644
--- a/components/gfx/platform/windows/font_list.rs
+++ b/components/gfx/platform/windows/font_list.rs
@@ -4,6 +4,7 @@
use crate::text::util::unicode_plane;
use dwrote::{Font, FontCollection, FontDescriptor};
+use lazy_static::lazy_static;
use servo_atoms::Atom;
use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/components/gfx/platform/windows/font_template.rs b/components/gfx/platform/windows/font_template.rs
index 8576e3f6fc8..96923c77afc 100644
--- a/components/gfx/platform/windows/font_template.rs
+++ b/components/gfx/platform/windows/font_template.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::platform::windows::font_list::font_from_atom;
+use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use std::fmt;
use std::io;
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 7492064e3f7..373fb48dc86 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -4,7 +4,9 @@
use app_units::Au;
use euclid::default::Point2D;
+use log::debug;
use range::{self, EachIndex, Range, RangeIndex};
+use serde::{Deserialize, Serialize};
use std::cmp::{Ordering, PartialOrd};
use std::vec::Vec;
use std::{fmt, mem, u16};
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index ef49bb32e68..20791a52148 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -5,6 +5,7 @@
#![allow(unsafe_code)]
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
+use crate::ot_tag;
use crate::platform::font::FontTable;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods;
@@ -38,6 +39,8 @@ use harfbuzz_sys::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t};
use harfbuzz_sys::{hb_face_t, hb_font_t};
use harfbuzz_sys::{hb_position_t, hb_tag_t};
use harfbuzz_sys::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
+use lazy_static::lazy_static;
+use log::debug;
use std::os::raw::{c_char, c_int, c_uint, c_void};
use std::{char, cmp, ptr};
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index cf340a2e3dc..f230bbc92a5 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -7,7 +7,9 @@ use crate::font::{RunMetrics, ShapingOptions};
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphStore};
use app_units::Au;
+use log::debug;
use range::Range;
+use serde::{Deserialize, Serialize};
use std::cell::Cell;
use std::cmp::{max, Ordering};
use std::slice::Iter;
diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs
index 2c6c32ca9f2..3f27c9280f9 100644
--- a/components/gfx_traits/lib.rs
+++ b/components/gfx_traits/lib.rs
@@ -6,16 +6,11 @@
#![crate_type = "rlib"]
#![deny(unsafe_code)]
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate range;
-#[macro_use]
-extern crate serde;
-
pub mod print_tree;
-use range::RangeIndex;
+use malloc_size_of_derive::MallocSizeOf;
+use range::{int_range_index, RangeIndex};
+use serde::{Deserialize, Serialize};
use std::sync::atomic::{AtomicUsize, Ordering};
use webrender_api::{Epoch as WebRenderEpoch, FontInstanceKey, FontKey, NativeFontHandle};
diff --git a/components/jstraceable_derive/lib.rs b/components/jstraceable_derive/lib.rs
index 2e90f967970..6fb41604901 100644
--- a/components/jstraceable_derive/lib.rs
+++ b/components/jstraceable_derive/lib.rs
@@ -2,10 +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/. */
-#[macro_use]
-extern crate syn;
-#[macro_use]
-extern crate synstructure;
+use syn::parse_quote;
+use synstructure::decl_derive;
+use synstructure::quote;
decl_derive!([JSTraceable, attributes(no_trace, custom_trace)] =>
/// Implements `JSTraceable` on structs and enums
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 4742791d889..b9614601458 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -43,15 +43,17 @@ use crate::fragment::{
CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow,
};
use crate::incremental::RelayoutMode;
-use crate::layout_debug;
use crate::model::{
AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto,
};
use crate::sequential;
use crate::traversal::PreorderFlowTraversal;
+use crate::{layout_debug, layout_debug_scope};
use app_units::{Au, MAX_AU};
+use bitflags::bitflags;
use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
use serde::{Serialize, Serializer};
use servo_geometry::MaxRect;
use std::cmp::{max, min};
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index d9531be391f..5f5caba6fbc 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -48,6 +48,8 @@ use crate::text::TextRunScanner;
use crate::traversal::PostorderNodeMutTraversal;
use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers};
use crate::ServoArc;
+use html5ever::{local_name, namespace_url, ns};
+use log::debug;
use script_layout_interface::wrapper_traits::{
PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
diff --git a/components/layout/data.rs b/components/layout/data.rs
index 96112a8523a..720f168e732 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -4,6 +4,7 @@
use crate::construct::ConstructionResult;
use atomic_refcell::AtomicRefCell;
+use bitflags::bitflags;
use script_layout_interface::wrapper_traits::LayoutDataTrait;
use script_layout_interface::StyleData;
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index ac0caa51518..e6980ebdd6a 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -32,6 +32,7 @@ use crate::inline::InlineFragmentNodeFlags;
use crate::model::MaybeAuto;
use crate::table_cell::CollapsedBordersForCell;
use app_units::{Au, AU_PER_PX};
+use bitflags::bitflags;
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
use embedder_traits::Cursor;
use euclid::{
@@ -43,6 +44,7 @@ use gfx::text::glyph::ByteIndex;
use gfx::text::TextRun;
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
use ipc_channel::ipc;
+use log::{debug, warn};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image_cache::UsePlaceholder;
use range::Range;
diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs
index b1de022d819..9b87a7c0bb4 100644
--- a/components/layout/display_list/items.rs
+++ b/components/layout/display_list/items.rs
@@ -19,6 +19,7 @@ use gfx_traits::{self, StackingContextId};
use msg::constellation_msg::PipelineId;
use net_traits::image::base::Image;
use script_traits::compositor::ScrollTreeNodeId;
+use serde::Serialize;
use servo_geometry::MaxRect;
use std::cmp::Ordering;
use std::collections::HashMap;
diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs
index 103ac139d1a..74fd41d22c2 100644
--- a/components/layout/display_list/webrender_helpers.rs
+++ b/components/layout/display_list/webrender_helpers.rs
@@ -9,6 +9,7 @@
use crate::display_list::items::{BaseDisplayItem, ClipScrollNode, ClipScrollNodeType, ClipType};
use crate::display_list::items::{DisplayItem, DisplayList, StackingContextType};
+use log::trace;
use msg::constellation_msg::PipelineId;
use script_traits::compositor::{CompositorDisplayListInfo, ScrollTreeNodeId, ScrollableNodeInfo};
use webrender_api::units::{LayoutPoint, LayoutSize, LayoutVector2D};
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 4a21b563edc..b2517a61cff 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -12,12 +12,14 @@ use crate::display_list::{
use crate::floats::FloatKind;
use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::model::{self, AdjoiningMargins, CollapsibleMargins};
use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
use crate::traversal::PreorderFlowTraversal;
+use crate::{layout_debug, layout_debug_scope};
use app_units::{Au, MAX_AU};
use euclid::default::Point2D;
+use log::debug;
+use serde::Serialize;
use std::cmp::{max, min};
use std::ops::Range;
use style::computed_values::align_content::T as AlignContent;
diff --git a/components/layout/floats.rs b/components/layout/floats.rs
index b629e2bb83c..9e8e698e0b5 100644
--- a/components/layout/floats.rs
+++ b/components/layout/floats.rs
@@ -6,6 +6,8 @@ use crate::block::FormattingContextType;
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
use crate::persistent_list::PersistentList;
use app_units::{Au, MAX_AU};
+use log::debug;
+use serde::Serialize;
use std::cmp::{max, min};
use std::fmt;
use style::computed_values::float::T as StyleFloat;
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 24b804a5bfd..2a2d9a06539 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -44,10 +44,13 @@ use crate::table_row::TableRowFlow;
use crate::table_rowgroup::TableRowGroupFlow;
use crate::table_wrapper::TableWrapperFlow;
use app_units::Au;
+use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
use gfx_traits::print_tree::PrintTree;
use gfx_traits::StackingContextId;
-use serde::ser::{Serialize, SerializeStruct, Serializer};
+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 std::fmt;
use std::slice::IterMut;
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 98e04fd3d3d..8df20e18e9d 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -21,12 +21,15 @@ use crate::text::TextRunScanner;
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::ServoArc;
use app_units::Au;
+use bitflags::bitflags;
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
use gfx_traits::StackingContextId;
+use html5ever::{local_name, namespace_url, ns};
use ipc_channel::ipc::IpcSender;
+use log::debug;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
@@ -37,6 +40,7 @@ use script_layout_interface::wrapper_traits::{
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource, HTMLMediaData, SVGSVGData};
use serde::ser::{Serialize, SerializeStruct, Serializer};
use servo_url::ServoUrl;
+use size_of_test::size_of_test;
use std::borrow::ToOwned;
use std::cmp::{max, min, Ordering};
use std::collections::LinkedList;
diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs
index 90e17fe3e8c..4c57e2d77e6 100644
--- a/components/layout/generated_content.rs
+++ b/components/layout/generated_content.rs
@@ -16,6 +16,7 @@ use crate::fragment::{
};
use crate::text::TextRunScanner;
use crate::traversal::InorderFlowTraversal;
+use lazy_static::lazy_static;
use script_layout_interface::wrapper_traits::PseudoElementType;
use smallvec::SmallVec;
use std::collections::{HashMap, LinkedList};
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index a1191695205..1ffeafc5662 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::flow::{Flow, FlowFlags, GetBaseFlow};
+use bitflags::bitflags;
use style::computed_values::float::T as Float;
use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index c7e7ee1027d..c09e33a7bac 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -15,17 +15,20 @@ use crate::flow_ref::FlowRef;
use crate::fragment::FragmentFlags;
use crate::fragment::SpecificFragmentInfo;
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::model::IntrinsicISizesContribution;
use crate::text;
use crate::traversal::PreorderFlowTraversal;
use crate::ServoArc;
+use crate::{layout_debug, layout_debug_scope};
use app_units::{Au, MIN_AU};
+use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
use gfx::font::FontMetrics;
use gfx_traits::print_tree::PrintTree;
-use range::{Range, RangeIndex};
+use log::debug;
+use range::{int_range_index, Range, RangeIndex};
use script_layout_interface::wrapper_traits::PseudoElementType;
+use serde::Serialize;
use servo_geometry::MaxRect;
use std::cmp::max;
use std::collections::VecDeque;
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index d3af6b4d8d5..2753ef84922 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -7,6 +7,7 @@
use crate::flow::GetBaseFlow;
use crate::flow_ref::FlowRef;
+use serde::Serialize;
use serde_json::{to_string, to_value, Value};
use std::borrow::ToOwned;
use std::cell::RefCell;
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index aab98048a54..7e6544e5a8a 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -4,22 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate html5ever;
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate range;
-#[macro_use]
-extern crate serde;
-#[macro_use]
-extern crate size_of_test;
-
-#[macro_use]
pub mod layout_debug;
mod block;
diff --git a/components/layout/model.rs b/components/layout/model.rs
index 08f916142e9..d9719442186 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -7,6 +7,7 @@
use crate::fragment::Fragment;
use app_units::Au;
use euclid::SideOffsets2D;
+use serde::Serialize;
use std::cmp::{max, min};
use std::fmt;
use style::logical_geometry::{LogicalMargin, WritingMode};
diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs
index 2e7890a8be5..e1a0ef92911 100644
--- a/components/layout/multicol.rs
+++ b/components/layout/multicol.rs
@@ -14,6 +14,7 @@ use crate::ServoArc;
use app_units::Au;
use euclid::default::{Point2D, Vector2D};
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
use std::cmp::{max, min};
use std::fmt;
use std::sync::Arc;
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 36c78d9bb81..b067b5ffdc4 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -17,15 +17,17 @@ use crate::flow::{
};
use crate::flow_list::{FlowListIterator, MutFlowListIterator};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
use crate::table_cell::TableCellFlow;
use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
use crate::table_row::{TableRowFlow, TableRowSizeData};
use crate::table_wrapper::TableLayout;
+use crate::{layout_debug, layout_debug_scope};
use app_units::Au;
use euclid::default::Point2D;
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
+use serde::Serialize;
use std::{cmp, fmt};
use style::computed_values::{border_collapse, border_spacing, table_layout};
use style::context::SharedStyleContext;
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index 770a0e41be8..b538e9758cb 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -14,6 +14,7 @@ use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use app_units::Au;
use euclid::default::Point2D;
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
use std::fmt;
use style::logical_geometry::LogicalSize;
use style::properties::ComputedValues;
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index 6408da05dee..2ed26c43108 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -11,13 +11,15 @@ use crate::display_list::{
};
use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::table::InternalTable;
use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance};
+use crate::{layout_debug, layout_debug_scope};
use app_units::Au;
use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
+use serde::Serialize;
use std::fmt;
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::ComputedValues;
diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs
index ce097083f62..8d66188e8dc 100644
--- a/components/layout/table_colgroup.rs
+++ b/components/layout/table_colgroup.rs
@@ -8,7 +8,7 @@ use crate::context::LayoutContext;
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
+use crate::{layout_debug, layout_debug_scope};
use app_units::Au;
use euclid::default::Point2D;
use std::fmt;
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index b9090c39c94..2a9f140b630 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -14,12 +14,13 @@ use crate::flow::{
};
use crate::flow_list::MutFlowListIterator;
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
+use crate::{layout_debug, layout_debug_scope};
use app_units::Au;
use euclid::default::Point2D;
use gfx_traits::print_tree::PrintTree;
+use log::{debug, warn};
use serde::{Serialize, Serializer};
use std::cmp::max;
use std::fmt;
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index 22a66b07a7d..08177322441 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -11,11 +11,12 @@ use crate::display_list::{
};
use crate::flow::{Flow, FlowClass, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use crate::layout_debug;
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
+use crate::{layout_debug, layout_debug_scope};
use app_units::Au;
use euclid::default::Point2D;
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
use serde::{Serialize, Serializer};
use std::fmt;
use std::iter::{IntoIterator, Iterator, Peekable};
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 92532f8f706..07d4375c678 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -26,6 +26,8 @@ use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
use app_units::Au;
use euclid::default::Point2D;
use gfx_traits::print_tree::PrintTree;
+use log::{debug, trace};
+use serde::Serialize;
use std::cmp::{max, min};
use std::fmt;
use std::ops::Add;
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 979443feae4..77b52927e6a 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -14,6 +14,7 @@ use gfx::font::{self, FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOpt
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::TextRun;
use gfx::text::util::{self, CompressionMode};
+use log::debug;
use range::Range;
use servo_atoms::Atom;
use std::borrow::ToOwned;
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 840aba5ef05..cf5b4828a5f 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -10,6 +10,7 @@ use crate::display_list::DisplayListBuildState;
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::wrapper::{GetStyleAndLayoutData, LayoutNodeLayoutData};
+use log::debug;
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_config::opts;
use style::context::{SharedStyleContext, StyleContext};
diff --git a/components/layout_2020/flexbox/mod.rs b/components/layout_2020/flexbox/mod.rs
index f286acdd690..e60f310c454 100644
--- a/components/layout_2020/flexbox/mod.rs
+++ b/components/layout_2020/flexbox/mod.rs
@@ -2,6 +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 serde::Serialize;
+
use crate::cell::ArcRefCell;
use crate::formatting_contexts::IndependentFormattingContext;
use crate::positioned::AbsolutelyPositionedBox;
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs
index be275520690..db8003835a1 100644
--- a/components/layout_2020/flow/float.rs
+++ b/components/layout_2020/flow/float.rs
@@ -16,6 +16,7 @@ use crate::positioned::PositioningContext;
use crate::style_ext::{ComputedValuesExt, DisplayInside, PaddingBorderMargin};
use crate::ContainingBlock;
use euclid::num::Zero;
+use serde::Serialize;
use servo_arc::Arc;
use std::collections::VecDeque;
use std::fmt::{Debug, Formatter, Result as FmtResult};
diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs
index 74480b649ed..4ab0fa31be0 100644
--- a/components/layout_2020/flow/inline.rs
+++ b/components/layout_2020/flow/inline.rs
@@ -27,6 +27,7 @@ use app_units::Au;
use atomic_refcell::AtomicRef;
use gfx::text::glyph::GlyphStore;
use gfx::text::text_run::GlyphRun;
+use serde::Serialize;
use servo_arc::Arc;
use std::cell::OnceCell;
use style::computed_values::white_space::T as WhiteSpace;
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs
index 9b8a233bf26..75a44ac87fb 100644
--- a/components/layout_2020/flow/mod.rs
+++ b/components/layout_2020/flow/mod.rs
@@ -23,6 +23,7 @@ use crate::sizing::{self, ContentSizes};
use crate::style_ext::{ComputedValuesExt, PaddingBorderMargin};
use crate::ContainingBlock;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
+use serde::Serialize;
use servo_arc::Arc;
use style::computed_values::clear::T as Clear;
use style::computed_values::float::T as Float;
diff --git a/components/layout_2020/flow/root.rs b/components/layout_2020/flow/root.rs
index 2a1603990d5..5af9413abfb 100644
--- a/components/layout_2020/flow/root.rs
+++ b/components/layout_2020/flow/root.rs
@@ -23,6 +23,7 @@ use crate::DefiniteContainingBlock;
use atomic_refcell::AtomicRef;
use script_layout_interface::wrapper_traits::LayoutNode;
use script_layout_interface::{LayoutElementType, LayoutNodeType};
+use serde::Serialize;
use servo_arc::Arc;
use style::dom::OpaqueNode;
use style::properties::ComputedValues;
diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout_2020/formatting_contexts.rs
index 555fd59b229..118142d92e0 100644
--- a/components/layout_2020/formatting_contexts.rs
+++ b/components/layout_2020/formatting_contexts.rs
@@ -13,6 +13,7 @@ use crate::replaced::ReplacedContent;
use crate::sizing::{self, ContentSizes};
use crate::style_ext::DisplayInside;
use crate::ContainingBlock;
+use serde::Serialize;
use servo_arc::Arc;
use std::convert::TryInto;
use style::logical_geometry::WritingMode;
diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout_2020/fragment_tree/base_fragment.rs
index 0935296c118..6104c9af547 100644
--- a/components/layout_2020/fragment_tree/base_fragment.rs
+++ b/components/layout_2020/fragment_tree/base_fragment.rs
@@ -5,6 +5,7 @@
use crate::layout_debug::DebugId;
use bitflags::bitflags;
use gfx_traits::{combine_id_with_fragment_type, FragmentType};
+use serde::Serialize;
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 0ff96c5deed..4ba007a79a2 100644
--- a/components/layout_2020/fragment_tree/box_fragment.rs
+++ b/components/layout_2020/fragment_tree/box_fragment.rs
@@ -7,6 +7,7 @@ use crate::cell::ArcRefCell;
use crate::geom::flow_relative::{Rect, Sides};
use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize};
use gfx_traits::print_tree::PrintTree;
+use serde::Serialize;
use servo_arc::Arc as ServoArc;
use style::computed_values::overflow_x::T as ComputedOverflow;
use style::computed_values::position::T as ComputedPosition;
diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout_2020/fragment_tree/fragment.rs
index 0a5d2f04599..6b8e788f0f1 100644
--- a/components/layout_2020/fragment_tree/fragment.rs
+++ b/components/layout_2020/fragment_tree/fragment.rs
@@ -11,6 +11,7 @@ use gfx::font::FontMetrics as GfxFontMetrics;
use gfx::text::glyph::GlyphStore;
use gfx_traits::print_tree::PrintTree;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use serde::Serialize;
use servo_arc::Arc as ServoArc;
use std::sync::Arc;
use style::logical_geometry::WritingMode;
diff --git a/components/layout_2020/fragment_tree/fragment_tree.rs b/components/layout_2020/fragment_tree/fragment_tree.rs
index 799eddc3dbd..ce39f05ad01 100644
--- a/components/layout_2020/fragment_tree/fragment_tree.rs
+++ b/components/layout_2020/fragment_tree/fragment_tree.rs
@@ -11,6 +11,7 @@ use app_units::Au;
use euclid::default::{Point2D, Rect, Size2D};
use fxhash::FxHashSet;
use gfx_traits::print_tree::PrintTree;
+use serde::Serialize;
use style::animation::AnimationSetKey;
use style::dom::OpaqueNode;
use style::values::computed::Length;
diff --git a/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs b/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs
index a9ccbd64e71..48a90d73c64 100644
--- a/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs
+++ b/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs
@@ -4,6 +4,7 @@
use super::Fragment;
use crate::{cell::ArcRefCell, geom::flow_relative::Vec2};
+use serde::Serialize;
use style::values::computed::{Length, LengthPercentage};
/// A reference to a Fragment which is shared between `HoistedAbsolutelyPositionedBox`
diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs
index 83a1c5ea925..04b1294f917 100644
--- a/components/layout_2020/geom.rs
+++ b/components/layout_2020/geom.rs
@@ -20,6 +20,8 @@ pub type LengthOrAuto = AutoOr<Length>;
pub type LengthPercentageOrAuto<'a> = AutoOr<&'a LengthPercentage>;
pub mod flow_relative {
+ use serde::Serialize;
+
#[derive(Clone, Serialize)]
pub struct Vec2<T> {
pub inline: T,
diff --git a/components/layout_2020/layout_debug.rs b/components/layout_2020/layout_debug.rs
index 549075c7595..6720d99e0a2 100644
--- a/components/layout_2020/layout_debug.rs
+++ b/components/layout_2020/layout_debug.rs
@@ -8,7 +8,8 @@
use crate::flow::BoxTree;
use crate::fragment_tree::FragmentTree;
#[cfg(not(debug_assertions))]
-use serde::ser::{Serialize, Serializer};
+use serde::ser::Serializer;
+use serde::Serialize;
use serde_json::{to_string, to_value, Value};
use std::cell::RefCell;
use std::fs;
diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs
index ca23f264c14..15a6a05f029 100644
--- a/components/layout_2020/lib.rs
+++ b/components/layout_2020/lib.rs
@@ -5,11 +5,6 @@
#![deny(unsafe_code)]
#![feature(once_cell)]
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
mod cell;
pub mod context;
pub mod display_list;
diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs
index 21ed3ec904d..eb1b6b30cf4 100644
--- a/components/layout_2020/positioned.rs
+++ b/components/layout_2020/positioned.rs
@@ -16,6 +16,7 @@ use crate::style_ext::{ComputedValuesExt, DisplayInside};
use crate::{ContainingBlock, DefiniteContainingBlock};
use rayon::iter::IntoParallelRefMutIterator;
use rayon::prelude::{IndexedParallelIterator, ParallelIterator};
+use serde::Serialize;
use style::computed_values::position::T as Position;
use style::properties::ComputedValues;
use style::values::computed::{CSSPixelLength, Length};
diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs
index e409f5bdd59..a4f77076901 100644
--- a/components/layout_2020/query.rs
+++ b/components/layout_2020/query.rs
@@ -9,6 +9,7 @@ use app_units::Au;
use euclid::default::{Point2D, Rect};
use euclid::Size2D;
use euclid::Vector2D;
+use log::warn;
use msg::constellation_msg::PipelineId;
use script_layout_interface::rpc::TextIndexResponse;
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs
index b1831335002..1ba87c10265 100644
--- a/components/layout_2020/replaced.rs
+++ b/components/layout_2020/replaced.rs
@@ -15,6 +15,7 @@ use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::Image;
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
+use serde::Serialize;
use servo_arc::Arc as ServoArc;
use std::fmt;
use std::sync::{Arc, Mutex};
diff --git a/components/layout_2020/sizing.rs b/components/layout_2020/sizing.rs
index 48f1070d2f2..9b5671af577 100644
--- a/components/layout_2020/sizing.rs
+++ b/components/layout_2020/sizing.rs
@@ -5,6 +5,7 @@
//! https://drafts.csswg.org/css-sizing/
use crate::style_ext::ComputedValuesExt;
+use serde::Serialize;
use style::logical_geometry::WritingMode;
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
use style::properties::ComputedValues;
diff --git a/components/layout_2020/tests/floats.rs b/components/layout_2020/tests/floats.rs
index cb0cc31d87f..3b4b91c10b8 100644
--- a/components/layout_2020/tests/floats.rs
+++ b/components/layout_2020/tests/floats.rs
@@ -4,8 +4,7 @@
//! Property-based randomized testing for the core float layout algorithm.
-#[macro_use]
-extern crate lazy_static;
+use lazy_static::lazy_static;
use euclid::num::Zero;
use layout_2020::flow::float::{ContainingBlockPositionInfo, FloatSide, PlacementInfo};
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 2202bb123a1..5c8a6ed55c9 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -8,19 +8,8 @@
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate layout;
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate profile_traits;
-
use app_units::Au;
-use crossbeam_channel::{Receiver, Sender};
+use crossbeam_channel::{select, Receiver, Sender};
use embedder_traits::resources::{self, Resource};
use euclid::{default::Size2D as UntypedSize2D, Point2D, Rect, Scale, Size2D};
use fnv::FnvHashMap;
@@ -42,7 +31,6 @@ use layout::display_list::{IndexableText, ToLayout};
use layout::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
use layout::flow_ref::FlowRef;
use layout::incremental::{RelayoutMode, SpecialRestyleDamage};
-use layout::parallel;
use layout::query::{
process_client_rect_query, process_content_box_request, process_content_boxes_request,
process_element_inner_text_query, process_node_scroll_area_request,
@@ -57,7 +45,10 @@ use layout::traversal::{
};
use layout::wrapper::LayoutNodeLayoutData;
use layout::{layout_debug, LayoutData};
+use layout::{layout_debug_scope, parallel};
use layout_traits::LayoutThreadFactory;
+use lazy_static::lazy_static;
+use log::{debug, error, trace, warn};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric};
use msg::constellation_msg::{
@@ -68,6 +59,7 @@ use msg::constellation_msg::{LayoutHangAnnotation, MonitoredComponentType, Pipel
use net_traits::image_cache::{ImageCache, UsePlaceholder};
use parking_lot::RwLock;
use profile_traits::mem::{self as profile_mem, Report, ReportKind, ReportsChan};
+use profile_traits::path;
use profile_traits::time::{self as profile_time, profile, TimerMetadata};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs
index 955faa68597..08bdd01af9c 100644
--- a/components/layout_thread_2020/lib.rs
+++ b/components/layout_thread_2020/lib.rs
@@ -8,17 +8,11 @@
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate profile_traits;
+use lazy_static::lazy_static;
+use log::{debug, error, warn};
use app_units::Au;
-use crossbeam_channel::{Receiver, Sender};
+use crossbeam_channel::{select, Receiver, Sender};
use embedder_traits::resources::{self, Resource};
use euclid::{default::Size2D as UntypedSize2D, Point2D, Rect, Scale, Size2D};
use fnv::FnvHashMap;
@@ -54,6 +48,7 @@ use msg::constellation_msg::{
use net_traits::image_cache::{ImageCache, UsePlaceholder};
use parking_lot::RwLock;
use profile_traits::mem::{self as profile_mem, Report, ReportKind, ReportsChan};
+use profile_traits::path;
use profile_traits::time::{self as profile_time, profile, TimerMetadata};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
diff --git a/components/media/lib.rs b/components/media/lib.rs
index c10ea535369..65e698dcb76 100644
--- a/components/media/lib.rs
+++ b/components/media/lib.rs
@@ -4,13 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
mod media_channel;
mod media_thread;
@@ -18,6 +11,7 @@ pub use crate::media_channel::glplayer_channel;
use crate::media_channel::{GLPlayerChan, GLPlayerPipeline, GLPlayerReceiver, GLPlayerSender};
use crate::media_thread::GLPlayerThread;
use euclid::default::Size2D;
+use serde::{Deserialize, Serialize};
use servo_media::player::context::{GlApi, GlContext, NativeDisplay, PlayerGLContext};
use std::sync::{Arc, Mutex};
use webrender_traits::{
diff --git a/components/media/media_channel/mod.rs b/components/media/media_channel/mod.rs
index 241fec2db77..8997aafce63 100644
--- a/components/media/media_channel/mod.rs
+++ b/components/media/media_channel/mod.rs
@@ -8,6 +8,7 @@ mod ipc;
mod mpsc;
use crate::GLPlayerMsg;
+use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use servo_config::opts;
use std::fmt;
diff --git a/components/media/media_thread.rs b/components/media/media_thread.rs
index a5c889a6286..482762cf607 100644
--- a/components/media/media_thread.rs
+++ b/components/media/media_thread.rs
@@ -7,6 +7,7 @@ use crate::media_channel::{glplayer_channel, GLPlayerSender};
/// constellation.
use crate::{GLPlayerMsg, GLPlayerMsgForward};
use fnv::FnvHashMap;
+use log::{trace, warn};
use std::sync::{Arc, Mutex};
use std::thread;
use webrender_api::ExternalImageId;
diff --git a/components/metrics/lib.rs b/components/metrics/lib.rs
index ad6ef52e3ca..2d6d1186b83 100644
--- a/components/metrics/lib.rs
+++ b/components/metrics/lib.rs
@@ -2,13 +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/. */
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate malloc_size_of_derive;
-
use gfx_traits::Epoch;
use ipc_channel::ipc::IpcSender;
+use log::warn;
+use malloc_size_of_derive::MallocSizeOf;
use msg::constellation_msg::PipelineId;
use profile_traits::time::TimerMetadata;
use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan};
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index 3dcff217485..8f2a04b8cc1 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -6,7 +6,12 @@
//! reduce coupling between these two components.
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use lazy_static::lazy_static;
+use malloc_size_of::malloc_size_of_is_0;
+use malloc_size_of_derive::MallocSizeOf;
use parking_lot::Mutex;
+use serde::{Deserialize, Serialize};
+use size_of_test::size_of_test;
use std::cell::Cell;
use std::fmt;
use std::mem;
diff --git a/components/msg/lib.rs b/components/msg/lib.rs
index 03aa40eb8f1..b2ce3a52c2c 100644
--- a/components/msg/lib.rs
+++ b/components/msg/lib.rs
@@ -4,15 +4,4 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate malloc_size_of;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-#[macro_use]
-extern crate size_of_test;
-
pub mod constellation_msg;
diff --git a/components/net/connector.rs b/components/net/connector.rs
index 65981f25d16..683cd58f176 100644
--- a/components/net/connector.rs
+++ b/components/net/connector.rs
@@ -10,6 +10,7 @@ use hyper::client::HttpConnector as HyperHttpConnector;
use hyper::rt::Executor;
use hyper::{service::Service, Body, Client};
use hyper_rustls::HttpsConnector as HyperRustlsHttpsConnector;
+use log::warn;
use rustls::client::WebPkiVerifier;
use rustls::{Certificate, ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
use std::collections::hash_map::HashMap;
diff --git a/components/net/cookie.rs b/components/net/cookie.rs
index 3c0b904496d..804bdf4e4fa 100644
--- a/components/net/cookie.rs
+++ b/components/net/cookie.rs
@@ -8,6 +8,7 @@
use hyper_serde::Serde;
use net_traits::pub_domains::is_pub_domain;
use net_traits::CookieSource;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::net::{Ipv4Addr, Ipv6Addr};
diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs
index 380f2ece094..16508de4d17 100644
--- a/components/net/cookie_storage.rs
+++ b/components/net/cookie_storage.rs
@@ -6,8 +6,10 @@
//! http://tools.ietf.org/html/rfc6265
use crate::cookie::Cookie;
+use log::{debug, info};
use net_traits::pub_domains::reg_suffix;
use net_traits::CookieSource;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
use std::cmp::Ordering;
use std::collections::hash_map::Entry;
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index cb32e7a62d2..1cac2297921 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -18,6 +18,8 @@ use http::header::{self, HeaderMap, HeaderName};
use http::Method;
use http::StatusCode;
use ipc_channel::ipc::{self, IpcReceiver};
+use lazy_static::lazy_static;
+use log::{debug, warn};
use mime::{self, Mime};
use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError};
use net_traits::filemanager_thread::{FileTokenCheck, RelativePos};
@@ -32,6 +34,7 @@ use net_traits::response::{Response, ResponseBody, ResponseType};
use net_traits::{FetchTaskTarget, NetworkError, ReferrerPolicy, ResourceFetchTiming};
use net_traits::{ResourceAttribute, ResourceTimeValue, ResourceTimingType};
use rustls::Certificate;
+use serde::{Deserialize, Serialize};
use servo_arc::Arc as ServoArc;
use servo_url::ServoUrl;
use std::borrow::Cow;
diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs
index bc217874981..db4ce200bdd 100644
--- a/components/net/filemanager_thread.rs
+++ b/components/net/filemanager_thread.rs
@@ -8,6 +8,7 @@ use embedder_traits::{EmbedderMsg, EmbedderProxy, FilterPattern};
use headers::{ContentLength, ContentType, HeaderMap, HeaderMapExt};
use http::header::{self, HeaderValue};
use ipc_channel::ipc::{self, IpcSender};
+use log::warn;
use mime::{self, Mime};
use net_traits::blob_url_store::{BlobBuf, BlobURLStoreError};
use net_traits::filemanager_thread::{
@@ -19,6 +20,7 @@ use net_traits::filemanager_thread::{
use net_traits::http_percent_encode;
use net_traits::response::{Response, ResponseBody};
use servo_arc::Arc as ServoArc;
+use servo_config::pref;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
diff --git a/components/net/hosts.rs b/components/net/hosts.rs
index 132a6e579fe..7f869c30fb7 100644
--- a/components/net/hosts.rs
+++ b/components/net/hosts.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 lazy_static::lazy_static;
use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
diff --git a/components/net/hsts.rs b/components/net/hsts.rs
index de78e342ee8..4ebe0262064 100644
--- a/components/net/hsts.rs
+++ b/components/net/hsts.rs
@@ -5,8 +5,10 @@
use embedder_traits::resources::{self, Resource};
use headers::{HeaderMapExt, StrictTransportSecurity};
use http::HeaderMap;
+use log::info;
use net_traits::pub_domains::reg_suffix;
use net_traits::IncludeSubdomains;
+use serde::{Deserialize, Serialize};
use servo_config::pref;
use servo_url::{Host, ServoUrl};
use std::collections::HashMap;
diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs
index 31f171c1c28..09aabc473e3 100644
--- a/components/net/http_cache.rs
+++ b/components/net/http_cache.rs
@@ -13,14 +13,17 @@ use headers::{
};
use http::header::HeaderValue;
use http::{header, HeaderMap, Method, StatusCode};
+use log::debug;
use malloc_size_of::Measurable;
use malloc_size_of::{
MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf, MallocUnconditionalSizeOf,
};
+use malloc_size_of_derive::MallocSizeOf;
use net_traits::request::Request;
use net_traits::response::{HttpsState, Response, ResponseBody};
use net_traits::{FetchMetadata, Metadata, ResourceFetchTiming};
use servo_arc::Arc;
+use servo_config::pref;
use servo_url::ServoUrl;
use std::collections::HashMap;
use std::ops::Bound;
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index d1decdb70da..188038ccc38 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -40,6 +40,8 @@ use hyper::{Body, Client, Response as HyperResponse};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
+use lazy_static::lazy_static;
+use log::{debug, error, info, log_enabled, warn};
use msg::constellation_msg::{HistoryStateId, PipelineId};
use net_traits::pub_domains::reg_suffix;
use net_traits::quality::{quality_to_value, Quality, QualityItem};
diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs
index 0d7103b1267..22c5179ff7c 100644
--- a/components/net/image_cache.rs
+++ b/components/net/image_cache.rs
@@ -5,6 +5,7 @@
use embedder_traits::resources::{self, Resource};
use imsz::imsz_from_reader;
use ipc_channel::ipc::IpcSender;
+use log::{debug, warn};
use net_traits::image::base::{load_from_memory, Image, ImageMetadata};
use net_traits::image_cache::{
CorsStatus, ImageCache, ImageCacheResult, ImageResponder, PendingImageResponse,
diff --git a/components/net/lib.rs b/components/net/lib.rs
index 2c19e895bc5..69a800489bc 100644
--- a/components/net/lib.rs
+++ b/components/net/lib.rs
@@ -4,19 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate profile_traits;
-#[macro_use]
-extern crate serde;
-#[macro_use]
-extern crate servo_config;
-
pub mod connector;
pub mod cookie;
pub mod cookie_storage;
diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs
index a4314fbe8df..aa3f342cea1 100644
--- a/components/net/resource_thread.rs
+++ b/components/net/resource_thread.rs
@@ -22,6 +22,7 @@ use devtools_traits::DevtoolsControlMsg;
use embedder_traits::EmbedderProxy;
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcReceiver, IpcReceiverSet, IpcSender};
+use log::{debug, warn};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use net_traits::blob_url_store::parse_blob_url;
use net_traits::filemanager_thread::FileTokenCheck;
@@ -37,6 +38,7 @@ use net_traits::{ResourceFetchTiming, ResourceTimingType};
use net_traits::{ResourceThreads, WebSocketDomAction};
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::mem::{Report, ReportKind, ReportsChan};
+use profile_traits::path;
use profile_traits::time::ProfilerChan;
use rustls::RootCertStore;
use serde::{Deserialize, Serialize};
diff --git a/components/net/tests/main.rs b/components/net/tests/main.rs
index 7a0f4955cd5..675dc4ec7af 100644
--- a/components/net/tests/main.rs
+++ b/components/net/tests/main.rs
@@ -5,9 +5,6 @@
#![cfg(test)]
#![allow(dead_code)]
-#[macro_use]
-extern crate lazy_static;
-
mod cookie;
mod cookie_http_state;
mod data_loader;
@@ -31,6 +28,7 @@ use hyper::server::conn::Http;
use hyper::server::Server as HyperServer;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request as HyperRequest, Response as HyperResponse};
+use lazy_static::lazy_static;
use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::{self, CancellationListener, FetchContext};
use net::filemanager_thread::FileManager;
diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs
index 140a57f4a30..af2e9565eba 100644
--- a/components/net/websocket_loader.rs
+++ b/components/net/websocket_loader.rs
@@ -25,6 +25,8 @@ use futures::stream::StreamExt;
use http::header::{self, HeaderName, HeaderValue};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
+use lazy_static::lazy_static;
+use log::{debug, trace, warn};
use net_traits::request::{RequestBuilder, RequestMode};
use net_traits::{CookieSource, MessageData};
use net_traits::{WebSocketDomAction, WebSocketNetworkEvent};
diff --git a/components/net_traits/blob_url_store.rs b/components/net_traits/blob_url_store.rs
index 16d6b620108..92d7f1f7360 100644
--- a/components/net_traits/blob_url_store.rs
+++ b/components/net_traits/blob_url_store.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::filemanager_thread::FileOrigin;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
use std::str::FromStr;
use url::Url;
diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs
index 50eb0ded238..79b85e7d59d 100644
--- a/components/net_traits/filemanager_thread.rs
+++ b/components/net_traits/filemanager_thread.rs
@@ -5,7 +5,9 @@
use crate::blob_url_store::{BlobBuf, BlobURLStoreError};
use embedder_traits::FilterPattern;
use ipc_channel::ipc::IpcSender;
+use malloc_size_of_derive::MallocSizeOf;
use num_traits::ToPrimitive;
+use serde::{Deserialize, Serialize};
use std::cmp::{max, min};
use std::ops::Range;
use std::path::PathBuf;
diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs
index 4f5285b065a..d34610cf9c5 100644
--- a/components/net_traits/image/base.rs
+++ b/components/net_traits/image/base.rs
@@ -5,7 +5,10 @@
use crate::image_cache::CorsStatus;
use image::ImageFormat;
use ipc_channel::ipc::IpcSharedMemory;
+use log::debug;
+use malloc_size_of_derive::MallocSizeOf;
use pixels::PixelFormat;
+use serde::{Deserialize, Serialize};
use std::fmt;
use webrender_api::ImageKey;
diff --git a/components/net_traits/image_cache.rs b/components/net_traits/image_cache.rs
index e3c1a565881..ee30738c77d 100644
--- a/components/net_traits/image_cache.rs
+++ b/components/net_traits/image_cache.rs
@@ -7,6 +7,9 @@ use crate::request::CorsSettings;
use crate::FetchResponseMsg;
use crate::WebrenderIpcSender;
use ipc_channel::ipc::IpcSender;
+use log::debug;
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use servo_url::{ImmutableOrigin, ServoUrl};
use std::sync::Arc;
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index c3816e1494b..0ba5e6c9a56 100644
--- a/components/net_traits/lib.rs
+++ b/components/net_traits/lib.rs
@@ -4,17 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate malloc_size_of;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
use crate::filemanager_thread::FileManagerThreadMsg;
use crate::request::{Request, RequestBuilder};
use crate::response::{HttpsState, Response, ResponseInit};
@@ -28,9 +17,14 @@ use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error as IpcError;
+use lazy_static::lazy_static;
+use log::warn;
+use malloc_size_of::malloc_size_of_is_0;
+use malloc_size_of_derive::MallocSizeOf;
use mime::Mime;
use msg::constellation_msg::HistoryStateId;
use rustls::Certificate;
+use serde::{Deserialize, Serialize};
use servo_rand::RngCore;
use servo_url::{ImmutableOrigin, ServoUrl};
use time::precise_time_ns;
diff --git a/components/net_traits/pub_domains.rs b/components/net_traits/pub_domains.rs
index 95090791f2b..f5cbbcea7cc 100644
--- a/components/net_traits/pub_domains.rs
+++ b/components/net_traits/pub_domains.rs
@@ -15,6 +15,7 @@
//! those cases are not present.
use embedder_traits::resources::{self, Resource};
+use lazy_static::lazy_static;
use servo_url::{Host, ImmutableOrigin, ServoUrl};
use std::collections::HashSet;
use std::iter::FromIterator;
diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs
index 3a76d3d5185..8466cc9bbfd 100644
--- a/components/net_traits/request.rs
+++ b/components/net_traits/request.rs
@@ -10,8 +10,11 @@ use http::header::{HeaderName, AUTHORIZATION};
use http::HeaderMap;
use http::Method;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use malloc_size_of_derive::MallocSizeOf;
use mime::Mime;
use msg::constellation_msg::PipelineId;
+use serde::Deserialize;
+use serde::Serialize;
use servo_url::{ImmutableOrigin, ServoUrl};
use std::sync::{Arc, Mutex};
diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs
index 15949731b8f..f6ea9fe3064 100644
--- a/components/net_traits/response.rs
+++ b/components/net_traits/response.rs
@@ -9,6 +9,8 @@ use crate::{ResourceFetchTiming, ResourceTimingType};
use headers::{ContentType, HeaderMapExt};
use http::{HeaderMap, StatusCode};
use hyper_serde::Serde;
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use servo_arc::Arc;
use servo_url::ServoUrl;
use std::sync::atomic::AtomicBool;
diff --git a/components/net_traits/storage_thread.rs b/components/net_traits/storage_thread.rs
index ad6563aa684..0253603016e 100644
--- a/components/net_traits/storage_thread.rs
+++ b/components/net_traits/storage_thread.rs
@@ -3,6 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc::IpcSender;
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
diff --git a/components/pixels/lib.rs b/components/pixels/lib.rs
index 88d845a3033..46a567d78e9 100644
--- a/components/pixels/lib.rs
+++ b/components/pixels/lib.rs
@@ -2,11 +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/. */
-#[macro_use]
-extern crate serde;
-
use euclid::default::{Point2D, Rect, Size2D};
use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use std::borrow::Cow;
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
diff --git a/components/profile/lib.rs b/components/profile/lib.rs
index b41e26ba963..6321decd9c0 100644
--- a/components/profile/lib.rs
+++ b/components/profile/lib.rs
@@ -4,11 +4,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate profile_traits;
-#[macro_use]
-extern crate serde;
-
#[allow(unsafe_code)]
pub mod mem;
pub mod time;
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 45460ec6c90..5bdd8a09e09 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -9,6 +9,7 @@ use ipc_channel::ipc::{self, IpcReceiver};
use ipc_channel::router::ROUTER;
use profile_traits::mem::ReportsChan;
use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest};
+use profile_traits::path;
use std::borrow::ToOwned;
use std::cmp::Ordering;
use std::collections::HashMap;
@@ -389,6 +390,7 @@ mod system_reporter {
#[cfg(not(target_os = "windows"))]
use libc::{c_void, size_t};
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
+ use profile_traits::path;
#[cfg(not(target_os = "windows"))]
use std::ffi::CString;
#[cfg(not(target_os = "windows"))]
diff --git a/components/profile/trace_dump.rs b/components/profile/trace_dump.rs
index 2833e3bd26d..79dd3faeda0 100644
--- a/components/profile/trace_dump.rs
+++ b/components/profile/trace_dump.rs
@@ -5,6 +5,7 @@
//! A module for writing time profiler traces out to a self contained HTML file.
use profile_traits::time::{ProfilerCategory, TimerMetadata};
+use serde::Serialize;
use std::fs;
use std::io::{self, Write};
use std::path;
diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs
index 7e0ce8166d0..7be3d265d6c 100644
--- a/components/profile_traits/lib.rs
+++ b/components/profile_traits/lib.rs
@@ -8,11 +8,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
pub mod ipc;
pub mod mem;
pub mod time;
diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs
index 56f10ee3557..ab76b774f77 100644
--- a/components/profile_traits/mem.rs
+++ b/components/profile_traits/mem.rs
@@ -9,6 +9,8 @@
use crossbeam_channel::Sender;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
+use log::warn;
+use serde::{Deserialize, Serialize};
use std::marker::Send;
/// A trait to abstract away the various kinds of message senders we use.
diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs
index 53868ef9b7a..cbc8fa42741 100644
--- a/components/profile_traits/time.rs
+++ b/components/profile_traits/time.rs
@@ -3,6 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc::IpcSender;
+use log::warn;
+use serde::{Deserialize, Serialize};
use servo_config::opts;
use time::precise_time_ns;
diff --git a/components/rand/lib.rs b/components/rand/lib.rs
index 263f9dd5a2c..0fb17a5f8ab 100644
--- a/components/rand/lib.rs
+++ b/components/rand/lib.rs
@@ -2,6 +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 lazy_static::lazy_static;
+use log::trace;
/// A random number generator which shares one instance of an `OsRng`.
///
/// A problem with `OsRng`, which is inherited by `StdRng` and so
@@ -11,12 +13,6 @@
///
/// This crate fixes that, by only using one `OsRng`, which is just
/// used to seed and re-seed an `ServoRng`.
-
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-
use rand::distributions::{Distribution, Standard};
use rand::rngs::adapter::ReseedingRng;
use rand::rngs::OsRng;
diff --git a/components/range/lib.rs b/components/range/lib.rs
index b968eacb3b0..9c904f630df 100644
--- a/components/range/lib.rs
+++ b/components/range/lib.rs
@@ -4,11 +4,8 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use std::cmp::{self, max, min};
use std::fmt;
use std::ops;
diff --git a/components/remutex/lib.rs b/components/remutex/lib.rs
index bf897a8928a..60329e8a46d 100644
--- a/components/remutex/lib.rs
+++ b/components/remutex/lib.rs
@@ -10,17 +10,14 @@
//! It provides the same interface as https://github.com/rust-lang/rust/blob/5edaa7eefd76d4996dcf85dfc1c1a3f737087257/src/libstd/sys_common/remutex.rs
//! so if those types are ever exported, we should be able to replace this implemtation.
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate log;
-
use std::cell::{Cell, UnsafeCell};
use std::num::NonZeroUsize;
use std::ops::Deref;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{LockResult, Mutex, MutexGuard, PoisonError, TryLockError, TryLockResult};
+use log::trace;
+
/// A type for thread ids.
// TODO: can we use the thread-id crate for this?
@@ -28,7 +25,7 @@ use std::sync::{LockResult, Mutex, MutexGuard, PoisonError, TryLockError, TryLoc
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ThreadId(NonZeroUsize);
-lazy_static! {
+lazy_static::lazy_static! {
static ref THREAD_COUNT: AtomicUsize = AtomicUsize::new(1);
}
diff --git a/components/script/animation_timeline.rs b/components/script/animation_timeline.rs
index 54127b94e9e..ea2a88af380 100644
--- a/components/script/animation_timeline.rs
+++ b/components/script/animation_timeline.rs
@@ -7,6 +7,7 @@
//! A timeline module, used to specify an `AnimationTimeline` which determines
//! the time used for synchronizing animations in the script thread.
+use jstraceable_derive::JSTraceable;
use time;
/// A `AnimationTimeline` which is used to synchronize animations during the script
diff --git a/components/script/animations.rs b/components/script/animations.rs
index 531d941d6f9..752deb5c9b4 100644
--- a/components/script/animations.rs
+++ b/components/script/animations.rs
@@ -23,6 +23,7 @@ use fxhash::{FxHashMap, FxHashSet};
use libc::c_void;
use msg::constellation_msg::PipelineId;
use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg, UntrustedNodeAddress};
+use serde::{Deserialize, Serialize};
use std::cell::Cell;
use style::animation::{
Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
diff --git a/components/script/dom/abstractworkerglobalscope.rs b/components/script/dom/abstractworkerglobalscope.rs
index 0bf298e1a4e..0261c82996c 100644
--- a/components/script/dom/abstractworkerglobalscope.rs
+++ b/components/script/dom/abstractworkerglobalscope.rs
@@ -12,7 +12,7 @@ use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::realms::enter_realm;
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
use crate::task_queue::{QueuedTaskConversion, TaskQueue};
-use crossbeam_channel::{Receiver, Sender};
+use crossbeam_channel::{select, Receiver, Sender};
use devtools_traits::DevtoolScriptControlMsg;
/// A ScriptChan that can be cloned freely and will silently send a TrustedWorkerAddress with
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index 2ad3d60bbbd..e8fce0493bc 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -16,7 +16,7 @@ use crate::dom::virtualmethods::vtable_for;
use crate::script_thread::ScriptThread;
use devtools_traits::AttrInfo;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Namespace, Prefix};
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
use servo_atoms::Atom;
use std::borrow::ToOwned;
use std::mem;
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 37cf8385d87..6676e977737 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -8040,7 +8040,7 @@ class GlobalGenRoots():
CGGeneric("const %s = %#x;" % args)
for args in flags
], "\n")), pre="#[derive(Clone, Copy)]\npub struct Globals: u8 {\n", post="\n}")
- globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags! {\n", post="\n}")
+ globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags::bitflags! {\n", post="\n}")
phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));")
diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs
index 8a16cf2e6de..9a2c037de46 100644
--- a/components/script/dom/bindings/htmlconstructor.rs
+++ b/components/script/dom/bindings/htmlconstructor.rs
@@ -84,7 +84,7 @@ use crate::dom::window::Window;
use crate::script_runtime::JSContext;
use crate::script_thread::ScriptThread;
use html5ever::interface::QualName;
-use html5ever::LocalName;
+use html5ever::{local_name, namespace_url, ns, LocalName};
use js::conversions::ToJSValConvertible;
use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
use js::jsapi::{CallArgs, CurrentGlobalOrNull};
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 2a9a974bac9..ef772ce355c 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -7,6 +7,7 @@ use chrono::prelude::{Utc, Weekday};
use chrono::{Datelike, TimeZone};
use cssparser::CowRcStr;
use html5ever::{LocalName, Namespace};
+use lazy_static::lazy_static;
use regex::Regex;
use servo_atoms::Atom;
use std::borrow::{Borrow, Cow, ToOwned};
diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs
index b4e6aab289f..672f8c522b3 100644
--- a/components/script/dom/bindings/xmlname.rs
+++ b/components/script/dom/bindings/xmlname.rs
@@ -6,7 +6,7 @@
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::str::DOMString;
-use html5ever::{LocalName, Namespace, Prefix};
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
/// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details.
pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs
index 087148cb037..48064fe2f3e 100644
--- a/components/script/dom/create.rs
+++ b/components/script/dom/create.rs
@@ -84,7 +84,7 @@ use crate::dom::svgelement::SVGElement;
use crate::dom::svgsvgelement::SVGSVGElement;
use crate::realms::{enter_realm, InRealm};
use crate::script_thread::ScriptThread;
-use html5ever::{LocalName, Prefix, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
use js::rust::HandleObject;
use servo_config::pref;
diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs
index 0734f46abd1..df0ab6134e9 100644
--- a/components/script/dom/cssrulelist.rs
+++ b/components/script/dom/cssrulelist.rs
@@ -14,11 +14,11 @@ use crate::dom::cssrule::CSSRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::window::Window;
-use crate::style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use crate::stylesheet_loader::StylesheetLoader;
use dom_struct::dom_struct;
use servo_arc::Arc;
use style::shared_lock::Locked;
+use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use style::stylesheets::{
AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
};
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index a2cc459d94c..0e4e541ecf2 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -14,6 +14,7 @@ use crate::dom::element::Element;
use crate::dom::node::{document_from_node, stylesheets_owner_from_node, window_from_node, Node};
use crate::dom::window::Window;
use dom_struct::dom_struct;
+use html5ever::local_name;
use servo_arc::Arc;
use servo_url::ServoUrl;
use style::attr::AttrValue;
@@ -475,5 +476,5 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-_camel_cased_attribute
- css_properties_accessors!(css_properties);
+ style::css_properties_accessors!(css_properties);
}
diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs
index ba36a2d30df..9439e7e95bc 100644
--- a/components/script/dom/customelementregistry.rs
+++ b/components/script/dom/customelementregistry.rs
@@ -34,7 +34,7 @@ use crate::realms::{enter_realm, InRealm};
use crate::script_runtime::JSContext;
use crate::script_thread::ScriptThread;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Namespace, Prefix};
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
use js::conversions::ToJSValConvertible;
use js::glue::UnwrapObjectStatic;
use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor};
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index c3d83be6966..c34ed1128d0 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -114,17 +114,19 @@ use crate::timers::OneshotTimerCallback;
use canvas_traits::webgl::{self, WebGLContextId, WebGLMsg};
use content_security_policy::{self as csp, CspList};
use cookie::Cookie;
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
use devtools_traits::ScriptToDevtoolsControlMsg;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
use encoding_rs::{Encoding, UTF_8};
use euclid::default::{Point2D, Rect, Size2D};
-use html5ever::{LocalName, Namespace, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::JSObject;
use js::rust::HandleObject;
use keyboard_types::{Code, Key, KeyState};
+use lazy_static::lazy_static;
use metrics::{
InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
ProgressiveWebMetric,
diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs
index 1a07c1b5e8c..95a62b19efa 100644
--- a/components/script/dom/domimplementation.rs
+++ b/components/script/dom/domimplementation.rs
@@ -26,6 +26,7 @@ use crate::dom::node::Node;
use crate::dom::text::Text;
use crate::dom::xmldocument::XMLDocument;
use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns};
use script_traits::DocumentActivity;
// https://dom.spec.whatwg.org/#domimplementation
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index 1e01cea8070..0d8b4908f53 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -11,7 +11,7 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::element::Element;
use crate::dom::node::window_from_node;
use dom_struct::dom_struct;
-use html5ever::LocalName;
+use html5ever::{namespace_url, ns, LocalName};
use servo_atoms::Atom;
use style::str::HTML_SPACE_CHARACTERS;
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index ed04d2e562c..ecbc3c8c097 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -84,6 +84,7 @@ use crate::dom::window::ReflowReason;
use crate::script_thread::ScriptThread;
use crate::stylesheet_loader::StylesheetOwner;
use crate::task::TaskOnce;
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
use devtools_traits::AttrInfo;
use dom_struct::dom_struct;
use euclid::default::Rect;
@@ -92,7 +93,9 @@ use html5ever::serialize;
use html5ever::serialize::SerializeOpts;
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
-use html5ever::{LocalName, Namespace, Prefix, QualName};
+use html5ever::{
+ local_name, namespace_prefix, namespace_url, ns, LocalName, Namespace, Prefix, QualName,
+};
use js::jsapi::Heap;
use js::jsval::JSVal;
use js::rust::HandleObject;
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index dde317955cc..83180485ec1 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -34,6 +34,7 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::Window;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::realms::{enter_realm, InRealm};
+use deny_public_fields::DenyPublicFields;
use dom_struct::dom_struct;
use fnv::FnvHasher;
use js::jsapi::JS_GetFunctionObject;
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index d52ab647509..c16b55b88fb 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -28,7 +28,7 @@ use crate::dom::urlhelper::UrlHelper;
use crate::dom::virtualmethods::VirtualMethods;
use crate::task_source::TaskSource;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use net_traits::request::Referrer;
use num_traits::ToPrimitive;
diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs
index 0df17d1b857..5a3a3e645b4 100644
--- a/components/script/dom/htmlareaelement.rs
+++ b/components/script/dom/htmlareaelement.rs
@@ -16,9 +16,10 @@ use crate::dom::htmlanchorelement::follow_hyperlink;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
use dom_struct::dom_struct;
use euclid::default::Point2D;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use servo_atoms::Atom;
use std::default::Default;
diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs
index 1a2de74832e..7040dd80b59 100644
--- a/components/script/dom/htmlaudioelement.rs
+++ b/components/script/dom/htmlaudioelement.rs
@@ -14,7 +14,7 @@ use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::node::Node;
use crate::dom::window::Window;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs
index 29fd459458a..72e8ab85a08 100644
--- a/components/script/dom/htmlbaseelement.rs
+++ b/components/script/dom/htmlbaseelement.rs
@@ -13,7 +13,7 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use servo_url::ServoUrl;
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index d3408db6386..28587611603 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -17,7 +17,7 @@ use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
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 14f5d6abcaf..59abe891603 100755
--- a/components/script/dom/htmlbuttonelement.rs
+++ b/components/script/dom/htmlbuttonelement.rs
@@ -23,7 +23,7 @@ use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable};
use crate::dom::validitystate::{ValidationFlags, ValidityState};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, LocalName, Prefix};
use js::rust::HandleObject;
use std::cell::Cell;
use std::default::Default;
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index c5d46f3f42c..03c4061938e 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -35,7 +35,7 @@ use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
use canvas_traits::webgl::{GLContextAttributes, WebGLVersion};
use dom_struct::dom_struct;
use euclid::default::{Rect, Size2D};
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use image::codecs::png::PngEncoder;
use image::{ColorType, ImageEncoder};
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 02a225fb9b6..8bf1135ed73 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -13,7 +13,7 @@ use crate::dom::element::Element;
use crate::dom::node::{document_from_node, Node};
use crate::dom::window::Window;
use dom_struct::dom_struct;
-use html5ever::{LocalName, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, QualName};
use servo_atoms::Atom;
use std::cell::Cell;
use style::str::split_html_space_chars;
diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs
index 6996164fe00..bec0e4dbbf6 100644
--- a/components/script/dom/htmldetailselement.rs
+++ b/components/script/dom/htmldetailselement.rs
@@ -15,7 +15,7 @@ use crate::dom::node::{window_from_node, Node, NodeDamage};
use crate::dom::virtualmethods::VirtualMethods;
use crate::task_source::TaskSource;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use std::cell::Cell;
diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs
index b907e3d3912..88d4cc545f5 100644
--- a/components/script/dom/htmldialogelement.rs
+++ b/components/script/dom/htmldialogelement.rs
@@ -13,7 +13,7 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{window_from_node, Node};
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index c2c2bb29a7f..abfcb4f6151 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -35,7 +35,7 @@ use crate::dom::node::{Node, ShadowIncluding};
use crate::dom::text::Text;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use script_layout_interface::message::QueryMsg;
use std::collections::HashSet;
diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs
index 1b7f325425a..881bf0d64b4 100644
--- a/components/script/dom/htmlfieldsetelement.rs
+++ b/components/script/dom/htmlfieldsetelement.rs
@@ -18,7 +18,7 @@ use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use std::default::Default;
use style::element_state::ElementState;
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index 8ec432cf504..453a1d5c96f 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -14,7 +14,7 @@ use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use servo_atoms::Atom;
use style::attr::AttrValue;
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 9a1cdc40555..5ec6e76ae80 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -60,7 +60,7 @@ use crate::task_source::TaskSource;
use dom_struct::dom_struct;
use encoding_rs::{Encoding, UTF_8};
use headers::{ContentType, HeaderMapExt};
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use http::Method;
use js::rust::HandleObject;
use mime::{self, Mime};
diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs
index 81c0f4bd777..cbb22801fef 100644
--- a/components/script/dom/htmlheadelement.rs
+++ b/components/script/dom/htmlheadelement.rs
@@ -13,7 +13,7 @@ use crate::dom::node::{document_from_node, BindContext, Node, ShadowIncluding};
use crate::dom::userscripts::load_script;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs
index d553e8f3261..13ab5786be9 100644
--- a/components/script/dom/htmlhrelement.rs
+++ b/components/script/dom/htmlhrelement.rs
@@ -13,7 +13,7 @@ use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 99a4fd15a11..a16aaa9abfa 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -25,8 +25,9 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::ReflowReason;
use crate::dom::windowproxy::WindowProxy;
use crate::script_thread::ScriptThread;
+use bitflags::bitflags;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use ipc_channel::ipc;
use js::rust::HandleObject;
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index cd6e27537e5..d02a850ccb8 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -53,7 +53,7 @@ use app_units::{Au, AU_PER_PX};
use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
use euclid::Point2D;
-use html5ever::{LocalName, Prefix, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
use ipc_channel::ipc;
use ipc_channel::ipc::IpcSender;
use ipc_channel::router::ROUTER;
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index d6f4d42b6b5..2e6911203ea 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -54,7 +54,7 @@ use chrono::{Datelike, Weekday};
use dom_struct::dom_struct;
use embedder_traits::FilterPattern;
use encoding_rs::Encoding;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::jsapi::{
ClippedTime, DateGetMsecSinceEpoch, Handle, JSObject, JS_ClearPendingException, NewDateObject,
NewUCRegExpObject, ObjectIsDate, RegExpFlag_Unicode, RegExpFlags,
diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs
index e42bc8b508d..07de5963ee1 100644
--- a/components/script/dom/htmllabelelement.rs
+++ b/components/script/dom/htmllabelelement.rs
@@ -21,7 +21,7 @@ use crate::dom::htmlformelement::{FormControl, FormControlElementHelpers, HTMLFo
use crate::dom::node::{Node, ShadowIncluding};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::AttrValue;
diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs
index e2e2248272d..1ba7237b76f 100644
--- a/components/script/dom/htmllielement.rs
+++ b/components/script/dom/htmllielement.rs
@@ -11,7 +11,7 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::AttrValue;
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 6b833d6473a..c6d03721c46 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -28,7 +28,7 @@ use crate::stylesheet_loader::{StylesheetContextSource, StylesheetLoader, Styles
use cssparser::{Parser as CssParser, ParserInput};
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use net_traits::ReferrerPolicy;
use servo_arc::Arc;
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 5fae503be08..405916adcaa 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -70,7 +70,7 @@ 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::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use http::header::{self, HeaderMap, HeaderValue};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs
index 348e52d9ee2..447d40b6a78 100755
--- a/components/script/dom/htmlobjectelement.rs
+++ b/components/script/dom/htmlobjectelement.rs
@@ -17,7 +17,7 @@ use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use net_traits::image::base::Image;
use servo_arc::Arc;
diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs
index 0f737bcd521..499f88aa93b 100644
--- a/components/script/dom/htmloptgroupelement.rs
+++ b/components/script/dom/htmloptgroupelement.rs
@@ -16,7 +16,7 @@ use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidationFlags;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use style::element_state::ElementState;
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index d11b221f0df..3d5abc655c0 100644
--- a/components/script/dom/htmloptionelement.rs
+++ b/components/script/dom/htmloptionelement.rs
@@ -27,7 +27,7 @@ use crate::dom::validitystate::ValidationFlags;
use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::Window;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix, QualName};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
use js::rust::HandleObject;
use std::cell::Cell;
use std::convert::TryInto;
diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs
index a4b47a2b49b..4c826eb8ce4 100644
--- a/components/script/dom/htmloptionscollection.rs
+++ b/components/script/dom/htmloptionscollection.rs
@@ -22,6 +22,7 @@ use crate::dom::htmlselectelement::HTMLSelectElement;
use crate::dom::node::{document_from_node, Node};
use crate::dom::window::Window;
use dom_struct::dom_struct;
+use html5ever::local_name;
#[dom_struct]
pub struct HTMLOptionsCollection {
diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs
index 533fc953d5c..6d8033fe299 100644
--- a/components/script/dom/htmloutputelement.rs
+++ b/components/script/dom/htmloutputelement.rs
@@ -18,7 +18,7 @@ use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs
index 917ed3f592e..dc19a7a63f9 100644
--- a/components/script/dom/htmlprogresselement.rs
+++ b/components/script/dom/htmlprogresselement.rs
@@ -12,7 +12,7 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::nodelist::NodeList;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index dfadc364ded..30c6ad7fb47 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -40,7 +40,7 @@ use content_security_policy as csp;
use core::ffi::c_void;
use dom_struct::dom_struct;
use encoding_rs::Encoding;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::jsapi::{CanCompileOffThread, CompileToStencilOffThread1, OffThreadToken};
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs
index 0cfda5bfaa6..04d52ae695d 100755
--- a/components/script/dom/htmlselectelement.rs
+++ b/components/script/dom/htmlselectelement.rs
@@ -30,7 +30,7 @@ use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable};
use crate::dom::validitystate::{ValidationFlags, ValidityState};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use std::default::Default;
use std::iter;
diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs
index e8b542c7a4c..91e33e1ea9a 100644
--- a/components/script/dom/htmlsourceelement.rs
+++ b/components/script/dom/htmlsourceelement.rs
@@ -17,7 +17,7 @@ use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::node::{BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
#[dom_struct]
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index e2ffb441f73..846c1ccf59e 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -20,7 +20,7 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner};
use cssparser::{Parser as CssParser, ParserInput};
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use net_traits::ReferrerPolicy;
use servo_arc::Arc;
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index 68daaa76614..9db63e6ffe0 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -16,7 +16,7 @@ use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::QuirksMode;
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index 6ce8c0569e1..189eac21a17 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -22,7 +22,7 @@ use crate::dom::node::{document_from_node, window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use std::cell::Cell;
use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs
index 6e8eb34899e..43006a85757 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -21,7 +21,7 @@ use crate::dom::node::{window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::AttrValue;
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index 03cddf7bdd4..ccaf409e10a 100644
--- a/components/script/dom/htmltablesectionelement.rs
+++ b/components/script/dom/htmltablesectionelement.rs
@@ -17,7 +17,7 @@ use crate::dom::node::{window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
use cssparser::RGBA;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::AttrValue;
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 6ff51963348..2220058db98 100755
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -36,7 +36,7 @@ use crate::textinput::{
Direction, KeyReaction, Lines, SelectionDirection, TextInput, UTF16CodeUnits, UTF8Bytes,
};
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use script_traits::ScriptToConstellationChan;
use std::cell::Cell;
diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs
index 05ceed14f1e..08e450aea52 100644
--- a/components/script/dom/htmltrackelement.rs
+++ b/components/script/dom/htmltrackelement.rs
@@ -14,7 +14,7 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::texttrack::TextTrack;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs
index 45e843d0efc..828f8d6f4a8 100644
--- a/components/script/dom/htmlvideoelement.rs
+++ b/components/script/dom/htmlvideoelement.rs
@@ -23,7 +23,7 @@ use crate::image_listener::{generate_cache_listener_for_element, ImageCacheListe
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use dom_struct::dom_struct;
use euclid::default::Size2D;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::rust::HandleObject;
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs
index fd17d64d4f7..4b32a54d6aa 100644
--- a/components/script/dom/macros.rs
+++ b/components/script/dom/macros.rs
@@ -9,7 +9,7 @@ macro_rules! make_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.get_string_attribute(&local_name!($htmlname))
+ element.get_string_attribute(&html5ever::local_name!($htmlname))
}
);
);
@@ -21,7 +21,7 @@ macro_rules! make_bool_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.has_attribute(&local_name!($htmlname))
+ element.has_attribute(&html5ever::local_name!($htmlname))
}
);
);
@@ -40,7 +40,7 @@ macro_rules! make_limited_int_setter(
};
let element = self.upcast::<Element>();
- element.set_int_attribute(&local_name!($htmlname), value);
+ element.set_int_attribute(&html5ever::local_name!($htmlname), value);
Ok(())
}
);
@@ -54,7 +54,7 @@ macro_rules! make_int_setter(
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.set_int_attribute(&local_name!($htmlname), value)
+ element.set_int_attribute(&html5ever::local_name!($htmlname), value)
}
);
($attr:ident, $htmlname:tt) => {
@@ -69,7 +69,7 @@ macro_rules! make_int_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.get_int_attribute(&local_name!($htmlname), $default)
+ element.get_int_attribute(&html5ever::local_name!($htmlname), $default)
}
);
@@ -85,7 +85,7 @@ macro_rules! make_uint_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.get_uint_attribute(&local_name!($htmlname), $default)
+ element.get_uint_attribute(&html5ever::local_name!($htmlname), $default)
}
);
($attr:ident, $htmlname:tt) => {
@@ -100,7 +100,7 @@ macro_rules! make_url_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.get_url_attribute(&local_name!($htmlname))
+ element.get_url_attribute(&html5ever::local_name!($htmlname))
}
);
);
@@ -112,7 +112,7 @@ macro_rules! make_url_setter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.set_url_attribute(&local_name!($htmlname),
+ element.set_url_attribute(&html5ever::local_name!($htmlname),
value);
}
);
@@ -126,7 +126,7 @@ macro_rules! make_form_action_getter(
use crate::dom::element::Element;
let element = self.upcast::<Element>();
let doc = crate::dom::node::document_from_node(self);
- let attr = element.get_attribute(&ns!(), &local_name!($htmlname));
+ let attr = element.get_attribute(&html5ever::ns!(), &html5ever::local_name!($htmlname));
let value = attr.as_ref().map(|attr| attr.value());
let value = match value {
Some(ref value) if !value.is_empty() => &***value,
@@ -162,7 +162,7 @@ macro_rules! make_enumerated_getter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- let mut val = element.get_string_attribute(&local_name!($htmlname));
+ let mut val = element.get_string_attribute(&html5ever::local_name!($htmlname));
val.make_ascii_lowercase();
// https://html.spec.whatwg.org/multipage/#attr-fs-method
match &*val {
@@ -182,7 +182,7 @@ macro_rules! make_setter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.set_string_attribute(&local_name!($htmlname), value)
+ element.set_string_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
@@ -194,7 +194,7 @@ macro_rules! make_bool_setter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.set_bool_attribute(&local_name!($htmlname), value)
+ element.set_bool_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
@@ -212,7 +212,7 @@ macro_rules! make_uint_setter(
value
};
let element = self.upcast::<Element>();
- element.set_uint_attribute(&local_name!($htmlname), value)
+ element.set_uint_attribute(&html5ever::local_name!($htmlname), value)
}
);
($attr:ident, $htmlname:tt) => {
@@ -235,7 +235,7 @@ macro_rules! make_limited_uint_setter(
value
};
let element = self.upcast::<Element>();
- element.set_uint_attribute(&local_name!($htmlname), value);
+ element.set_uint_attribute(&html5ever::local_name!($htmlname), value);
Ok(())
}
);
@@ -251,7 +251,7 @@ macro_rules! make_atomic_setter(
use crate::dom::bindings::inheritance::Castable;
use crate::dom::element::Element;
let element = self.upcast::<Element>();
- element.set_atomic_attribute(&local_name!($htmlname), value)
+ element.set_atomic_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
@@ -265,7 +265,7 @@ macro_rules! make_legacy_color_setter(
use style::attr::AttrValue;
let element = self.upcast::<Element>();
let value = AttrValue::from_legacy_color(value.into());
- element.set_attribute(&local_name!($htmlname), value)
+ element.set_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
@@ -278,7 +278,7 @@ macro_rules! make_dimension_setter(
use crate::dom::element::Element;
let element = self.upcast::<Element>();
let value = AttrValue::from_dimension(value.into());
- element.set_attribute(&local_name!($htmlname), value)
+ element.set_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
@@ -291,7 +291,7 @@ macro_rules! make_nonzero_dimension_setter(
use crate::dom::element::Element;
let element = self.upcast::<Element>();
let value = AttrValue::from_nonzero_dimension(value.into());
- element.set_attribute(&local_name!($htmlname), value)
+ element.set_attribute(&html5ever::local_name!($htmlname), value)
}
);
);
diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs
index 0adac701253..8c558408d86 100644
--- a/components/script/dom/mutationobserver.rs
+++ b/components/script/dom/mutationobserver.rs
@@ -17,7 +17,7 @@ use crate::dom::window::Window;
use crate::microtask::Microtask;
use crate::script_thread::ScriptThread;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Namespace};
+use html5ever::{namespace_url, ns, LocalName, Namespace};
use js::rust::HandleObject;
use std::rc::Rc;
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 797d57dfa6e..39655064bdd 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -64,11 +64,13 @@ use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
use crate::dom::window::Window;
use crate::script_thread::ScriptThread;
use app_units::Au;
+use bitflags::bitflags;
use devtools_traits::NodeInfo;
use dom_struct::dom_struct;
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
-use html5ever::{Namespace, Prefix, QualName};
+use html5ever::{namespace_url, ns, Namespace, Prefix, QualName};
use js::jsapi::JSObject;
+
use js::rust::HandleObject;
use libc::{self, c_void, uintptr_t};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index 0a150866dd8..edcac751212 100644
--- a/components/script/dom/range.rs
+++ b/components/script/dom/range.rs
@@ -28,6 +28,7 @@ use crate::dom::node::{Node, ShadowIncluding, UnbindContext};
use crate::dom::selection::Selection;
use crate::dom::text::Text;
use crate::dom::window::Window;
+use deny_public_fields::DenyPublicFields;
use dom_struct::dom_struct;
use js::jsapi::JSTracer;
use js::rust::HandleObject;
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index 26234e7ab68..a2699351674 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -25,6 +25,7 @@ use crate::dom::headers::{Guard, Headers};
use crate::dom::promise::Promise;
use crate::dom::readablestream::ReadableStream;
use crate::script_runtime::JSContext as SafeJSContext;
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
use dom_struct::dom_struct;
use http::header::{HeaderName, HeaderValue};
use http::method::InvalidMethod;
diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs
index 6a87458d9f1..5b063dcc78a 100644
--- a/components/script/dom/servoparser/async_html.rs
+++ b/components/script/dom/servoparser/async_html.rs
@@ -29,7 +29,9 @@ use html5ever::tree_builder::{
ElementFlags, NextParserState, NodeOrText as HtmlNodeOrText, QuirksMode, TreeSink,
};
use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
-use html5ever::{Attribute as HtmlAttribute, ExpandedName, QualName};
+use html5ever::{
+ local_name, namespace_url, ns, Attribute as HtmlAttribute, ExpandedName, QualName,
+};
use servo_url::ServoUrl;
use std::borrow::Cow;
use std::cell::Cell;
diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs
index 62d963e2e74..db5aed41962 100644
--- a/components/script/dom/servoparser/mod.rs
+++ b/components/script/dom/servoparser/mod.rs
@@ -46,7 +46,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::{Attribute, ExpandedName, LocalName, QualName};
+use html5ever::{local_name, namespace_url, ns, Attribute, ExpandedName, LocalName, QualName};
use hyper_serde::Serde;
use mime::{self, Mime};
use msg::constellation_msg::PipelineId;
diff --git a/components/script/dom/servoparser/prefetch.rs b/components/script/dom/servoparser/prefetch.rs
index 2f1da052978..73db542984c 100644
--- a/components/script/dom/servoparser/prefetch.rs
+++ b/components/script/dom/servoparser/prefetch.rs
@@ -19,7 +19,7 @@ use html5ever::tokenizer::TokenSinkResult;
use html5ever::tokenizer::Tokenizer as HtmlTokenizer;
use html5ever::tokenizer::TokenizerResult;
use html5ever::Attribute;
-use html5ever::LocalName;
+use html5ever::{local_name, LocalName};
use js::jsapi::JSTracer;
use msg::constellation_msg::PipelineId;
use net_traits::request::CorsSettings;
diff --git a/components/script/dom/svgelement.rs b/components/script/dom/svgelement.rs
index 3f88ab608c0..dc1620f2598 100644
--- a/components/script/dom/svgelement.rs
+++ b/components/script/dom/svgelement.rs
@@ -12,7 +12,7 @@ use crate::dom::node::window_from_node;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style::element_state::ElementState;
diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs
index df3d1e5cd3a..f903c3b2735 100644
--- a/components/script/dom/svgsvgelement.rs
+++ b/components/script/dom/svgsvgelement.rs
@@ -12,7 +12,7 @@ use crate::dom::node::Node;
use crate::dom::svggraphicselement::SVGGraphicsElement;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use script_layout_interface::SVGSVGData;
use style::attr::AttrValue;
diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs
index 81f4c254e43..38f700ea542 100755
--- a/components/script/dom/validitystate.rs
+++ b/components/script/dom/validitystate.rs
@@ -13,6 +13,7 @@ use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::FormControlElementHelpers;
use crate::dom::node::Node;
use crate::dom::window::Window;
+use bitflags::bitflags;
use dom_struct::dom_struct;
use itertools::Itertools;
use std::cell::Cell;
diff --git a/components/script/dom/webgl_validations/types.rs b/components/script/dom/webgl_validations/types.rs
index e7d87202e3a..b28664843e9 100644
--- a/components/script/dom/webgl_validations/types.rs
+++ b/components/script/dom/webgl_validations/types.rs
@@ -4,6 +4,7 @@
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use canvas_traits::gl_enums;
+use serde::{Deserialize, Serialize};
gl_enums! {
pub enum TexImageTarget {
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index b6225850975..8127f8c5f3a 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -54,6 +54,7 @@ use crate::dom::window::Window;
use crate::script_runtime::JSContext as SafeJSContext;
#[cfg(feature = "webgl_backtrace")]
use backtrace::Backtrace;
+use bitflags::bitflags;
use canvas_traits::webgl::WebGLError::*;
use canvas_traits::webgl::{
webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType,
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 002c228d02f..b1b3399d823 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -62,7 +62,6 @@ use crate::dom::worklet::Worklet;
use crate::dom::workletglobalscope::WorkletGlobalScopeType;
use crate::fetch;
use crate::layout_image::fetch_image_for_layout;
-use crate::malloc_size_of::MallocSizeOf;
use crate::microtask::MicrotaskQueue;
use crate::realms::InRealm;
use crate::script_runtime::{
@@ -101,6 +100,7 @@ use js::rust::wrappers::JS_DefineProperty;
use js::rust::{
CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleObject,
};
+use malloc_size_of::MallocSizeOf;
use media::WindowGLContext;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse};
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs
index a2b1cbfe7f4..f4aae865000 100644
--- a/components/script/dom/windowproxy.rs
+++ b/components/script/dom/windowproxy.rs
@@ -22,6 +22,7 @@ use crate::script_runtime::JSContext as SafeJSContext;
use crate::script_thread::ScriptThread;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
+use html5ever::local_name;
use indexmap::map::IndexMap;
use ipc_channel::ipc;
use js::glue::{CreateWrapperProxyHandler, ProxyTraps};
@@ -52,6 +53,7 @@ use script_traits::{
AuxiliaryBrowsingContextLoadInfo, HistoryEntryReplacement, LoadData, LoadOrigin,
};
use script_traits::{NewLayoutInfo, ScriptMsg};
+use serde::{Deserialize, Serialize};
use servo_url::{ImmutableOrigin, ServoUrl};
use std::cell::Cell;
use std::ptr;
diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs
index b1f9fc83ebe..75acc13c650 100644
--- a/components/script/dom/worklet.rs
+++ b/components/script/dom/worklet.rs
@@ -46,6 +46,7 @@ use js::jsapi::JSGCParamKey;
use js::jsapi::JSTracer;
use js::jsapi::JS_GetGCParameter;
use js::jsapi::{GCReason, JS_GC};
+use malloc_size_of::malloc_size_of_is_0;
use msg::constellation_msg::PipelineId;
use net_traits::request::Destination;
use net_traits::request::RequestBuilder;
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 91be4baa6ed..2b1c199cbaa 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -12,7 +12,7 @@ use crate::dom::characterdata::LayoutCharacterDataHelpers;
use crate::dom::element::{Element, LayoutElementHelpers};
use crate::dom::node::{LayoutNodeHelpers, NodeFlags};
use atomic_refcell::{AtomicRef, AtomicRefMut};
-use html5ever::{LocalName, Namespace};
+use html5ever::{local_name, namespace_url, ns, LocalName, Namespace};
use script_layout_interface::wrapper_traits::{
GetStyleAndOpaqueLayoutData, LayoutDataTrait, LayoutNode, PseudoElementType,
ThreadSafeLayoutElement, ThreadSafeLayoutNode,
diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs
index 22d28b9e165..7674a10e743 100644
--- a/components/script/layout_dom/node.rs
+++ b/components/script/layout_dom/node.rs
@@ -17,6 +17,7 @@ use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
use crate::dom::text::Text;
use atomic_refcell::AtomicRefCell;
use gfx_traits::ByteIndex;
+use html5ever::{local_name, namespace_url, ns};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
use range::Range;
diff --git a/components/script/lib.rs b/components/script/lib.rs
index ecb4bf8a853..e78cd58d7a7 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -21,38 +21,17 @@
#![register_tool(unrooted_must_root_lint)]
#![register_tool(trace_in_no_trace_lint)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate cssparser;
-#[macro_use]
-extern crate deny_public_fields;
-#[macro_use]
-extern crate domobject_derive;
-#[macro_use]
-extern crate html5ever;
+// These are used a lot so let's keep them for now
#[macro_use]
extern crate js;
#[macro_use]
extern crate jstraceable_derive;
#[macro_use]
-extern crate lazy_static;
-#[macro_use]
extern crate log;
#[macro_use]
-extern crate malloc_size_of;
-#[macro_use]
extern crate malloc_size_of_derive;
#[macro_use]
-extern crate profile_traits;
-#[macro_use]
-extern crate serde;
-#[macro_use]
extern crate servo_atoms;
-#[macro_use]
-extern crate style;
mod animation_timeline;
mod animations;
diff --git a/components/script/script_module.rs b/components/script/script_module.rs
index f09ba9bf6c2..ad36507c3a3 100644
--- a/components/script/script_module.rs
+++ b/components/script/script_module.rs
@@ -37,6 +37,7 @@ use crate::script_runtime::JSContext as SafeJSContext;
use crate::task::TaskBox;
use crate::task_source::TaskSourceName;
use encoding_rs::UTF_8;
+use html5ever::local_name;
use hyper_serde::Serde;
use indexmap::IndexSet;
use ipc_channel::ipc;
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 6dc1e24fd7c..3db34ea97c4 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -73,9 +73,11 @@ use js::rust::IntoHandle;
use js::rust::ParentRuntime;
use js::rust::Runtime as RustRuntime;
use js::rust::{JSEngine, JSEngineHandle};
+use lazy_static::lazy_static;
use malloc_size_of::MallocSizeOfOps;
use msg::constellation_msg::PipelineId;
use profile_traits::mem::{Report, ReportKind, ReportsChan};
+use profile_traits::path;
use servo_config::opts;
use servo_config::pref;
use std::cell::Cell;
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 6f8c60ad7e7..be456b8d1f7 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -85,7 +85,7 @@ use crate::task_source::TaskSourceName;
use crate::webdriver_handlers;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLPipeline;
-use crossbeam_channel::{unbounded, Receiver, Sender};
+use crossbeam_channel::{select, unbounded, Receiver, Sender};
use devtools_traits::CSSError;
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
use devtools_traits::{NavigationState, ScriptToDevtoolsControlMsg, WorkerId};
@@ -94,6 +94,7 @@ use euclid::default::{Point2D, Rect};
use euclid::Vector2D;
use headers::ReferrerPolicy as ReferrerPolicyHeader;
use headers::{HeaderMapExt, LastModified};
+use html5ever::{local_name, namespace_url, ns};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs
index e3db04c4235..7b222546bd8 100644
--- a/components/script/serviceworker_manager.rs
+++ b/components/script/serviceworker_manager.rs
@@ -13,7 +13,7 @@ use crate::dom::serviceworkerglobalscope::{
};
use crate::dom::serviceworkerregistration::longest_prefix_match;
use crate::script_runtime::ContextForRequestInterrupt;
-use crossbeam_channel::{unbounded, Receiver, RecvError, Sender};
+use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use msg::constellation_msg::PipelineNamespace;
diff --git a/components/script/timers.rs b/components/script/timers.rs
index d337f197061..c7c2d15ef38 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -14,6 +14,7 @@ use crate::dom::testbinding::TestBindingCallback;
use crate::dom::xmlhttprequest::XHRTimeoutCallback;
use crate::script_module::ScriptFetchOptions;
use crate::script_thread::ScriptThread;
+use deny_public_fields::DenyPublicFields;
use euclid::Length;
use ipc_channel::ipc::IpcSender;
use js::jsapi::Heap;
diff --git a/components/script/window_named_properties.rs b/components/script/window_named_properties.rs
index 46cf61d7c2e..0a133d2cd34 100644
--- a/components/script/window_named_properties.rs
+++ b/components/script/window_named_properties.rs
@@ -34,7 +34,7 @@ struct SyncWrapper(*const libc::c_void);
#[allow(unsafe_code)]
unsafe impl Sync for SyncWrapper {}
-lazy_static! {
+lazy_static::lazy_static! {
static ref HANDLER: SyncWrapper = {
let traps = ProxyTraps {
enter: None,
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index 375377262d7..9b8fbd7e26f 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -8,11 +8,6 @@
#![deny(unsafe_code)]
-#[macro_use]
-extern crate html5ever;
-#[macro_use]
-extern crate malloc_size_of_derive;
-
pub mod message;
pub mod rpc;
pub mod wrapper_traits;
@@ -21,6 +16,7 @@ use atomic_refcell::AtomicRefCell;
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use ipc_channel::ipc::IpcSender;
use libc::c_void;
+use malloc_size_of_derive::MallocSizeOf;
use net_traits::image_cache::PendingImageId;
use script_traits::UntrustedNodeAddress;
use servo_url::{ImmutableOrigin, ServoUrl};
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index feeded5054c..b20c92d870e 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -9,6 +9,7 @@ use crossbeam_channel::{Receiver, Sender};
use euclid::default::{Point2D, Rect};
use gfx_traits::Epoch;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
+use malloc_size_of_derive::MallocSizeOf;
use metrics::PaintTimeMetrics;
use msg::constellation_msg::{BackgroundHangMonitorRegister, BrowsingContextId, PipelineId};
use net_traits::image_cache::ImageCache;
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 0901653b762..3f9710dea9b 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -11,6 +11,9 @@ use crate::SVGSVGData;
use crate::StyleAndOpaqueLayoutData;
use atomic_refcell::AtomicRef;
use gfx_traits::{combine_id_with_fragment_type, ByteIndex, FragmentType};
+use html5ever::local_name;
+use html5ever::namespace_url;
+use html5ever::ns;
use html5ever::{LocalName, Namespace};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
diff --git a/components/script_plugins/lib.rs b/components/script_plugins/lib.rs
index 8e3de2cecab..30fa2dd67b9 100644
--- a/components/script_plugins/lib.rs
+++ b/components/script_plugins/lib.rs
@@ -11,6 +11,7 @@
#![feature(plugin)]
#![feature(rustc_private)]
+// This rustc crate is private so it needs to be manually imported.
extern crate rustc_ast;
extern crate rustc_driver;
extern crate rustc_error_messages;
diff --git a/components/script_traits/compositor.rs b/components/script_traits/compositor.rs
index 1707f4a3fe2..648882e1e7e 100644
--- a/components/script_traits/compositor.rs
+++ b/components/script_traits/compositor.rs
@@ -5,6 +5,7 @@
//! Defines data structures which are consumed by the Compositor.
use embedder_traits::Cursor;
+use serde::{Deserialize, Serialize};
use webrender_api::{
units::{LayoutSize, LayoutVector2D},
Epoch, ExternalScrollId, PipelineId, ScrollLocation, ScrollSensitivity, SpatialId,
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index c1b02c4335a..c2610461276 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -9,15 +9,6 @@
#![deny(missing_docs)]
#![deny(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-#[macro_use]
-extern crate malloc_size_of;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
pub mod compositor;
mod script_msg;
pub mod serializable;
@@ -33,6 +24,7 @@ pub use crate::script_msg::{
use crate::serializable::{BlobData, BlobImpl};
use crate::transferable::MessagePortImpl;
use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
+use bitflags::bitflags;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLPipeline;
use compositor::ScrollTreeNodeId;
@@ -49,6 +41,8 @@ use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::{CompositionEvent, KeyboardEvent};
use libc::c_void;
use log::warn;
+use malloc_size_of::malloc_size_of_is_0;
+use malloc_size_of_derive::MallocSizeOf;
use media::WindowGLContext;
use msg::constellation_msg::BackgroundHangMonitorRegister;
use msg::constellation_msg::{
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index d49e9c6bba5..2a840325ce9 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -31,6 +31,8 @@ use msg::constellation_msg::{ServiceWorkerId, ServiceWorkerRegistrationId};
use net_traits::request::RequestBuilder;
use net_traits::storage_thread::StorageType;
use net_traits::CoreResourceMsg;
+use serde::Deserialize;
+use serde::Serialize;
use servo_url::ImmutableOrigin;
use servo_url::ServoUrl;
use smallvec::SmallVec;
diff --git a/components/script_traits/serializable.rs b/components/script_traits/serializable.rs
index 73840fb2c50..8919b634a04 100644
--- a/components/script_traits/serializable.rs
+++ b/components/script_traits/serializable.rs
@@ -8,8 +8,10 @@
//! so that the other modules involved in the serialization don't have
//! to depend on script.
+use malloc_size_of_derive::MallocSizeOf;
use msg::constellation_msg::BlobId;
use net_traits::filemanager_thread::RelativePos;
+use serde::{Deserialize, Serialize};
use std::cell::RefCell;
use std::path::PathBuf;
use uuid::Uuid;
diff --git a/components/script_traits/transferable.rs b/components/script_traits/transferable.rs
index 868654f2c2b..86ec33af996 100644
--- a/components/script_traits/transferable.rs
+++ b/components/script_traits/transferable.rs
@@ -8,7 +8,9 @@
//! to depend on script.
use crate::PortMessageTask;
+use malloc_size_of_derive::MallocSizeOf;
use msg::constellation_msg::MessagePortId;
+use serde::{Deserialize, Serialize};
use std::collections::VecDeque;
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs
index 2291cf64356..33588406bec 100644
--- a/components/script_traits/webdriver_msg.rs
+++ b/components/script_traits/webdriver_msg.rs
@@ -9,6 +9,7 @@ use euclid::default::Rect;
use hyper_serde::Serde;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::BrowsingContextId;
+use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
use std::collections::HashMap;
use webdriver::common::{WebElement, WebFrame, WebWindow};
diff --git a/components/selectors/lib.rs b/components/selectors/lib.rs
index 2b785a8cd65..17f81c535b6 100644
--- a/components/selectors/lib.rs
+++ b/components/selectors/lib.rs
@@ -5,9 +5,6 @@
// Make |cargo bench| work.
#![cfg_attr(feature = "bench", feature(test))]
-#[macro_use]
-extern crate size_of_test;
-
pub mod attr;
pub mod bloom;
mod builder;
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index cf342fc8ea8..9b7fd253510 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -17,6 +17,7 @@ use cssparser::{CowRcStr, Delimiter, SourceLocation};
use cssparser::{Parser as CssParser, ToCss, Token};
use precomputed_hash::PrecomputedHash;
use servo_arc::ThinArc;
+use size_of_test::size_of_test;
use smallvec::SmallVec;
use std::borrow::{Borrow, Cow};
use std::fmt::{self, Debug};
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 2f7ba40d549..76111be7627 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -17,9 +17,6 @@
//! `Servo` is fed events from a generic type that implements the
//! `WindowMethods` trait.
-#[macro_use]
-extern crate log;
-
pub use background_hang_monitor;
pub use bluetooth;
pub use bluetooth_traits;
@@ -98,7 +95,7 @@ use euclid::{Scale, Size2D};
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender};
-use log::{Log, Metadata, Record};
+use log::{error, warn, Log, Metadata, Record};
use media::{GLPlayerThreads, WindowGLContext};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
use net::resource_thread::new_resource_threads;
diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs
index d7c7d8ad33d..addf538d754 100644
--- a/components/style_traits/lib.rs
+++ b/components/style_traits/lib.rs
@@ -10,12 +10,10 @@
#![crate_type = "rlib"]
#![deny(unsafe_code, missing_docs)]
-#[macro_use]
-extern crate size_of_test;
-
use bitflags::bitflags;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
+use size_of_test::size_of_test;
#[cfg(feature = "servo")]
pub use webrender_api::units::DevicePixel;
diff --git a/components/url/lib.rs b/components/url/lib.rs
index e230ec56d3e..6d2fbff9f9d 100644
--- a/components/url/lib.rs
+++ b/components/url/lib.rs
@@ -6,17 +6,12 @@
#![crate_name = "servo_url"]
#![crate_type = "rlib"]
-#[macro_use]
-extern crate malloc_size_of;
-#[macro_use]
-extern crate malloc_size_of_derive;
-#[macro_use]
-extern crate serde;
-
pub mod origin;
pub use crate::origin::{ImmutableOrigin, MutableOrigin, OpaqueOrigin};
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use std::collections::hash_map::DefaultHasher;
use std::fmt;
use std::hash::Hasher;
diff --git a/components/url/origin.rs b/components/url/origin.rs
index b272eb96e52..77abef4c349 100644
--- a/components/url/origin.rs
+++ b/components/url/origin.rs
@@ -2,6 +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 malloc_size_of::malloc_size_of_is_0;
+use malloc_size_of_derive::MallocSizeOf;
+use serde::{Deserialize, Serialize};
use std::cell::RefCell;
use std::rc::Rc;
use url::{Host, Origin};
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index b69efb084d0..3dc69e6b581 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -6,13 +6,6 @@
#![crate_type = "rlib"]
#![deny(unsafe_code)]
-#[macro_use]
-extern crate crossbeam_channel;
-#[macro_use]
-extern crate log;
-#[macro_use]
-extern crate serde;
-
mod actions;
mod capabilities;
@@ -20,13 +13,14 @@ use crate::actions::{InputSourceState, PointerInputState};
use base64::Engine;
use capabilities::ServoCapabilities;
use compositing_traits::ConstellationMsg;
-use crossbeam_channel::{after, unbounded, Receiver, Sender};
+use crossbeam_channel::{after, select, unbounded, Receiver, Sender};
use euclid::{Rect, Size2D};
use http::method::Method;
use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use keyboard_types::webdriver::send_keys;
+use log::{debug, info};
use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, TraversalDirection};
use net_traits::request::Referrer;
use pixels::PixelFormat;
@@ -35,8 +29,9 @@ use script_traits::webdriver_msg::{
WebDriverJSError, WebDriverJSResult, WebDriverJSValue, WebDriverScriptCommand,
};
use script_traits::{LoadData, LoadOrigin, WebDriverCommandMsg};
-use serde::de::{Deserialize, Deserializer, MapAccess, Visitor};
-use serde::ser::{Serialize, Serializer};
+use serde::de::{Deserializer, MapAccess, Visitor};
+use serde::ser::Serializer;
+use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use servo_config::{prefs, prefs::PrefValue};
use servo_url::ServoUrl;
diff --git a/components/webgpu/identity.rs b/components/webgpu/identity.rs
index e6a9e66cabe..64647a5c186 100644
--- a/components/webgpu/identity.rs
+++ b/components/webgpu/identity.rs
@@ -2,11 +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 crate::{ErrorScopeId, WebGPUDevice, WebGPURequest};
-use ipc_channel::ipc::IpcSender;
-use msg::constellation_msg::PipelineId;
-use serde::{Deserialize, Serialize};
-use wgpu::{
+use crate::wgpu::{
id::{
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandBufferId, ComputePipelineId,
DeviceId, PipelineLayoutId, QuerySetId, RenderBundleId, RenderPipelineId, SamplerId,
@@ -14,7 +10,11 @@ use wgpu::{
},
identity::{GlobalIdentityHandlerFactory, IdentityHandler, IdentityHandlerFactory},
};
-use wgt::Backend;
+use crate::wgt::Backend;
+use crate::{ErrorScopeId, WebGPUDevice, WebGPURequest};
+use ipc_channel::ipc::IpcSender;
+use msg::constellation_msg::PipelineId;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum WebGPUOpResult {
diff --git a/components/webgpu/lib.rs b/components/webgpu/lib.rs
index 0eb10a0db77..4730136d3b7 100644
--- a/components/webgpu/lib.rs
+++ b/components/webgpu/lib.rs
@@ -2,11 +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/. */
-#[macro_use]
-extern crate log;
-#[macro_use]
-pub extern crate wgpu_core as wgpu;
-pub extern crate wgpu_types as wgt;
+use log::{error, warn};
+use wgpu::gfx_select;
+pub use wgpu_core as wgpu;
+pub use wgpu_types as wgt;
pub mod identity;