aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-12-14 08:31:30 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-12-28 13:17:47 +0100
commitbe69f9c3e6a6f5efb5ba1edd50955cb12c111bf8 (patch)
treedb8be2dfee5cff6ef0c42e8d46c623eb87529e5a
parent82fc6d9f49a657e2857da3f1b22140e3b6efdf09 (diff)
downloadservo-be69f9c3e6a6f5efb5ba1edd50955cb12c111bf8.tar.gz
servo-be69f9c3e6a6f5efb5ba1edd50955cb12c111bf8.zip
Rustfmt has changed its default style :/
-rw-r--r--components/bluetooth/lib.rs12
-rw-r--r--components/canvas/canvas_paint_thread.rs2
-rw-r--r--components/canvas/webgl_mode/inprocess.rs4
-rw-r--r--components/canvas/webgl_thread.rs8
-rw-r--r--components/config/opts.rs20
-rw-r--r--components/constellation/constellation.rs108
-rw-r--r--components/constellation/pipeline.rs10
-rw-r--r--components/gfx/font.rs2
-rw-r--r--components/gfx/font_cache_thread.rs2
-rw-r--r--components/gfx/font_context.rs2
-rw-r--r--components/gfx/platform/freetype/font.rs2
-rw-r--r--components/gfx/platform/macos/font.rs14
-rw-r--r--components/gfx/platform/windows/font.rs2
-rw-r--r--components/gfx/tests/font_template.rs4
-rw-r--r--components/gfx/text/glyph.rs11
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs2
-rw-r--r--components/gfx/text/text_run.rs9
-rw-r--r--components/layout/animation.rs21
-rw-r--r--components/layout/block.rs30
-rw-r--r--components/layout/construct.rs15
-rw-r--r--components/layout/data.rs2
-rw-r--r--components/layout/display_list/background.rs2
-rw-r--r--components/layout/display_list/border.rs2
-rw-r--r--components/layout/display_list/builder.rs15
-rw-r--r--components/layout/display_list/gradient.rs2
-rw-r--r--components/layout/display_list/items.rs23
-rw-r--r--components/layout/flex.rs17
-rw-r--r--components/layout/floats.rs8
-rw-r--r--components/layout/flow.rs34
-rw-r--r--components/layout/fragment.rs24
-rw-r--r--components/layout/incremental.rs11
-rw-r--r--components/layout/inline.rs8
-rw-r--r--components/layout/list_item.rs2
-rw-r--r--components/layout/model.rs6
-rw-r--r--components/layout/multicol.rs2
-rw-r--r--components/layout/query.rs6
-rw-r--r--components/layout/sequential.rs11
-rw-r--r--components/layout/table.rs18
-rw-r--r--components/layout/table_caption.rs2
-rw-r--r--components/layout/table_cell.rs17
-rw-r--r--components/layout/table_colgroup.rs2
-rw-r--r--components/layout/table_row.rs2
-rw-r--r--components/layout/table_rowgroup.rs2
-rw-r--r--components/layout/table_wrapper.rs14
-rw-r--r--components/layout/text.rs12
-rw-r--r--components/layout/traversal.rs7
-rw-r--r--components/layout/wrapper.rs2
-rw-r--r--components/layout_thread/lib.rs2
-rw-r--r--components/net/cookie_storage.rs7
-rw-r--r--components/net/fetch/methods.rs34
-rw-r--r--components/net/http_loader.rs33
-rw-r--r--components/net/mime_classifier.rs7
-rw-r--r--components/net/tests/fetch.rs80
-rw-r--r--components/net/tests/hsts.rs56
-rw-r--r--components/net/tests/http_loader.rs330
-rw-r--r--components/net_traits/lib.rs2
-rw-r--r--components/remutex/lib.rs2
-rw-r--r--components/script/devtools.rs16
-rw-r--r--components/script/dom/analysernode.rs6
-rw-r--r--components/script/dom/audiocontext.rs68
-rw-r--r--components/script/dom/baseaudiocontext.rs4
-rw-r--r--components/script/dom/bindings/error.rs4
-rw-r--r--components/script/dom/bindings/htmlconstructor.rs2
-rw-r--r--components/script/dom/bindings/str.rs8
-rw-r--r--components/script/dom/bindings/trace.rs26
-rw-r--r--components/script/dom/bindings/xmlname.rs16
-rw-r--r--components/script/dom/bluetooth.rs2
-rw-r--r--components/script/dom/bluetoothdevice.rs4
-rw-r--r--components/script/dom/bluetoothpermissionresult.rs2
-rw-r--r--components/script/dom/bluetoothremotegattcharacteristic.rs4
-rw-r--r--components/script/dom/bluetoothremotegattdescriptor.rs4
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs2
-rw-r--r--components/script/dom/bluetoothremotegattservice.rs2
-rw-r--r--components/script/dom/canvasgradient.rs6
-rw-r--r--components/script/dom/canvaspattern.rs2
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs8
-rw-r--r--components/script/dom/customelementregistry.rs2
-rw-r--r--components/script/dom/document.rs181
-rw-r--r--components/script/dom/element.rs25
-rw-r--r--components/script/dom/filereader.rs2
-rw-r--r--components/script/dom/filereadersync.rs14
-rw-r--r--components/script/dom/headers.rs7
-rw-r--r--components/script/dom/htmlanchorelement.rs4
-rw-r--r--components/script/dom/htmlbodyelement.rs7
-rw-r--r--components/script/dom/htmlcanvaselement.rs6
-rw-r--r--components/script/dom/htmliframeelement.rs28
-rw-r--r--components/script/dom/htmlimageelement.rs14
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs35
-rw-r--r--components/script/dom/htmlmediaelement.rs20
-rw-r--r--components/script/dom/htmlscriptelement.rs10
-rw-r--r--components/script/dom/htmltableelement.rs11
-rw-r--r--components/script/dom/node.rs21
-rw-r--r--components/script/dom/paintrenderingcontext2d.rs6
-rw-r--r--components/script/dom/performance.rs14
-rw-r--r--components/script/dom/promiserejectionevent.rs2
-rw-r--r--components/script/dom/range.rs13
-rw-r--r--components/script/dom/request.rs4
-rw-r--r--components/script/dom/storage.rs30
-rw-r--r--components/script/dom/testrunner.rs2
-rw-r--r--components/script/dom/treewalker.rs8
-rwxr-xr-xcomponents/script/dom/validitystate.rs2
-rw-r--r--components/script/dom/vrdisplay.rs6
-rw-r--r--components/script/dom/webgl2renderingcontext.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/extblendminmax.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/extshadertexturelod.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/oeselementindexuint.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturefloat.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs2
-rw-r--r--components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs2
-rw-r--r--components/script/dom/webgl_extensions/extension.rs2
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs2
-rw-r--r--components/script/dom/webgl_validations/tex_image_2d.rs2
-rw-r--r--components/script/dom/webgl_validations/types.rs2
-rw-r--r--components/script/dom/webglbuffer.rs4
-rw-r--r--components/script/dom/webglframebuffer.rs10
-rw-r--r--components/script/dom/webglprogram.rs6
-rw-r--r--components/script/dom/webglrenderbuffer.rs6
-rw-r--r--components/script/dom/webglrenderingcontext.rs25
-rw-r--r--components/script/dom/webglshader.rs6
-rw-r--r--components/script/dom/webgltexture.rs4
-rw-r--r--components/script/dom/webgluniformlocation.rs2
-rw-r--r--components/script/dom/webglvertexarrayobjectoes.rs6
-rw-r--r--components/script/dom/websocket.rs14
-rw-r--r--components/script/dom/window.rs28
-rw-r--r--components/script/dom/xmlhttprequest.rs6
-rw-r--r--components/script/lib.rs5
-rw-r--r--components/script/script_runtime.rs4
-rw-r--r--components/script/script_thread.rs20
-rw-r--r--components/script/webdriver_handlers.rs8
-rw-r--r--components/script_layout_interface/message.rs2
-rw-r--r--components/script_layout_interface/wrapper_traits.rs2
-rw-r--r--components/script_traits/lib.rs2
-rw-r--r--components/script_traits/script_msg.rs2
-rw-r--r--components/selectors/matching.rs23
-rw-r--r--components/selectors/parser.rs25
-rw-r--r--components/style/attr.rs2
-rw-r--r--components/style/bloom.rs2
-rw-r--r--components/style/build_gecko.rs3
-rw-r--r--components/style/context.rs2
-rw-r--r--components/style/custom_properties.rs2
-rw-r--r--components/style/dom.rs7
-rw-r--r--components/style/font_face.rs7
-rw-r--r--components/style/font_metrics.rs2
-rw-r--r--components/style/gecko/conversions.rs2
-rw-r--r--components/style/gecko/data.rs2
-rw-r--r--components/style/gecko/media_features.rs2
-rw-r--r--components/style/gecko/media_queries.rs4
-rw-r--r--components/style/gecko/selector_parser.rs55
-rw-r--r--components/style/gecko/values.rs2
-rw-r--r--components/style/gecko/wrapper.rs42
-rw-r--r--components/style/gecko_bindings/mod.rs7
-rw-r--r--components/style/gecko_bindings/sugar/ns_css_shadow_item.rs2
-rw-r--r--components/style/invalidation/element/element_wrapper.rs4
-rw-r--r--components/style/logical_geometry.rs11
-rw-r--r--components/style/matching.rs8
-rw-r--r--components/style/media_queries/media_feature.rs7
-rw-r--r--components/style/media_queries/media_feature_expression.rs11
-rw-r--r--components/style/media_queries/media_list.rs27
-rw-r--r--components/style/parallel.rs2
-rw-r--r--components/style/servo/media_queries.rs2
-rw-r--r--components/style/servo/selector_parser.rs2
-rw-r--r--components/style/shared_lock.rs4
-rw-r--r--components/style/sharing/mod.rs2
-rw-r--r--components/style/style_adjuster.rs31
-rw-r--r--components/style/stylesheets/font_feature_values_rule.rs24
-rw-r--r--components/style/stylesheets/keyframes_rule.rs8
-rw-r--r--components/style/stylesheets/rule_parser.rs7
-rw-r--r--components/style/stylesheets/supports_rule.rs7
-rw-r--r--components/style/stylesheets/viewport_rule.rs2
-rw-r--r--components/style/stylist.rs23
-rw-r--r--components/style/traversal.rs15
-rw-r--r--components/style/values/animated/mod.rs2
-rw-r--r--components/style/values/computed/border.rs2
-rw-r--r--components/style/values/computed/font.rs4
-rw-r--r--components/style/values/computed/length.rs2
-rw-r--r--components/style/values/generics/basic_shape.rs6
-rw-r--r--components/style/values/generics/font.rs2
-rw-r--r--components/style/values/generics/text.rs2
-rw-r--r--components/style/values/generics/transform.rs2
-rw-r--r--components/style/values/mod.rs5
-rw-r--r--components/style/values/specified/angle.rs2
-rw-r--r--components/style/values/specified/box.rs13
-rw-r--r--components/style/values/specified/calc.rs4
-rw-r--r--components/style/values/specified/counters.rs2
-rw-r--r--components/style/values/specified/font.rs4
-rw-r--r--components/style/values/specified/grid.rs6
-rw-r--r--components/style/values/specified/image.rs4
-rw-r--r--components/style/values/specified/length.rs42
-rw-r--r--components/style/values/specified/mod.rs4
-rw-r--r--components/style/values/specified/source_size_list.rs4
-rw-r--r--components/style/values/specified/text.rs3
-rw-r--r--components/style/values/specified/time.rs6
-rw-r--r--components/style_derive/cg.rs4
-rw-r--r--components/style_derive/parse.rs2
-rw-r--r--components/style_traits/lib.rs5
-rw-r--r--components/style_traits/viewport.rs5
-rw-r--r--components/webdriver_server/lib.rs4
-rw-r--r--ports/libmlservo/src/lib.rs4
-rw-r--r--ports/libsimpleservo/api/src/gl_glue.rs12
-rw-r--r--ports/libsimpleservo/capi/src/lib.rs6
-rw-r--r--tests/unit/style/parsing/transition_timing_function.rs36
-rw-r--r--tests/unit/style/stylist.rs10
207 files changed, 1201 insertions, 1340 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs
index 5cfbcf7fa83..1566a7345c9 100644
--- a/components/bluetooth/lib.rs
+++ b/components/bluetooth/lib.rs
@@ -461,10 +461,8 @@ impl BluetoothManager {
};
services.retain(|s| {
- !uuid_is_blocklisted(&s.get_uuid().unwrap_or(String::new()), Blocklist::All) && self
- .allowed_services
- .get(device_id)
- .map_or(false, |uuids| {
+ !uuid_is_blocklisted(&s.get_uuid().unwrap_or(String::new()), Blocklist::All) &&
+ self.allowed_services.get(device_id).map_or(false, |uuids| {
uuids.contains(&s.get_uuid().unwrap_or(String::new()))
})
});
@@ -554,9 +552,9 @@ impl BluetoothManager {
}
fn characteristic_is_cached(&self, characteristic_id: &str) -> bool {
- self.cached_characteristics.contains_key(characteristic_id) && self
- .characteristic_to_service
- .contains_key(characteristic_id)
+ self.cached_characteristics.contains_key(characteristic_id) &&
+ self.characteristic_to_service
+ .contains_key(characteristic_id)
}
// Descriptor
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs
index 72694217e12..582512b8e44 100644
--- a/components/canvas/canvas_paint_thread.rs
+++ b/components/canvas/canvas_paint_thread.rs
@@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::canvas_data::*;
use azure::azure_hl::AntialiasMode;
use canvas_traits::canvas::*;
-use crate::canvas_data::*;
use euclid::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use std::borrow::ToOwned;
diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs
index 9d030422109..6111851e58e 100644
--- a/components/canvas/webgl_mode/inprocess.rs
+++ b/components/canvas/webgl_mode/inprocess.rs
@@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::gl_context::GLContextFactory;
+use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::DOMToTextureCommand;
use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver};
use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
-use crate::gl_context::GLContextFactory;
-use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
use euclid::Size2D;
use fnv::FnvHashMap;
use gleam::gl;
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs
index a6835844bda..93134dd7487 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -1425,10 +1425,10 @@ impl WebGLImpl {
(depth, gl::DEPTH_BUFFER_BIT),
(stencil, gl::STENCIL_BUFFER_BIT),
]
- .iter()
- .fold(0, |bits, &(enabled, bit)| {
- bits | if enabled { bit } else { 0 }
- });
+ .iter()
+ .fold(0, |bits, &(enabled, bit)| {
+ bits | if enabled { bit } else { 0 }
+ });
if state.scissor_test_enabled {
gl.disable(gl::SCISSOR_TEST);
diff --git a/components/config/opts.rs b/components/config/opts.rs
index b552ec9ee6f..ffdb49d6a45 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -975,15 +975,17 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
})
.collect();
- let do_not_use_native_titlebar = opt_match.opt_present("b") || !PREFS
- .get("shell.native-titlebar.enabled")
- .as_boolean()
- .unwrap();
-
- let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa && PREFS
- .get("gfx.subpixel-text-antialiasing.enabled")
- .as_boolean()
- .unwrap();
+ let do_not_use_native_titlebar = opt_match.opt_present("b") ||
+ !PREFS
+ .get("shell.native-titlebar.enabled")
+ .as_boolean()
+ .unwrap();
+
+ let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa &&
+ PREFS
+ .get("gfx.subpixel-text-antialiasing.enabled")
+ .as_boolean()
+ .unwrap();
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index d14e4d921db..9ca2b758bff 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -89,17 +89,6 @@
//!
//! See https://github.com/servo/servo/issues/14704
-use background_hang_monitor::HangMonitorRegister;
-use backtrace::Backtrace;
-use bluetooth_traits::BluetoothRequest;
-use canvas::canvas_paint_thread::CanvasPaintThread;
-use canvas::webgl_thread::WebGLThreads;
-use canvas_traits::canvas::CanvasId;
-use canvas_traits::canvas::CanvasMsg;
-use clipboard::{ClipboardContext, ClipboardProvider};
-use compositing::compositor_thread::CompositorProxy;
-use compositing::compositor_thread::Msg as ToCompositorMsg;
-use compositing::SendableFrameTree;
use crate::browsingcontext::NewBrowsingContextInfo;
use crate::browsingcontext::{
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator,
@@ -111,6 +100,17 @@ use crate::session_history::{
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
};
use crate::timer_scheduler::TimerScheduler;
+use background_hang_monitor::HangMonitorRegister;
+use backtrace::Backtrace;
+use bluetooth_traits::BluetoothRequest;
+use canvas::canvas_paint_thread::CanvasPaintThread;
+use canvas::webgl_thread::WebGLThreads;
+use canvas_traits::canvas::CanvasId;
+use canvas_traits::canvas::CanvasMsg;
+use clipboard::{ClipboardContext, ClipboardProvider};
+use compositing::compositor_thread::CompositorProxy;
+use compositing::compositor_thread::Msg as ToCompositorMsg;
+use compositing::SendableFrameTree;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
@@ -1090,7 +1090,7 @@ where
return warn!(
"Attempted to navigate {} after closure.",
pipeline_id
- )
+ );
},
};
if let Err(e) = result {
@@ -1103,7 +1103,7 @@ where
return warn!(
"AllowNavigationReqsponse for unknow request: {:?}",
pipeline_id
- )
+ );
},
};
},
@@ -1119,7 +1119,7 @@ where
return warn!(
"LoadUrl for unknow browsing context: {:?}",
top_level_browsing_context_id
- )
+ );
},
};
// Since this is a top-level load, initiated by the embedder, go straight to load_url,
@@ -1857,7 +1857,7 @@ where
return warn!(
"Subframe {} loaded in closed browsing context {}.",
pipeline_id, browsing_context_id,
- )
+ );
},
};
let parent_pipeline_id = match parent_pipeline_id {
@@ -1878,7 +1878,7 @@ where
return warn!(
"Parent {} browsing context loaded after closure.",
parent_pipeline_id
- )
+ );
},
};
if let Err(e) = result {
@@ -1937,7 +1937,7 @@ where
return warn!(
"Script loaded url in iframe {} in closed parent pipeline {}.",
browsing_context_id, parent_pipeline_id,
- )
+ );
},
};
let is_parent_private = match self.browsing_contexts.get(&parent_browsing_context_id) {
@@ -1946,7 +1946,7 @@ where
return warn!(
"Script loaded url in iframe {} in closed parent browsing context {}.",
browsing_context_id, parent_browsing_context_id,
- )
+ );
},
};
is_parent_private
@@ -1959,7 +1959,7 @@ where
return warn!(
"Script loaded url in iframe with closed browsing context {}.",
browsing_context_id,
- )
+ );
},
};
let replace = if replace {
@@ -2022,7 +2022,7 @@ where
return warn!(
"New iframe {} loaded in closed parent browsing context {}.",
browsing_context_id, parent_browsing_context_id,
- )
+ );
},
};
let is_private = is_private || is_parent_private;
@@ -2079,7 +2079,7 @@ where
return warn!(
"Auxiliary loaded url in closed iframe {}.",
opener_pipeline_id
- )
+ );
},
};
let (is_opener_private, is_opener_visible) =
@@ -2089,7 +2089,7 @@ where
return warn!(
"New auxiliary {} loaded in closed opener browsing context {}.",
new_browsing_context_id, opener_browsing_context_id,
- )
+ );
},
};
let pipeline = Pipeline::new(
@@ -2157,7 +2157,7 @@ where
match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.event_loop.send(msg),
None => {
- return warn!("Pipeline {:?} got script tick after closure.", pipeline_id)
+ return warn!("Pipeline {:?} got script tick after closure.", pipeline_id);
},
}
},
@@ -2166,7 +2166,7 @@ where
match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.layout_chan.send(msg),
None => {
- return warn!("Pipeline {:?} got layout tick after closure.", pipeline_id)
+ return warn!("Pipeline {:?} got layout tick after closure.", pipeline_id);
},
}
},
@@ -2191,7 +2191,7 @@ where
return warn!(
"Pipeline {:?} tried to schedule a navigation while one is already pending.",
source_id
- )
+ );
},
Entry::Vacant(entry) => {
let _ = entry.insert((load_data.clone(), replace));
@@ -2419,7 +2419,7 @@ where
return warn!(
"Pipeline {} navigated to fragment after closure",
pipeline_id
- )
+ );
},
};
@@ -2668,7 +2668,7 @@ where
return warn!(
"Pipeline {} child traversed after closure",
parent_pipeline_id
- )
+ );
},
Some(pipeline) => pipeline.event_loop.send(msg),
};
@@ -2689,7 +2689,7 @@ where
return warn!(
"Pipeline {} history state updated after closure",
pipeline_id
- )
+ );
},
Some(pipeline) => {
let msg = ConstellationControlMsg::UpdateHistoryState(
@@ -2743,7 +2743,7 @@ where
return warn!(
"Push history state {} for closed pipeline {}",
history_state_id, pipeline_id
- )
+ );
},
};
@@ -2775,7 +2775,7 @@ where
return warn!(
"Replace history state {} for closed pipeline {}",
history_state_id, pipeline_id
- )
+ );
},
};
@@ -2799,14 +2799,14 @@ where
return warn!(
"Got key event for nonexistent browsing context {}.",
browsing_context_id,
- )
+ );
},
};
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
let result = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.event_loop.send(msg),
None => {
- return debug!("Pipeline {:?} got key event after closure.", pipeline_id)
+ return debug!("Pipeline {:?} got key event after closure.", pipeline_id);
},
};
if let Err(e) = result {
@@ -2828,7 +2828,7 @@ where
return warn!(
"Browsing context {} got reload event after closure.",
browsing_context_id
- )
+ );
},
};
let msg = ConstellationControlMsg::Reload(pipeline_id);
@@ -2852,7 +2852,7 @@ where
return warn!(
"PostMessage to closed browsing_context {}.",
browsing_context_id
- )
+ );
},
Some(browsing_context) => browsing_context.pipeline_id,
};
@@ -2920,7 +2920,7 @@ where
return warn!(
"Browser {} for focus msg does not exist",
top_level_browsing_context_id
- )
+ );
},
};
@@ -2935,7 +2935,7 @@ where
return warn!(
"Browsing context {:?} focus parent after closure.",
browsing_context_id
- )
+ );
},
};
let parent_pipeline_id = match parent_pipeline_id {
@@ -2944,7 +2944,7 @@ where
return debug!(
"Browsing context {:?} focus has no parent.",
browsing_context_id
- )
+ );
},
};
@@ -2983,7 +2983,7 @@ where
return warn!(
"No browsing context associated with pipeline {:?}",
pipeline_id
- )
+ );
},
};
@@ -3019,7 +3019,7 @@ where
return warn!(
"Visibility change for closed browsing context {:?}.",
pipeline_id
- )
+ );
},
};
@@ -3092,7 +3092,7 @@ where
return warn!(
"Browsing context {} Refresh after closure.",
browsing_context_id
- )
+ );
},
};
let load_data = match self.pipelines.get(&pipeline_id) {
@@ -3108,7 +3108,7 @@ where
return warn!(
"Browsing context {} ScriptCommand after closure.",
browsing_context_id
- )
+ );
},
};
let control_msg = ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, cmd);
@@ -3127,7 +3127,7 @@ where
return warn!(
"Browsing context {} SendKeys after closure.",
browsing_context_id
- )
+ );
},
};
let event_loop = match self.pipelines.get(&pipeline_id) {
@@ -3169,7 +3169,7 @@ where
return warn!(
"Session history does not exist for {}",
top_level_browsing_context_id
- )
+ );
},
};
@@ -3179,7 +3179,7 @@ where
None => {
return warn!(
"notify_history_changed error after top-level browsing context closed."
- )
+ );
},
};
@@ -3189,7 +3189,7 @@ where
return warn!(
"Pipeline {} refresh after closure.",
browsing_context.pipeline_id
- )
+ );
},
};
@@ -3289,7 +3289,7 @@ where
return warn!(
"Webdriver load for closed browsing context {}.",
browsing_context_id
- )
+ );
},
};
if let Some(new_pipeline_id) = self.load_url(
@@ -3342,7 +3342,7 @@ where
return warn!(
"No NewBrowsingContextInfo for browsing context {}",
change.browsing_context_id,
- )
+ );
},
};
self.new_browsing_context(
@@ -3424,7 +3424,7 @@ where
return warn!(
"Pipeline {} removed history states after closure",
pipeline_id
- )
+ );
},
Some(pipeline) => pipeline.event_loop.send(msg),
};
@@ -3465,9 +3465,9 @@ where
.and_then(|browser_id| self.browsers.get(&browser_id))
.map(|browser| browser.focused_browsing_context_id);
focused_browsing_context_id.map_or(false, |focus_ctx_id| {
- focus_ctx_id == browsing_context_id || self
- .fully_active_descendant_browsing_contexts_iter(browsing_context_id)
- .any(|nested_ctx| nested_ctx.id == focus_ctx_id)
+ focus_ctx_id == browsing_context_id ||
+ self.fully_active_descendant_browsing_contexts_iter(browsing_context_id)
+ .any(|nested_ctx| nested_ctx.id == focus_ctx_id)
})
}
@@ -3557,7 +3557,7 @@ where
return warn!(
"Activated document {} after browsing context {} closure.",
change.new_pipeline_id, change.browsing_context_id,
- )
+ );
},
},
};
@@ -3866,7 +3866,7 @@ where
return warn!(
"Pipeline {:?} child closed after parent.",
parent_pipeline_id
- )
+ );
},
Some(parent_pipeline) => parent_pipeline.remove_child(browsing_context_id),
};
@@ -3925,7 +3925,7 @@ where
return warn!(
"Discarding pipeline {} after browser {} closure",
pipeline_id, top_level_browsing_context_id,
- )
+ );
},
};
self.close_pipeline(
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index bbbe095d918..c8b5f4fc73c 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::event_loop::EventLoop;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLPipeline;
use compositing::compositor_thread::Msg as CompositorMsg;
use compositing::CompositionPipeline;
use compositing::CompositorProxy;
-use crate::event_loop::EventLoop;
use crossbeam_channel::Sender;
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
use euclid::{TypedScale, TypedSize2D};
@@ -434,7 +434,7 @@ impl Pipeline {
return warn!(
"Pipeline remove child already removed ({:?}).",
browsing_context_id
- )
+ );
},
Some(index) => self.children.remove(index),
};
@@ -564,11 +564,7 @@ impl UnprivilegedPipelineContent {
}
}
- #[cfg(any(
- target_os = "android",
- target_arch = "arm",
- target_arch = "aarch64"
- ))]
+ #[cfg(any(target_os = "android", target_arch = "arm", target_arch = "aarch64"))]
pub fn spawn_multiprocess(self) -> Result<(), Error> {
use ipc_channel::ipc::IpcOneShotServer;
// Note that this function can panic, due to process creation,
diff --git a/components/gfx/font.rs b/components/gfx/font.rs
index 9ee543227b9..46dc113fa76 100644
--- a/components/gfx/font.rs
+++ b/components/gfx/font.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
use crate::font_context::{FontContext, FontSource};
use crate::font_template::FontTemplateDescriptor;
use crate::platform::font::{FontHandle, FontTable};
@@ -12,6 +11,7 @@ use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods;
use crate::text::Shaper;
+use app_units::Au;
use euclid::{Point2D, Rect, Size2D};
use ordered_float::NotNan;
use servo_atoms::Atom;
diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs
index c932df2686b..4e8712c4ec1 100644
--- a/components/gfx/font_cache_thread.rs
+++ b/components/gfx/font_cache_thread.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope};
use crate::font_context::FontSource;
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
@@ -12,6 +11,7 @@ use crate::platform::font_list::for_each_variation;
use crate::platform::font_list::system_default_family;
use crate::platform::font_list::SANS_SERIF_FONT_FAMILY;
use crate::platform::font_template::FontTemplateData;
+use app_units::Au;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use net_traits::request::{Destination, RequestInit};
use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index 20b30a49159..d33c3cff602 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
use crate::font::{
Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef,
};
@@ -10,6 +9,7 @@ use crate::font_cache_thread::FontTemplateInfo;
use crate::font_template::FontTemplateDescriptor;
use crate::platform::font::FontHandle;
pub use crate::platform::font_context::FontContextHandle;
+use app_units::Au;
use fnv::FnvHasher;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_arc::Arc;
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index bf39a418f6e..d577fc9e92b 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -3,13 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::c_str_to_string;
-use app_units::Au;
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN};
use crate::platform::font_context::FontContextHandle;
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::GlyphId;
use crate::text::util::fixed_to_float;
+use app_units::Au;
use freetype::freetype::FT_Sfnt_Tag;
use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face};
use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec};
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index d346dc1838c..eff3d51789d 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::font::{
+ FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel,
+};
+use crate::font::{GPOS, GSUB, KERN};
+use crate::platform::font_template::FontTemplateData;
+use crate::platform::macos::font_context::FontContextHandle;
+use crate::text::glyph::GlyphId;
/// Implementation of Quartz (CoreGraphics) fonts.
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
@@ -13,13 +20,6 @@ use core_graphics::geometry::CGRect;
use core_text::font::CTFont;
use core_text::font_descriptor::kCTFontDefaultOrientation;
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
-use crate::font::{
- FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel,
-};
-use crate::font::{GPOS, GSUB, KERN};
-use crate::platform::font_template::FontTemplateData;
-use crate::platform::macos::font_context::FontContextHandle;
-use crate::text::glyph::GlyphId;
use servo_atoms::Atom;
use std::ops::Range;
use std::sync::Arc;
diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs
index 23195c9bc74..6c183066a9b 100644
--- a/components/gfx/platform/windows/font.rs
+++ b/components/gfx/platform/windows/font.rs
@@ -6,13 +6,13 @@
// information for an approach that we'll likely need to take when the
// renderer moves to a sandboxed process.
-use app_units::Au;
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
use crate::font::{FontTableTag, FractionalPixel};
use crate::platform::font_template::FontTemplateData;
use crate::platform::windows::font_context::FontContextHandle;
use crate::platform::windows::font_list::font_from_atom;
use crate::text::glyph::GlyphId;
+use app_units::Au;
use dwrote::{Font, FontFace, FontFile};
use dwrote::{FontStretch, FontStyle};
use servo_atoms::Atom;
diff --git a/components/gfx/tests/font_template.rs b/components/gfx/tests/font_template.rs
index f3771072c20..2e11f2d1f36 100644
--- a/components/gfx/tests/font_template.rs
+++ b/components/gfx/tests/font_template.rs
@@ -25,8 +25,8 @@ fn test_font_template_descriptor() {
"dejavu-fonts-ttf-2.37",
"ttf",
]
- .iter()
- .collect();
+ .iter()
+ .collect();
path.push(format!("{}.ttf", filename));
let file = File::open(path).unwrap();
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index c5dc268165e..d84570442ab 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -806,11 +806,12 @@ impl<'a> Iterator for GlyphIterator<'a> {
}
// No glyph range. Look at next byte.
- self.byte_index = self.byte_index + if self.store.is_rtl {
- ByteIndex(-1)
- } else {
- ByteIndex(1)
- };
+ self.byte_index = self.byte_index +
+ if self.store.is_rtl {
+ ByteIndex(-1)
+ } else {
+ ByteIndex(1)
+ };
let i = self.byte_index;
if !self.byte_range.contains(i) {
return None;
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index acbf8669be8..88cd19d59ff 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -4,12 +4,12 @@
#![allow(unsafe_code)]
-use app_units::Au;
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
use crate::platform::font::FontTable;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods;
use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
+use app_units::Au;
use euclid::Point2D;
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
// shapers. For now, however, HarfBuzz is a hard dependency.
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 17c2fdc27fc..12bee8a8e39 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags};
use crate::font::{RunMetrics, ShapingOptions};
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphStore};
+use app_units::Au;
use range::Range;
use std::cell::Cell;
use std::cmp::{max, Ordering};
@@ -293,9 +293,10 @@ impl<'a> TextRun {
// TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text
self.natural_word_slices_in_range(range)
.fold(Au(0), |advance, slice| {
- advance + slice
- .glyphs
- .advance_for_byte_range(&slice.range, self.extra_word_spacing)
+ advance +
+ slice
+ .glyphs
+ .advance_for_byte_range(&slice.range, self.extra_word_spacing)
})
}
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 026a267f449..96e4801fa4e 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -78,16 +78,17 @@ pub fn update_animation_state<E>(
for (key, running_animations) in running_animations.iter_mut() {
let mut animations_still_running = vec![];
for mut running_animation in running_animations.drain(..) {
- let still_running = !running_animation.is_expired() && match running_animation {
- Animation::Transition(_, started_at, ref frame) => {
- now < started_at + frame.duration
- },
- Animation::Keyframes(_, _, _, ref mut state) => {
- // This animation is still running, or we need to keep
- // iterating.
- now < state.started_at + state.duration || state.tick()
- },
- };
+ let still_running = !running_animation.is_expired() &&
+ match running_animation {
+ Animation::Transition(_, started_at, ref frame) => {
+ now < started_at + frame.duration
+ },
+ Animation::Keyframes(_, _, _, ref mut state) => {
+ // This animation is still running, or we need to keep
+ // iterating.
+ now < state.started_at + state.duration || state.tick()
+ },
+ };
debug!(
"update_animation_state({:?}): {:?}",
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 8077b66f821..823d5226ea1 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -25,7 +25,6 @@
//!
//! http://dev.w3.org/csswg/css-sizing/
-use app_units::{Au, MAX_AU};
use crate::context::LayoutContext;
use crate::display_list::items::DisplayListSection;
use crate::display_list::StackingContextCollectionState;
@@ -49,6 +48,7 @@ use crate::model::{
};
use crate::sequential;
use crate::traversal::PreorderFlowTraversal;
+use app_units::{Au, MAX_AU};
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::print_tree::PrintTree;
use serde::{Serialize, Serializer};
@@ -809,11 +809,10 @@ impl BlockFlow {
viewport_size: &Size2D<Au>,
descendant: OpaqueFlow,
) -> LogicalSize<Au> {
- debug_assert!(
- self.base
- .flags
- .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
- );
+ debug_assert!(self
+ .base
+ .flags
+ .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
if self.is_fixed() || self.is_root() {
// Initial containing block is the CB for the root
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
@@ -1176,10 +1175,11 @@ impl BlockFlow {
let mut block_size = cur_b - block_start_offset;
let is_root = self.is_root();
- if is_root || self.formatting_context_type() != FormattingContextType::None || self
- .base
- .flags
- .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
+ if is_root ||
+ self.formatting_context_type() != FormattingContextType::None ||
+ self.base
+ .flags
+ .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
{
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
// way to handle this is to just treat it as clearance.
@@ -1953,14 +1953,12 @@ impl BlockFlow {
)
},
(Float::Left, _) => {
- left_float_width_accumulator = left_float_width_accumulator + child_base
- .intrinsic_inline_sizes
- .preferred_inline_size;
+ left_float_width_accumulator = left_float_width_accumulator +
+ child_base.intrinsic_inline_sizes.preferred_inline_size;
},
(Float::Right, _) => {
- right_float_width_accumulator = right_float_width_accumulator + child_base
- .intrinsic_inline_sizes
- .preferred_inline_size;
+ right_float_width_accumulator = right_float_width_accumulator +
+ child_base.intrinsic_inline_sizes.preferred_inline_size;
},
}
}
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 76b15b3b1c7..efa31184dac 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -763,17 +763,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
node: &ConcreteThreadSafeLayoutNode,
) -> ConstructionResult {
let mut fragments = IntermediateInlineFragments::new();
- let node_is_input_or_text_area =
- node.type_id() == Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
- node.type_id() == Some(LayoutNodeType::Element(
+ let node_is_input_or_text_area = node.type_id() ==
+ Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
+ node.type_id() ==
+ Some(LayoutNodeType::Element(
LayoutElementType::HTMLTextAreaElement,
));
if node.get_pseudo_element_type().is_replaced_content() || node_is_input_or_text_area {
// A TextArea's text contents are displayed through the input text
// box, so don't construct them.
- if node.type_id() == Some(LayoutNodeType::Element(
- LayoutElementType::HTMLTextAreaElement,
- )) {
+ if node.type_id() ==
+ Some(LayoutNodeType::Element(
+ LayoutElementType::HTMLTextAreaElement,
+ ))
+ {
for kid in node.children() {
self.set_flow_construction_result(&kid, ConstructionResult::None)
}
diff --git a/components/layout/data.rs b/components/layout/data.rs
index 697aa58c65a..5f6672d1488 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use atomic_refcell::AtomicRefCell;
use crate::construct::ConstructionResult;
+use atomic_refcell::AtomicRefCell;
use script_layout_interface::StyleData;
#[repr(C)]
diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs
index 85bb7960a8e..89d6aebb0db 100644
--- a/components/layout/display_list/background.rs
+++ b/components/layout/display_list/background.rs
@@ -4,9 +4,9 @@
// FIXME(rust-lang/rust#26264): Remove GenericBackgroundSize.
-use app_units::Au;
use crate::display_list::border;
use crate::model::MaybeAuto;
+use app_units::Au;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use style::computed_values::background_attachment::single_value::T as BackgroundAttachment;
use style::computed_values::background_clip::single_value::T as BackgroundClip;
diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs
index bf1df990096..265b25a2805 100644
--- a/components/layout/display_list/border.rs
+++ b/components/layout/display_list/border.rs
@@ -4,8 +4,8 @@
// FIXME(rust-lang/rust#26264): Remove GenericBorderImageSideWidth.
-use app_units::Au;
use crate::display_list::ToLayout;
+use app_units::Au;
use euclid::{Rect, SideOffsets2D, Size2D};
use style::computed_values::border_image_outset::T as BorderImageOutset;
use style::properties::style_structs::Border;
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index 835c39865ff..e3dd66b8a2b 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -8,8 +8,6 @@
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
//! paint.
-use app_units::{Au, AU_PER_PX};
-use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
use crate::block::BlockFlow;
use crate::context::LayoutContext;
use crate::display_list::background::{self, get_cyclic};
@@ -33,6 +31,8 @@ use crate::inline::{InlineFlow, InlineFragmentNodeFlags};
use crate::list_item::ListItemFlow;
use crate::model::MaybeAuto;
use crate::table_cell::CollapsedBordersForCell;
+use app_units::{Au, AU_PER_PX};
+use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedRect, TypedSize2D, Vector2D};
use fnv::FnvHashMap;
use gfx::text::glyph::ByteIndex;
@@ -2172,13 +2172,10 @@ impl FragmentDisplayListBuilding for Fragment {
// FIXME(pcwalton): Get the real container size.
let container_size = Size2D::zero();
let metrics = &text_fragment.run.font_metrics;
- let baseline_origin = stacking_relative_content_box.origin + LogicalPoint::new(
- self.style.writing_mode,
- Au(0),
- metrics.ascent,
- )
- .to_physical(self.style.writing_mode, container_size)
- .to_vector();
+ let baseline_origin = stacking_relative_content_box.origin +
+ LogicalPoint::new(self.style.writing_mode, Au(0), metrics.ascent)
+ .to_physical(self.style.writing_mode, container_size)
+ .to_vector();
// Base item for all text/shadows
let base = state.create_base_display_item(
diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs
index 6ed057f9c24..6cdee3d6df8 100644
--- a/components/layout/display_list/gradient.rs
+++ b/components/layout/display_list/gradient.rs
@@ -4,8 +4,8 @@
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
-use app_units::Au;
use crate::display_list::ToLayout;
+use app_units::Au;
use euclid::{Point2D, Size2D, Vector2D};
use style::properties::ComputedValues;
use style::values::computed::image::{EndingShape, LineDirection};
diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs
index 6525087f8c9..030464fd881 100644
--- a/components/layout/display_list/items.rs
+++ b/components/layout/display_list/items.rs
@@ -513,29 +513,28 @@ impl ClippingRegion {
/// This is a quick, not a precise, test; it can yield false positives.
#[inline]
pub fn might_intersect_point(&self, point: &LayoutPoint) -> bool {
- self.main.contains(point) && self
- .complex
- .iter()
- .all(|complex| complex.rect.contains(point))
+ self.main.contains(point) &&
+ self.complex
+ .iter()
+ .all(|complex| complex.rect.contains(point))
}
/// Returns true if this clipping region might intersect the given rectangle and false
/// otherwise. This is a quick, not a precise, test; it can yield false positives.
#[inline]
pub fn might_intersect_rect(&self, rect: &LayoutRect) -> bool {
- self.main.intersects(rect) && self
- .complex
- .iter()
- .all(|complex| complex.rect.intersects(rect))
+ self.main.intersects(rect) &&
+ self.complex
+ .iter()
+ .all(|complex| complex.rect.intersects(rect))
}
/// Returns true if this clipping region completely surrounds the given rect.
#[inline]
pub fn does_not_clip_rect(&self, rect: &LayoutRect) -> bool {
- self.main.contains(&rect.origin) && self.main.contains(&rect.bottom_right()) && self
- .complex
- .iter()
- .all(|complex| {
+ self.main.contains(&rect.origin) &&
+ self.main.contains(&rect.bottom_right()) &&
+ self.complex.iter().all(|complex| {
complex.rect.contains(&rect.origin) && complex.rect.contains(&rect.bottom_right())
})
}
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 6eb99d88262..1848cdf2e81 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -4,7 +4,6 @@
//! Layout for elements with a CSS `display` property of `flex`.
-use app_units::{Au, MAX_AU};
use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag};
use crate::context::LayoutContext;
use crate::display_list::StackingContextCollectionState;
@@ -16,6 +15,7 @@ use crate::layout_debug;
use crate::model::{AdjoiningMargins, CollapsibleMargins};
use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
use crate::traversal::PreorderFlowTraversal;
+use app_units::{Au, MAX_AU};
use euclid::Point2D;
use std::cmp::{max, min};
use std::ops::Range;
@@ -846,13 +846,14 @@ impl FlexFlow {
// as if it has a fixed cross size, all child blocks should resolve against it.
// block.assign_block_size(layout_context);
}
- block.base.position.start.b = margin_block_start + if !self.cross_reverse {
- cur_b
- } else {
- self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
- cur_b -
- line.cross_size
- };
+ block.base.position.start.b = margin_block_start +
+ if !self.cross_reverse {
+ cur_b
+ } else {
+ self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
+ cur_b -
+ line.cross_size
+ };
// TODO(stshine): support baseline alignment.
if free_space != Au(0) {
let flex_cross = match self_align {
diff --git a/components/layout/floats.rs b/components/layout/floats.rs
index a423ead9f6d..5e9ee3ae886 100644
--- a/components/layout/floats.rs
+++ b/components/layout/floats.rs
@@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::{Au, MAX_AU};
use crate::block::FormattingContextType;
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
use crate::persistent_list::PersistentList;
+use app_units::{Au, MAX_AU};
use std::cmp::{max, min};
use std::fmt;
use style::computed_values::float::T as StyleFloat;
@@ -353,7 +353,7 @@ impl Floats {
info.ceiling,
info.max_inline_size,
MAX_AU,
- )
+ );
},
FloatKind::Right => {
return LogicalRect::new(
@@ -362,7 +362,7 @@ impl Floats {
info.ceiling,
info.max_inline_size,
MAX_AU,
- )
+ );
},
}
}
@@ -395,7 +395,7 @@ impl Floats {
info.max_inline_size,
MAX_AU,
),
- }
+ };
},
Some(rect) => {
assert_ne!(
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index c649cc32eeb..2059fe35525 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -25,7 +25,6 @@
//! line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
//! similar methods.
-use app_units::Au;
use crate::block::{BlockFlow, FormattingContextType};
use crate::context::LayoutContext;
use crate::display_list::items::ClippingAndScrolling;
@@ -46,6 +45,7 @@ use crate::table_colgroup::TableColGroupFlow;
use crate::table_row::TableRowFlow;
use crate::table_rowgroup::TableRowGroupFlow;
use crate::table_wrapper::TableWrapperFlow;
+use app_units::Au;
use euclid::{Point2D, Rect, Size2D, Vector2D};
use gfx_traits::print_tree::PrintTree;
use gfx_traits::StackingContextId;
@@ -342,14 +342,14 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
overflow.scroll.size.height = border_box.size.height;
}
- if !self.as_block().fragment.establishes_stacking_context() || self
- .as_block()
- .fragment
- .style
- .get_box()
- .transform
- .0
- .is_empty()
+ if !self.as_block().fragment.establishes_stacking_context() ||
+ self.as_block()
+ .fragment
+ .style
+ .get_box()
+ .transform
+ .0
+ .is_empty()
{
overflow.translate(&position.origin.to_vector());
return overflow;
@@ -466,10 +466,10 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
}
fn contains_positioned_fragments(&self) -> bool {
- self.contains_relatively_positioned_fragments() || self
- .base()
- .flags
- .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
+ self.contains_relatively_positioned_fragments() ||
+ self.base()
+ .flags
+ .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
}
fn contains_relatively_positioned_fragments(&self) -> bool {
@@ -1406,10 +1406,10 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
return Some(kid.base().position.start.b + baseline_offset);
}
}
- if kid.is_block_like() && !kid
- .base()
- .flags
- .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
+ if kid.is_block_like() &&
+ !kid.base()
+ .flags
+ .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
{
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
return Some(kid.base().position.start.b + baseline_offset);
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index e95d0293894..3e84a36c595 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -4,8 +4,6 @@
//! The `Fragment` type, which represents the leaves of the layout tree.
-use app_units::Au;
-use canvas_traits::canvas::{CanvasId, CanvasMsg};
use crate::context::{with_thread_local_font_context, LayoutContext};
use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR};
use crate::display_list::ToLayout;
@@ -22,6 +20,8 @@ use crate::text;
use crate::text::TextRunScanner;
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::ServoArc;
+use app_units::Au;
+use canvas_traits::canvas::{CanvasId, CanvasMsg};
use euclid::{Point2D, Rect, Size2D, Vector2D};
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
@@ -849,10 +849,10 @@ impl Fragment {
}
pub fn contains_node(&self, node_address: OpaqueNode) -> bool {
- node_address == self.node || self
- .inline_context
- .as_ref()
- .map_or(false, |ctx| ctx.contains_node(node_address))
+ node_address == self.node ||
+ self.inline_context
+ .as_ref()
+ .map_or(false, |ctx| ctx.contains_node(node_address))
}
/// Adds a style to the inline context for this fragment. If the inline context doesn't exist
@@ -1939,9 +1939,9 @@ impl Fragment {
// The advance is more than the remaining inline-size, so split here. First, check to
// see if we're going to overflow the line. If so, perform a best-effort split.
let mut remaining_range = slice.text_run_range();
- let split_is_empty = inline_start_range.is_empty() && !(self
- .requires_line_break_afterward_if_wrapping_on_newlines() &&
- !self.white_space().allow_wrap());
+ let split_is_empty = inline_start_range.is_empty() &&
+ !(self.requires_line_break_afterward_if_wrapping_on_newlines() &&
+ !self.white_space().allow_wrap());
if split_is_empty {
// We're going to overflow the line.
overflowing = true;
@@ -2416,9 +2416,9 @@ impl Fragment {
minimum_line_metrics.space_above_baseline
},
VerticalAlign::TextBottom => {
- offset = minimum_line_metrics.space_below_baseline - self
- .content_inline_metrics(layout_context)
- .space_below_baseline
+ offset = minimum_line_metrics.space_below_baseline -
+ self.content_inline_metrics(layout_context)
+ .space_below_baseline
},
VerticalAlign::Top => {
if let Some(actual_line_metrics) = actual_line_metrics {
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index 0df2540489f..e3007511f8e 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -62,17 +62,18 @@ impl<'a> LayoutDamageComputation for &'a mut dyn Flow {
.damage_for_parent(child_is_absolutely_positioned),
);
- has_counter_affecting_children =
- has_counter_affecting_children || kid.base().flags.intersects(
+ has_counter_affecting_children = has_counter_affecting_children ||
+ kid.base().flags.intersects(
FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN,
);
}
}
let self_base = self.mut_base();
- if self_base.flags.float_kind() != Float::None && self_base
- .restyle_damage
- .intersects(ServoRestyleDamage::REFLOW)
+ if self_base.flags.float_kind() != Float::None &&
+ self_base
+ .restyle_damage
+ .intersects(ServoRestyleDamage::REFLOW)
{
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
}
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index eceb2c7594e..34161a16702 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::{Au, MIN_AU};
use crate::block::AbsoluteAssignBSizesTraversal;
use crate::context::{LayoutContext, LayoutFontContext};
use crate::display_list::items::OpaqueNode;
@@ -20,6 +19,7 @@ use crate::model::IntrinsicISizesContribution;
use crate::text;
use crate::traversal::PreorderFlowTraversal;
use crate::ServoArc;
+use app_units::{Au, MIN_AU};
use euclid::{Point2D, Size2D};
use gfx::font::FontMetrics;
use gfx_traits::print_tree::PrintTree;
@@ -1363,9 +1363,9 @@ impl InlineFlow {
fragment_index: FragmentIndex,
) -> Range<FragmentIndex> {
let mut start_index = fragment_index;
- while start_index > FragmentIndex(0) && self.fragments.fragments
- [(start_index - FragmentIndex(1)).get() as usize]
- .is_positioned()
+ while start_index > FragmentIndex(0) &&
+ self.fragments.fragments[(start_index - FragmentIndex(1)).get() as usize]
+ .is_positioned()
{
start_index = start_index - FragmentIndex(1)
}
diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs
index c0082a8d635..08ae74f4cbe 100644
--- a/components/layout/list_item.rs
+++ b/components/layout/list_item.rs
@@ -5,7 +5,6 @@
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an extra inline fragment for the marker.
-use app_units::Au;
use crate::block::BlockFlow;
use crate::context::{with_thread_local_font_context, LayoutContext};
use crate::display_list::StackingContextCollectionState;
@@ -18,6 +17,7 @@ use crate::fragment::{
};
use crate::generated_content;
use crate::inline::InlineFlow;
+use app_units::Au;
use euclid::Point2D;
use style::computed_values::list_style_type::T as ListStyleType;
use style::computed_values::position::T as Position;
diff --git a/components/layout/model.rs b/components/layout/model.rs
index 9daeb770f9d..4db60d05a4b 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -4,8 +4,8 @@
//! Borders, padding, and margins.
-use app_units::Au;
use crate::fragment::Fragment;
+use app_units::Au;
use euclid::SideOffsets2D;
use std::cmp::{max, min};
use std::fmt;
@@ -133,8 +133,8 @@ impl MarginCollapseInfo {
) -> (CollapsibleMargins, Au) {
let state = match self.state {
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
- may_collapse_through =
- may_collapse_through && match fragment.style().content_block_size() {
+ may_collapse_through = may_collapse_through &&
+ match fragment.style().content_block_size() {
LengthOrPercentageOrAuto::Auto => true,
LengthOrPercentageOrAuto::Length(l) => l.px() == 0.,
LengthOrPercentageOrAuto::Percentage(v) => {
diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs
index 986d0d3a7b1..294670f0a1e 100644
--- a/components/layout/multicol.rs
+++ b/components/layout/multicol.rs
@@ -4,7 +4,6 @@
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
-use app_units::Au;
use crate::block::BlockFlow;
use crate::context::LayoutContext;
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
@@ -12,6 +11,7 @@ use crate::floats::FloatKind;
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use crate::ServoArc;
+use app_units::Au;
use euclid::{Point2D, Vector2D};
use gfx_traits::print_tree::PrintTree;
use std::cmp::{max, min};
diff --git a/components/layout/query.rs b/components/layout/query.rs
index d7801c389da..60d1719e13a 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -4,7 +4,6 @@
//! Utilities for querying the layout, as needed by the layout thread.
-use app_units::Au;
use crate::construct::ConstructionResult;
use crate::context::LayoutContext;
use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap};
@@ -15,6 +14,7 @@ use crate::inline::InlineFragmentNodeFlags;
use crate::opaque_node::OpaqueNodeMethods;
use crate::sequential;
use crate::wrapper::LayoutNodeLayoutData;
+use app_units::Au;
use euclid::{Point2D, Rect, Size2D, Vector2D};
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
@@ -777,7 +777,7 @@ where
// so this should be web-compatible.
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
PropertyId::Custom(ref name) => {
- return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
+ return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
},
};
@@ -825,7 +825,7 @@ where
// so this should be web-compatible.
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
PropertyId::Custom(ref name) => {
- return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
+ return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
},
};
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs
index 2e10187dbd9..a1fe086d79f 100644
--- a/components/layout/sequential.rs
+++ b/components/layout/sequential.rs
@@ -4,7 +4,6 @@
//! Implements sequential traversals over the DOM and flow trees.
-use app_units::Au;
use crate::context::LayoutContext;
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
use crate::floats::SpeculatedFloatPlacement;
@@ -14,6 +13,7 @@ use crate::generated_content::ResolveGeneratedContent;
use crate::incremental::RelayoutMode;
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
+use app_units::Au;
use euclid::{Point2D, Vector2D};
use servo_config::opts;
use style::servo::restyle_damage::ServoRestyleDamage;
@@ -106,10 +106,11 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(
.stacking_relative_border_box(CoordinateSystem::Own);
if let Some(matrix) = kid.as_block().fragment.transform_matrix(&relative_position) {
let transform_matrix = matrix.transform_point2d(&LayoutPoint::zero()).unwrap();
- stacking_context_position = stacking_context_position + Vector2D::new(
- Au::from_f32_px(transform_matrix.x),
- Au::from_f32_px(transform_matrix.y),
- )
+ stacking_context_position = stacking_context_position +
+ Vector2D::new(
+ Au::from_f32_px(transform_matrix.x),
+ Au::from_f32_px(transform_matrix.y),
+ )
}
}
doit(kid, level + 1, iterator, &stacking_context_position);
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 965d1cb7880..5f08b107b31 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -4,7 +4,6 @@
//! CSS table formatting contexts.
-use app_units::Au;
use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
use crate::block::{ISizeConstraintInput, ISizeConstraintSolution};
use crate::context::LayoutContext;
@@ -24,6 +23,7 @@ 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 app_units::Au;
use euclid::Point2D;
use gfx_traits::print_tree::PrintTree;
use std::{cmp, fmt};
@@ -952,9 +952,8 @@ impl TableLikeFlow for BlockFlow {
row.mut_base().restyle_damage.remove(
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
);
- current_block_offset =
- current_block_offset +
- border_spacing_for_row(&self.fragment, row, block_direction_spacing);
+ current_block_offset = current_block_offset +
+ border_spacing_for_row(&self.fragment, row, block_direction_spacing);
i += 1;
}
@@ -990,11 +989,12 @@ impl TableLikeFlow for BlockFlow {
current_block_offset = current_block_offset + delta;
// Take border, padding, and spacing into account.
- let block_end_offset = self.fragment.border_padding.block_end + if has_rows {
- block_direction_spacing
- } else {
- Au(0)
- };
+ let block_end_offset = self.fragment.border_padding.block_end +
+ if has_rows {
+ block_direction_spacing
+ } else {
+ Au(0)
+ };
current_block_offset = current_block_offset + block_end_offset;
// Now that `current_block_offset` is at the block-end of the border box, compute the
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index 8bd4fcccaaa..b217aa65f8b 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -4,13 +4,13 @@
//! CSS table formatting contexts.
-use app_units::Au;
use crate::block::BlockFlow;
use crate::context::LayoutContext;
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState};
use crate::flow::{Flow, FlowClass, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
+use app_units::Au;
use euclid::Point2D;
use gfx_traits::print_tree::PrintTree;
use std::fmt;
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index 55510de3a2a..b5d95b1e4dd 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -4,7 +4,6 @@
//! CSS table formatting contexts.
-use app_units::Au;
use crate::block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
use crate::context::LayoutContext;
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
@@ -15,6 +14,7 @@ use crate::layout_debug;
use crate::model::MaybeAuto;
use crate::table::InternalTable;
use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance};
+use app_units::Au;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use gfx_traits::print_tree::PrintTree;
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
@@ -106,12 +106,15 @@ impl TableCellFlow {
if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
continue;
}
- let start = kid_base.position.start.b - kid_base
- .collapsible_margins
- .block_start_margin_for_noncollapsible_context();
- let end = kid_base.position.start.b + kid_base.position.size.block + kid_base
- .collapsible_margins
- .block_end_margin_for_noncollapsible_context();
+ let start = kid_base.position.start.b -
+ kid_base
+ .collapsible_margins
+ .block_start_margin_for_noncollapsible_context();
+ let end = kid_base.position.start.b +
+ kid_base.position.size.block +
+ kid_base
+ .collapsible_margins
+ .block_end_margin_for_noncollapsible_context();
match extents {
Some((ref mut first_start, ref mut last_end)) => {
if start < *first_start {
diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs
index 3b83744f979..28cdafea7ec 100644
--- a/components/layout/table_colgroup.rs
+++ b/components/layout/table_colgroup.rs
@@ -4,12 +4,12 @@
//! CSS table formatting contexts.
-use app_units::Au;
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 app_units::Au;
use euclid::Point2D;
use std::fmt;
use style::logical_geometry::LogicalSize;
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index e193f68a30c..90c3c812f1c 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -4,7 +4,6 @@
//! CSS table formatting contexts.
-use app_units::Au;
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
use crate::context::LayoutContext;
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
@@ -18,6 +17,7 @@ use crate::layout_debug;
use crate::model::MaybeAuto;
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
+use app_units::Au;
use euclid::Point2D;
use gfx_traits::print_tree::PrintTree;
use serde::{Serialize, Serializer};
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index 1ce2a0477ee..b2afd3c2aba 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -4,7 +4,6 @@
//! CSS table formatting contexts.
-use app_units::Au;
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
use crate::context::LayoutContext;
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
@@ -13,6 +12,7 @@ use crate::flow::{Flow, FlowClass, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use crate::layout_debug;
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
+use app_units::Au;
use euclid::Point2D;
use gfx_traits::print_tree::PrintTree;
use serde::{Serialize, Serializer};
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index f5f57eee16a..94d7d2d32a0 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -11,7 +11,6 @@
//!
//! Hereafter this document is referred to as INTRINSIC.
-use app_units::Au;
use crate::block::{
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput,
};
@@ -26,6 +25,7 @@ use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use crate::model::MaybeAuto;
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
+use app_units::Au;
use euclid::Point2D;
use gfx_traits::print_tree::PrintTree;
use std::cmp::{max, min};
@@ -795,18 +795,18 @@ impl ExcessInlineSizeDistributionInfo {
if !column_intrinsic_inline_size.constrained &&
column_intrinsic_inline_size.percentage == 0.0
{
- column_intrinsic_inline_size.preferred.to_f32_px() / self
- .preferred_inline_size_of_nonconstrained_columns_with_no_percentage
- .to_f32_px()
+ column_intrinsic_inline_size.preferred.to_f32_px() /
+ self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
+ .to_f32_px()
} else {
0.0
}
} else if self.count_of_nonconstrained_columns_with_no_percentage > 0 {
1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat)
} else if self.preferred_inline_size_of_constrained_columns_with_no_percentage > Au(0) {
- column_intrinsic_inline_size.preferred.to_f32_px() / self
- .preferred_inline_size_of_constrained_columns_with_no_percentage
- .to_f32_px()
+ column_intrinsic_inline_size.preferred.to_f32_px() /
+ self.preferred_inline_size_of_constrained_columns_with_no_percentage
+ .to_f32_px()
} else if self.total_percentage > 0.0 {
column_intrinsic_inline_size.percentage / self.total_percentage
} else {
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 703f3d5954d..aba5703a1c6 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -4,12 +4,12 @@
//! Text layout.
-use app_units::Au;
use crate::context::LayoutFontContext;
use crate::fragment::{Fragment, ScannedTextFlags};
use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use crate::inline::{InlineFragmentNodeFlags, InlineFragments};
use crate::linked_list::split_off_head;
+use app_units::Au;
use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::TextRun;
@@ -112,11 +112,11 @@ impl TextRunScanner {
// Create a clump.
split_first_fragment_at_newline_if_necessary(&mut fragments);
self.clump.append(&mut split_off_head(&mut fragments));
- while !fragments.is_empty() && self
- .clump
- .back()
- .unwrap()
- .can_merge_with_fragment(fragments.front().unwrap())
+ while !fragments.is_empty() &&
+ self.clump
+ .back()
+ .unwrap()
+ .can_merge_with_fragment(fragments.front().unwrap())
{
split_first_fragment_at_newline_if_necessary(&mut fragments);
self.clump.append(&mut split_off_head(&mut fragments));
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 9ffd4e87c29..6d44fcfc5e4 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -201,9 +201,10 @@ where
// Always reconstruct if incremental layout is turned off.
let nonincremental_layout = opts::get().nonincremental_layout;
- if nonincremental_layout || tnode.restyle_damage() != RestyleDamage::empty() || node
- .as_element()
- .map_or(false, |el| el.has_dirty_descendants())
+ if nonincremental_layout ||
+ tnode.restyle_damage() != RestyleDamage::empty() ||
+ node.as_element()
+ .map_or(false, |el| el.has_dirty_descendants())
{
let mut flow_constructor = FlowConstructor::new(context);
if nonincremental_layout || !flow_constructor.repair_if_possible(&tnode) {
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 3602acf7f7b..063d7f3d25d 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -30,8 +30,8 @@
#![allow(unsafe_code)]
-use atomic_refcell::{AtomicRef, AtomicRefMut};
use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData};
+use atomic_refcell::{AtomicRef, AtomicRefMut};
use script_layout_interface::wrapper_traits::GetLayoutData;
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use style::dom::{NodeInfo, TNode};
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 5b82577932f..9b6e801979b 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -20,9 +20,9 @@ extern crate profile_traits;
mod dom_wrapper;
-use app_units::Au;
use crate::dom_wrapper::drop_style_and_layout_data;
use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
+use app_units::Au;
use crossbeam_channel::{unbounded, Receiver, Sender};
use embedder_traits::resources::{self, Resource};
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs
index 30f7b608db0..6bc55f1387b 100644
--- a/components/net/cookie_storage.rs
+++ b/components/net/cookie_storage.rs
@@ -233,9 +233,10 @@ fn evict_one_cookie(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> bool {
fn get_oldest_accessed(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> Option<(usize, Tm)> {
let mut oldest_accessed: Option<(usize, Tm)> = None;
for (i, c) in cookies.iter().enumerate() {
- if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) && oldest_accessed
- .as_ref()
- .map_or(true, |a| c.last_access < a.1)
+ if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) &&
+ oldest_accessed
+ .as_ref()
+ .map_or(true, |a| c.last_access < a.1)
{
oldest_accessed = Some((i, c.last_access));
}
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index 05559b57b41..12aff01e9a4 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -253,10 +253,10 @@ pub fn main_fetch(
Response::network_error(NetworkError::Internal("Non-http scheme".into()))
} else if request.use_cors_preflight ||
(request.unsafe_request &&
- (!is_cors_safelisted_method(&request.method) || request
- .headers
- .iter()
- .any(|(name, value)| !is_cors_safelisted_request_header(&name, &value))))
+ (!is_cors_safelisted_method(&request.method) ||
+ request.headers.iter().any(|(name, value)| {
+ !is_cors_safelisted_request_header(&name, &value)
+ })))
{
// Substep 1.
request.response_tainting = ResponseTainting::CorsTainting;
@@ -372,10 +372,12 @@ pub fn main_fetch(
// in the previous step.
let not_network_error = !response_is_network_error && !internal_response.is_network_error();
if not_network_error &&
- (is_null_body_status(&internal_response.status) || match request.method {
- Method::HEAD | Method::CONNECT => true,
- _ => false,
- }) {
+ (is_null_body_status(&internal_response.status) ||
+ match request.method {
+ Method::HEAD | Method::CONNECT => true,
+ _ => false,
+ })
+ {
// when Fetch is used only asynchronously, we will need to make sure
// that nothing tries to write to the body at this point
let mut body = internal_response.body.lock().unwrap();
@@ -785,7 +787,8 @@ pub fn should_be_blocked_due_to_nosniff(
.get("x-content-type-options")
.map_or(true, |val| {
val.to_str().unwrap_or("").to_lowercase() != "nosniff"
- }) {
+ })
+ {
return false;
}
@@ -850,12 +853,13 @@ fn should_be_blocked_due_to_mime_type(
};
// Step 2-3
- destination.is_script_like() && match mime_type.type_() {
- mime::AUDIO | mime::VIDEO | mime::IMAGE => true,
- mime::TEXT if mime_type.subtype() == mime::CSV => true,
- // Step 4
- _ => false,
- }
+ destination.is_script_like() &&
+ match mime_type.type_() {
+ mime::AUDIO | mime::VIDEO | mime::IMAGE => true,
+ mime::TEXT if mime_type.subtype() == mime::CSV => true,
+ // Step 4
+ _ => false,
+ }
}
/// <https://fetch.spec.whatwg.org/#block-bad-port>
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index 2fb98359a58..1290d7754b3 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use brotli::Decompressor;
-use bytes::Bytes;
use crate::connector::{create_http_client, Connector, WrappedBody, BUF_SIZE};
use crate::cookie;
use crate::cookie_storage::CookieStorage;
@@ -15,6 +13,8 @@ use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target};
use crate::hsts::HstsList;
use crate::http_cache::HttpCache;
use crate::resource_thread::AuthCache;
+use brotli::Decompressor;
+use bytes::Bytes;
use crossbeam_channel::{unbounded, Sender};
use devtools_traits::{
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
@@ -684,13 +684,13 @@ pub fn http_redirect_fetch(
Some(Err(err)) => {
return Response::network_error(NetworkError::Internal(
"Location URL parse failure: ".to_owned() + &err,
- ))
+ ));
},
// Step 4
Some(Ok(ref url)) if !matches!(url.scheme(), "http" | "https") => {
return Response::network_error(NetworkError::Internal(
"Location URL not an HTTP(S) scheme".into(),
- ))
+ ));
},
Some(Ok(url)) => url,
};
@@ -749,7 +749,8 @@ pub fn http_redirect_fetch(
((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) &&
request.method == Method::POST) ||
(*code == StatusCode::SEE_OTHER && request.method != Method::HEAD)
- }) {
+ })
+ {
request.method = Method::GET;
request.body = None;
}
@@ -1069,10 +1070,11 @@ fn http_network_or_cache_fetch(
}
}
// Substep 4
- if revalidating_flag && forward_response
- .status
- .as_ref()
- .map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
+ if revalidating_flag &&
+ forward_response
+ .status
+ .as_ref()
+ .map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
{
if let Ok(mut http_cache) = context.state.http_cache.write() {
response = http_cache.refresh(&http_request, forward_response.clone(), done_chan);
@@ -1416,10 +1418,11 @@ fn cors_preflight_fetch(
let response = http_network_or_cache_fetch(&mut preflight, false, false, &mut None, context);
// Step 6
- if cors_check(&request, &response).is_ok() && response
- .status
- .as_ref()
- .map_or(false, |(status, _)| status.is_success())
+ if cors_check(&request, &response).is_ok() &&
+ response
+ .status
+ .as_ref()
+ .map_or(false, |(status, _)| status.is_success())
{
// Substep 1, 2
let mut methods = if response
@@ -1432,7 +1435,7 @@ fn cors_preflight_fetch(
None => {
return Response::network_error(NetworkError::Internal(
"CORS ACAM check failed".into(),
- ))
+ ));
},
}
} else {
@@ -1450,7 +1453,7 @@ fn cors_preflight_fetch(
None => {
return Response::network_error(NetworkError::Internal(
"CORS ACAH check failed".into(),
- ))
+ ));
},
}
} else {
diff --git a/components/net/mime_classifier.rs b/components/net/mime_classifier.rs
index 38a1273c38a..2a32fcf9948 100644
--- a/components/net/mime_classifier.rs
+++ b/components/net/mime_classifier.rs
@@ -404,9 +404,10 @@ impl Mp4Matcher {
}
let mp4 = [0x6D, 0x70, 0x34];
- data[8..].starts_with(&mp4) || data[16..box_size]
- .chunks(4)
- .any(|chunk| chunk.starts_with(&mp4))
+ data[8..].starts_with(&mp4) ||
+ data[16..box_size]
+ .chunks(4)
+ .any(|chunk| chunk.starts_with(&mp4))
}
}
impl MIMEChecker for Mp4Matcher {
diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs
index 6831ca7aa46..fa76d87fa27 100644
--- a/components/net/tests/fetch.rs
+++ b/components/net/tests/fetch.rs
@@ -260,25 +260,19 @@ fn test_cors_preflight_fetch() {
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
{
- assert!(
- request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
- );
- assert!(
- !request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
- );
- assert!(
- !request
- .headers()
- .get(header::REFERER)
- .unwrap()
- .to_str()
- .unwrap()
- .contains("a.html")
- );
+ assert!(request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
+ assert!(!request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
+ assert!(!request
+ .headers()
+ .get(header::REFERER)
+ .unwrap()
+ .to_str()
+ .unwrap()
+ .contains("a.html"));
response
.headers_mut()
.typed_insert(AccessControlAllowOrigin::ANY);
@@ -324,16 +318,12 @@ fn test_cors_preflight_cache_fetch() {
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
{
- assert!(
- request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
- );
- assert!(
- !request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
- );
+ assert!(request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
+ assert!(!request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
response
.headers_mut()
.typed_insert(AccessControlAllowOrigin::ANY);
@@ -393,16 +383,12 @@ fn test_cors_preflight_fetch_network_error() {
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
{
- assert!(
- request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
- );
- assert!(
- !request
- .headers()
- .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
- );
+ assert!(request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
+ assert!(!request
+ .headers()
+ .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
response
.headers_mut()
.typed_insert(AccessControlAllowOrigin::ANY);
@@ -461,11 +447,9 @@ fn test_fetch_response_is_basic_filtered() {
let headers = fetch_response.headers;
assert!(!headers.contains_key(header::SET_COOKIE));
- assert!(
- headers
- .get(HeaderName::from_static("set-cookie2"))
- .is_none()
- );
+ assert!(headers
+ .get(HeaderName::from_static("set-cookie2"))
+ .is_none());
}
#[test]
@@ -535,11 +519,9 @@ fn test_fetch_response_is_cors_filtered() {
assert!(!headers.contains_key(header::ACCESS_CONTROL_ALLOW_ORIGIN));
assert!(!headers.contains_key(header::SET_COOKIE));
- assert!(
- headers
- .get(HeaderName::from_static("set-cookie2"))
- .is_none()
- );
+ assert!(headers
+ .get(HeaderName::from_static("set-cookie2"))
+ .is_none());
}
#[test]
diff --git a/components/net/tests/hsts.rs b/components/net/tests/hsts.rs
index dc227fd472b..044287da159 100644
--- a/components/net/tests/hsts.rs
+++ b/components/net/tests/hsts.rs
@@ -102,14 +102,12 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() {
let mut entries_map = HashMap::new();
entries_map.insert(
"mozilla.org".to_owned(),
- vec![
- HstsEntry::new(
- "mozilla.org".to_owned(),
- IncludeSubdomains::NotIncluded,
- Some(500000u64),
- )
- .unwrap(),
- ],
+ vec![HstsEntry::new(
+ "mozilla.org".to_owned(),
+ IncludeSubdomains::NotIncluded,
+ Some(500000u64),
+ )
+ .unwrap()],
);
let mut list = HstsList {
entries_map: entries_map,
@@ -180,14 +178,12 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() {
let mut entries_map = HashMap::new();
entries_map.insert(
"mozilla.org".to_owned(),
- vec![
- HstsEntry::new(
- "mozilla.org".to_owned(),
- IncludeSubdomains::NotIncluded,
- None,
- )
- .unwrap(),
- ],
+ vec![HstsEntry::new(
+ "mozilla.org".to_owned(),
+ IncludeSubdomains::NotIncluded,
+ None,
+ )
+ .unwrap()],
);
let mut list = HstsList {
entries_map: entries_map,
@@ -286,14 +282,12 @@ fn test_hsts_list_with_exact_domain_entry_is_is_host_secure() {
let mut entries_map = HashMap::new();
entries_map.insert(
"mozilla.org".to_owned(),
- vec![
- HstsEntry::new(
- "mozilla.org".to_owned(),
- IncludeSubdomains::NotIncluded,
- None,
- )
- .unwrap(),
- ],
+ vec![HstsEntry::new(
+ "mozilla.org".to_owned(),
+ IncludeSubdomains::NotIncluded,
+ None,
+ )
+ .unwrap()],
);
let hsts_list = HstsList {
@@ -322,14 +316,12 @@ fn test_hsts_list_with_subdomain_when_include_subdomains_is_false_is_not_is_host
let mut entries_map = HashMap::new();
entries_map.insert(
"mozilla.org".to_owned(),
- vec![
- HstsEntry::new(
- "mozilla.org".to_owned(),
- IncludeSubdomains::NotIncluded,
- None,
- )
- .unwrap(),
- ],
+ vec![HstsEntry::new(
+ "mozilla.org".to_owned(),
+ IncludeSubdomains::NotIncluded,
+ None,
+ )
+ .unwrap()],
);
let hsts_list = HstsList {
entries_map: entries_map,
diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs
index 297d6de7e5a..d68be39d581 100644
--- a/components/net/tests/http_loader.rs
+++ b/components/net/tests/http_loader.rs
@@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cookie_rs::Cookie as CookiePair;
use crate::fetch;
use crate::fetch_with_context;
use crate::make_server;
use crate::new_fetch_context;
+use cookie_rs::Cookie as CookiePair;
use crossbeam_channel::{unbounded, Receiver};
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
@@ -144,15 +144,13 @@ fn test_check_default_headers_loaded_in_every_request() {
..RequestInit::default()
});
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
// Testing for method.POST
let mut post_headers = headers.clone();
@@ -174,15 +172,13 @@ fn test_check_default_headers_loaded_in_every_request() {
..RequestInit::default()
});
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let _ = server.close();
}
@@ -208,15 +204,13 @@ fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length
..RequestInit::default()
});
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let _ = server.close();
}
@@ -245,15 +239,13 @@ fn test_request_and_response_data_with_network_messages() {
});
let (devtools_chan, devtools_port) = unbounded();
let response = fetch(&mut request, Some(devtools_chan));
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let _ = server.close();
@@ -346,15 +338,13 @@ fn test_request_and_response_message_from_devtool_without_pipeline_id() {
});
let (devtools_chan, devtools_port) = unbounded();
let response = fetch(&mut request, Some(devtools_chan));
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let _ = server.close();
@@ -592,15 +582,13 @@ fn test_load_doesnt_add_host_to_sts_list_when_url_is_http_even_if_sts_headers_ar
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
assert_eq!(
context
.state
@@ -641,15 +629,13 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
assert_cookie_for_domain(
&context.state.cookie_jar,
@@ -696,15 +682,13 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -745,15 +729,13 @@ fn test_load_sends_cookie_if_nonhttp() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -785,15 +767,13 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
assert_cookie_for_domain(
&context.state.cookie_jar,
@@ -801,11 +781,9 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
Some("mozillaIs=theBest"),
);
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
- assert!(
- cookie_jar
- .cookies_for_url(&url, CookieSource::NonHTTP)
- .is_none()
- );
+ assert!(cookie_jar
+ .cookies_for_url(&url, CookieSource::NonHTTP)
+ .is_none());
}
#[test]
@@ -837,15 +815,13 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
assert_cookie_for_domain(&context.state.cookie_jar, url.as_str(), None);
}
@@ -876,15 +852,13 @@ fn test_load_sets_content_length_to_length_of_request_body() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -918,15 +892,13 @@ fn test_load_uses_explicit_accept_from_headers_in_load_data() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -957,15 +929,13 @@ fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -999,15 +969,13 @@ fn test_load_uses_explicit_accept_encoding_from_load_data_headers() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -1038,15 +1006,13 @@ fn test_load_sets_default_accept_encoding_to_gzip_and_deflate() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -1374,15 +1340,13 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
let _ = server.close();
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
}
#[test]
@@ -1439,15 +1403,13 @@ fn test_origin_set() {
..RequestInit::default()
});
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let origin_url = ServoUrl::parse("http://example.com").unwrap();
origin =
@@ -1464,15 +1426,13 @@ fn test_origin_set() {
*origin_header_clone.lock().unwrap() = Some(origin.clone());
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
// Test Origin header is not set on method Head
let mut request = Request::from_init(RequestInit {
@@ -1485,15 +1445,13 @@ fn test_origin_set() {
*origin_header_clone.lock().unwrap() = None;
let response = fetch(&mut request, None);
- assert!(
- response
- .internal_response
- .unwrap()
- .status
- .unwrap()
- .0
- .is_success()
- );
+ assert!(response
+ .internal_response
+ .unwrap()
+ .status
+ .unwrap()
+ .0
+ .is_success());
let _ = server.close();
}
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index 7f9efeab6a4..60377851ef4 100644
--- a/components/net_traits/lib.rs
+++ b/components/net_traits/lib.rs
@@ -17,11 +17,11 @@ extern crate serde;
#[macro_use]
extern crate url;
-use cookie::Cookie;
use crate::filemanager_thread::FileManagerThreadMsg;
use crate::request::{Request, RequestInit};
use crate::response::{HttpsState, Response, ResponseInit};
use crate::storage_thread::StorageThreadMsg;
+use cookie::Cookie;
use headers_core::HeaderMapExt;
use headers_ext::{ContentType, ReferrerPolicy as ReferrerPolicyHeader};
use http::{Error as HttpError, HeaderMap};
diff --git a/components/remutex/lib.rs b/components/remutex/lib.rs
index 6431801589d..e019d9cedce 100644
--- a/components/remutex/lib.rs
+++ b/components/remutex/lib.rs
@@ -43,7 +43,7 @@ impl ThreadId {
}
}
-thread_local!{ static THREAD_ID: ThreadId = ThreadId::new() }
+thread_local! { static THREAD_ID: ThreadId = ThreadId::new() }
/// A type for atomic storage of thread ids.
#[derive(Debug)]
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index d3a4f1a443a..58b0a7d20a7 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -47,14 +47,12 @@ pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<E
} else if rval.is_boolean() {
EvaluateJSReply::BooleanValue(rval.to_boolean())
} else if rval.is_double() || rval.is_int32() {
- EvaluateJSReply::NumberValue(match FromJSValConvertible::from_jsval(
- cx,
- rval.handle(),
- (),
- ) {
- Ok(ConversionResult::Success(v)) => v,
- _ => unreachable!(),
- })
+ EvaluateJSReply::NumberValue(
+ match FromJSValConvertible::from_jsval(cx, rval.handle(), ()) {
+ Ok(ConversionResult::Success(v)) => v,
+ _ => unreachable!(),
+ },
+ )
} else if rval.is_string() {
EvaluateJSReply::StringValue(String::from(jsstring_to_str(cx, rval.to_string())))
} else if rval.is_null() {
@@ -242,7 +240,7 @@ pub fn handle_modify_attribute(
return warn!(
"node id {} for pipeline id {} is not found",
&node_id, &pipeline
- )
+ );
},
Some(found_node) => found_node,
};
diff --git a/components/script/dom/analysernode.rs b/components/script/dom/analysernode.rs
index 1b56d5c7dc8..4c2025f8eb4 100644
--- a/components/script/dom/analysernode.rs
+++ b/components/script/dom/analysernode.rs
@@ -108,9 +108,9 @@ impl AnalyserNode {
let this = this.clone();
let _ = source.queue_with_canceller(
task!(append_analysis_block: move || {
- let this = this.root();
- this.push_block(block.to().unwrap())
- }),
+ let this = this.root();
+ this.push_block(block.to().unwrap())
+ }),
&canceller,
);
}),
diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs
index c32ff146215..fbe6b5e34f5 100644
--- a/components/script/dom/audiocontext.rs
+++ b/components/script/dom/audiocontext.rs
@@ -134,20 +134,20 @@ impl AudioContextMethods for AudioContext {
let context = Trusted::new(self);
let _ = task_source.queue(
task!(suspend_ok: move || {
- let base_context = base_context.root();
- let context = context.root();
- let promise = trusted_promise.root();
- promise.resolve_native(&());
- if base_context.State() != AudioContextState::Suspended {
- base_context.set_state_attribute(AudioContextState::Suspended);
- let window = DomRoot::downcast::<Window>(context.global()).unwrap();
- window.task_manager().dom_manipulation_task_source().queue_simple_event(
- context.upcast(),
- atom!("statechange"),
- &window
- );
- }
- }),
+ let base_context = base_context.root();
+ let context = context.root();
+ let promise = trusted_promise.root();
+ promise.resolve_native(&());
+ if base_context.State() != AudioContextState::Suspended {
+ base_context.set_state_attribute(AudioContextState::Suspended);
+ let window = DomRoot::downcast::<Window>(context.global()).unwrap();
+ window.task_manager().dom_manipulation_task_source().queue_simple_event(
+ context.upcast(),
+ atom!("statechange"),
+ &window
+ );
+ }
+ }),
window.upcast(),
);
},
@@ -156,9 +156,9 @@ impl AudioContextMethods for AudioContext {
// never fail, but we handle the case here for completion.
let _ = task_source.queue(
task!(suspend_error: move || {
- let promise = trusted_promise.root();
- promise.reject_error(Error::Type("Something went wrong".to_owned()));
- }),
+ let promise = trusted_promise.root();
+ promise.reject_error(Error::Type("Something went wrong".to_owned()));
+ }),
window.upcast(),
);
},
@@ -196,20 +196,20 @@ impl AudioContextMethods for AudioContext {
let context = Trusted::new(self);
let _ = task_source.queue(
task!(suspend_ok: move || {
- let base_context = base_context.root();
- let context = context.root();
- let promise = trusted_promise.root();
- promise.resolve_native(&());
- if base_context.State() != AudioContextState::Closed {
- base_context.set_state_attribute(AudioContextState::Closed);
- let window = DomRoot::downcast::<Window>(context.global()).unwrap();
- window.task_manager().dom_manipulation_task_source().queue_simple_event(
- context.upcast(),
- atom!("statechange"),
- &window
- );
- }
- }),
+ let base_context = base_context.root();
+ let context = context.root();
+ let promise = trusted_promise.root();
+ promise.resolve_native(&());
+ if base_context.State() != AudioContextState::Closed {
+ base_context.set_state_attribute(AudioContextState::Closed);
+ let window = DomRoot::downcast::<Window>(context.global()).unwrap();
+ window.task_manager().dom_manipulation_task_source().queue_simple_event(
+ context.upcast(),
+ atom!("statechange"),
+ &window
+ );
+ }
+ }),
window.upcast(),
);
},
@@ -218,9 +218,9 @@ impl AudioContextMethods for AudioContext {
// never fail, but we handle the case here for completion.
let _ = task_source.queue(
task!(suspend_error: move || {
- let promise = trusted_promise.root();
- promise.reject_error(Error::Type("Something went wrong".to_owned()));
- }),
+ let promise = trusted_promise.root();
+ promise.reject_error(Error::Type("Something went wrong".to_owned()));
+ }),
window.upcast(),
);
},
diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs
index 0b5aa7d8649..2417de5435c 100644
--- a/components/script/dom/baseaudiocontext.rs
+++ b/components/script/dom/baseaudiocontext.rs
@@ -244,8 +244,8 @@ impl BaseAudioContext {
)));
let _ = task_source.queue(
task!(resume_error: move || {
- this.root().fulfill_in_flight_resume_promises(|| {})
- }),
+ this.root().fulfill_in_flight_resume_promises(|| {})
+ }),
window.upcast(),
);
},
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index 2e784ec5be8..6153f167df5 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -5,8 +5,6 @@
//! Utilities to throw exceptions from Rust bindings.
#[cfg(feature = "js_backtrace")]
-use backtrace::Backtrace;
-#[cfg(feature = "js_backtrace")]
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name;
@@ -17,6 +15,8 @@ use crate::dom::bindings::conversions::{
use crate::dom::bindings::str::USVString;
use crate::dom::domexception::{DOMErrorName, DOMException};
use crate::dom::globalscope::GlobalScope;
+#[cfg(feature = "js_backtrace")]
+use backtrace::Backtrace;
use js::error::{throw_range_error, throw_type_error};
use js::jsapi::JSContext;
use js::jsapi::JS_ClearPendingException;
diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs
index 99ca45b44a6..5654b52938b 100644
--- a/components/script/dom/bindings/htmlconstructor.rs
+++ b/components/script/dom/bindings/htmlconstructor.rs
@@ -105,7 +105,7 @@ where
None => {
return Err(Error::Type(
"No custom element definition found for new.target".to_owned(),
- ))
+ ));
},
};
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 3142f011c9b..dfeedc636d6 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -734,10 +734,10 @@ fn parse_floating_point_number(input: &str) -> Result<f64, ()> {
match input.trim().parse::<f64>() {
Ok(val)
if !(
- // A valid number is the same as what rust considers to be valid,
- // except for +1., NaN, and Infinity.
- val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
- ) =>
+ // A valid number is the same as what rust considers to be valid,
+ // except for +1., NaN, and Infinity.
+ val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
+ ) =>
{
// TODO(#19773): need consider `min`, `max`, `step`, when they are implemented
Ok(val.round())
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index ae1a9e6e3b4..ee8e93e03ac 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -29,16 +29,6 @@
//! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of
//! `JSTraceable` to a datatype.
-use app_units::Au;
-use canvas_traits::canvas::{
- CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
-};
-use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
-use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
-use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
-use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
-use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
-use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
@@ -50,6 +40,16 @@ use crate::dom::document::PendingRestyle;
use crate::dom::htmlimageelement::SourceSet;
use crate::dom::htmlmediaelement::MediaFrameRenderer;
use crate::task::TaskBox;
+use app_units::Au;
+use canvas_traits::canvas::{
+ CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
+};
+use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
+use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
+use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
+use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
+use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
+use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
use crossbeam_channel::{Receiver, Sender};
use cssparser::RGBA;
use devtools_traits::{CSSError, TimelineMarkerType, WorkerId};
@@ -769,8 +769,10 @@ struct RootedTraceableSet {
set: Vec<*const dyn JSTraceable>,
}
-thread_local!(/// TLV Holds a set of JSTraceables that need to be rooted
-static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new()););
+thread_local!(
+ /// TLV Holds a set of JSTraceables that need to be rooted
+ static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new());
+);
impl RootedTraceableSet {
fn new() -> RootedTraceableSet {
diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs
index 9cdcb000f86..ab1fe30c8a5 100644
--- a/components/script/dom/bindings/xmlname.rs
+++ b/components/script/dom/bindings/xmlname.rs
@@ -116,12 +116,16 @@ pub fn xml_name_type(name: &str) -> XMLName {
}
fn is_valid_continuation(c: char) -> bool {
- is_valid_start(c) || match c {
- '-' | '.' | '0'...'9' | '\u{B7}' | '\u{300}'...'\u{36F}' | '\u{203F}'...'\u{2040}' => {
- true
- },
- _ => false,
- }
+ is_valid_start(c) ||
+ match c {
+ '-' |
+ '.' |
+ '0'...'9' |
+ '\u{B7}' |
+ '\u{300}'...'\u{36F}' |
+ '\u{203F}'...'\u{2040}' => true,
+ _ => false,
+ }
}
let mut iter = name.chars();
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index 44169dd0e55..0e96e8488b5 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -426,7 +426,7 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible<Bluetooth
let manufacturer_id = match u16::from_str(key.as_ref()) {
Ok(id) => id,
Err(err) => {
- return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)))
+ return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)));
},
};
diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs
index 9b61871a972..10d351232bc 100644
--- a/components/script/dom/bluetoothdevice.rs
+++ b/components/script/dom/bluetoothdevice.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
@@ -23,6 +21,8 @@ use crate::dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
+use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;
diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs
index 0d2a9478290..1051ecebb8e 100644
--- a/components/script/dom/bluetoothpermissionresult.rs
+++ b/components/script/dom/bluetoothpermissionresult.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{
self, BluetoothPermissionResultMethods,
@@ -22,6 +21,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::globalscope::GlobalScope;
use crate::dom::permissionstatus::PermissionStatus;
use crate::dom::promise::Promise;
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs
index a3699437efb..6c2e1f012d3 100644
--- a/components/script/dom/bluetoothremotegattcharacteristic.rs
+++ b/components/script/dom/bluetoothremotegattcharacteristic.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding;
@@ -25,6 +23,8 @@ use crate::dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
+use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;
diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs
index f4c56a6f668..83482a77c90 100644
--- a/components/script/dom/bluetoothremotegattdescriptor.rs
+++ b/components/script/dom/bluetoothremotegattdescriptor.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding;
@@ -21,6 +19,8 @@ use crate::dom::bluetoothremotegattcharacteristic::{
};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
+use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;
diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs
index 40c801faf60..c0ebeef0955 100644
--- a/components/script/dom/bluetoothremotegattserver.rs
+++ b/components/script/dom/bluetoothremotegattserver.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
@@ -15,6 +14,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::cell::Cell;
diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs
index dcc2c4fd946..adcf30c7645 100644
--- a/components/script/dom/bluetoothremotegattservice.rs
+++ b/components/script/dom/bluetoothremotegattservice.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::{BluetoothResponse, GATTType};
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
@@ -16,6 +15,7 @@ use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUI
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
+use bluetooth_traits::{BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use std::rc::Rc;
diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs
index 5a1e787f72e..f24106d81c2 100644
--- a/components/script/dom/canvasgradient.rs
+++ b/components/script/dom/canvasgradient.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/. */
-use canvas_traits::canvas::{
- CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
-};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding;
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
@@ -14,6 +11,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
+use canvas_traits::canvas::{
+ CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
+};
use cssparser::Color as CSSColor;
use cssparser::{Parser, ParserInput, RGBA};
use dom_struct::dom_struct;
diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs
index e844be5a702..a60a92988ac 100644
--- a/components/script/dom/canvaspattern.rs
+++ b/components/script/dom/canvaspattern.rs
@@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
use crate::dom::bindings::codegen::Bindings::CanvasPatternBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
use crate::dom::globalscope::GlobalScope;
+use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
use dom_struct::dom_struct;
use euclid::Size2D;
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index a50cce88870..f21c7bfda1c 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
-use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
-use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
-use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
@@ -29,6 +25,10 @@ use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement};
use crate::dom::imagedata::ImageData;
use crate::dom::node::{window_from_node, Node, NodeDamage};
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
+use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
+use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
+use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
+use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
use cssparser::Color as CSSColor;
use cssparser::{Parser, ParserInput, RGBA};
use dom_struct::dom_struct;
diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs
index faad37a6f7e..8fe88ba8f94 100644
--- a/components/script/dom/customelementregistry.rs
+++ b/components/script/dom/customelementregistry.rs
@@ -522,7 +522,7 @@ impl CustomElementDefinition {
Ok(ConversionResult::Failure(..)) => {
return Err(Error::Type(
"Constructor did not return a DOM node".to_owned(),
- ))
+ ));
},
_ => return Err(Error::JSFailed),
};
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index d679ff0dd3f..48e43f80590 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cookie::Cookie;
use crate::document_loader::{DocumentLoader, LoadType};
use crate::dom::activation::{synthetic_click_activation, ActivationSource};
use crate::dom::attr::Attr;
@@ -104,6 +103,7 @@ use crate::script_thread::{MainThreadScriptMsg, ScriptThread};
use crate::task::TaskBox;
use crate::task_source::{TaskSource, TaskSourceName};
use crate::timers::OneshotTimerCallback;
+use cookie::Cookie;
use devtools_traits::ScriptToDevtoolsControlMsg;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
@@ -542,30 +542,30 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_pageshow_event: move || {
- let document = document.root();
- let window = document.window();
- // Step 4.6.1
- if document.page_showing.get() {
- return;
- }
- // Step 4.6.2
- document.page_showing.set(true);
- // Step 4.6.4
- let event = PageTransitionEvent::new(
- window,
- atom!("pageshow"),
- false, // bubbles
- false, // cancelable
- true, // persisted
- );
- let event = event.upcast::<Event>();
- event.set_trusted(true);
- // FIXME(nox): Why are errors silenced here?
- let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
- document.upcast(),
- &event,
- );
- }),
+ let document = document.root();
+ let window = document.window();
+ // Step 4.6.1
+ if document.page_showing.get() {
+ return;
+ }
+ // Step 4.6.2
+ document.page_showing.set(true);
+ // Step 4.6.4
+ let event = PageTransitionEvent::new(
+ window,
+ atom!("pageshow"),
+ false, // bubbles
+ false, // cancelable
+ true, // persisted
+ );
+ let event = event.upcast::<Event>();
+ event.set_trusted(true);
+ // FIXME(nox): Why are errors silenced here?
+ let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
+ document.upcast(),
+ &event,
+ );
+ }),
self.window.upcast(),
)
.unwrap();
@@ -615,11 +615,12 @@ impl Document {
// FIXME: This should check the dirty bit on the document,
// not the document element. Needs some layout changes to make
// that workable.
- self.stylesheets.borrow().has_changed() || self.GetDocumentElement().map_or(false, |root| {
- root.upcast::<Node>().has_dirty_descendants() ||
- !self.pending_restyles.borrow().is_empty() ||
- self.needs_paint()
- })
+ self.stylesheets.borrow().has_changed() ||
+ self.GetDocumentElement().map_or(false, |root| {
+ root.upcast::<Node>().has_dirty_descendants() ||
+ !self.pending_restyles.borrow().is_empty() ||
+ self.needs_paint()
+ })
}
/// Returns the first `base` element in the DOM that has an `href` attribute.
@@ -1940,46 +1941,46 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_load_event: move || {
- let document = document.root();
- let window = document.window();
- if !window.is_alive() {
- return;
- }
+ let document = document.root();
+ let window = document.window();
+ if !window.is_alive() {
+ return;
+ }
- // Step 7.1.
- document.set_ready_state(DocumentReadyState::Complete);
+ // Step 7.1.
+ document.set_ready_state(DocumentReadyState::Complete);
- // Step 7.2.
- if document.browsing_context().is_none() {
- return;
- }
- let event = Event::new(
- window.upcast(),
- atom!("load"),
- EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable,
- );
- event.set_trusted(true);
+ // Step 7.2.
+ if document.browsing_context().is_none() {
+ return;
+ }
+ let event = Event::new(
+ window.upcast(),
+ atom!("load"),
+ EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable,
+ );
+ event.set_trusted(true);
- // http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
- update_with_current_time_ms(&document.load_event_start);
+ // http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
+ update_with_current_time_ms(&document.load_event_start);
- debug!("About to dispatch load for {:?}", document.url());
- // FIXME(nox): Why are errors silenced here?
- let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
- document.upcast(),
- &event,
- );
+ debug!("About to dispatch load for {:?}", document.url());
+ // FIXME(nox): Why are errors silenced here?
+ let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
+ document.upcast(),
+ &event,
+ );
- // http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
- update_with_current_time_ms(&document.load_event_end);
+ // http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
+ update_with_current_time_ms(&document.load_event_end);
- window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
+ window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
- if let Some(fragment) = document.url().fragment() {
- document.check_and_scroll_fragment(fragment);
- }
- }),
+ if let Some(fragment) = document.url().fragment() {
+ document.check_and_scroll_fragment(fragment);
+ }
+ }),
self.window.upcast(),
)
.unwrap();
@@ -1992,30 +1993,30 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_pageshow_event: move || {
- let document = document.root();
- let window = document.window();
- if document.page_showing.get() || !window.is_alive() {
- return;
- }
+ let document = document.root();
+ let window = document.window();
+ if document.page_showing.get() || !window.is_alive() {
+ return;
+ }
- document.page_showing.set(true);
+ document.page_showing.set(true);
- let event = PageTransitionEvent::new(
- window,
- atom!("pageshow"),
- false, // bubbles
- false, // cancelable
- false, // persisted
- );
- let event = event.upcast::<Event>();
- event.set_trusted(true);
+ let event = PageTransitionEvent::new(
+ window,
+ atom!("pageshow"),
+ false, // bubbles
+ false, // cancelable
+ false, // persisted
+ );
+ let event = event.upcast::<Event>();
+ event.set_trusted(true);
- // FIXME(nox): Why are errors silenced here?
- let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
- document.upcast(),
- &event,
- );
- }),
+ // FIXME(nox): Why are errors silenced here?
+ let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
+ document.upcast(),
+ &event,
+ );
+ }),
self.window.upcast(),
)
.unwrap();
@@ -2040,12 +2041,12 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(completely_loaded: move || {
- let document = document.root();
- document.completely_loaded.set(true);
- // Note: this will, among others, result in the "iframe-load-event-steps" being run.
- // https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
- document.notify_constellation_load();
- }),
+ let document = document.root();
+ document.completely_loaded.set(true);
+ // Note: this will, among others, result in the "iframe-load-event-steps" being run.
+ // https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
+ document.notify_constellation_load();
+ }),
self.window.upcast(),
)
.unwrap();
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 54c1b553beb..34ab0b4ffdb 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -1532,11 +1532,9 @@ impl Element {
pub fn get_int_attribute(&self, local_name: &LocalName, default: i32) -> i32 {
// TODO: Is this assert necessary?
- assert!(
- local_name
- .chars()
- .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
- );
+ assert!(local_name
+ .chars()
+ .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(), local_name);
match attribute {
@@ -1557,11 +1555,9 @@ impl Element {
}
pub fn get_uint_attribute(&self, local_name: &LocalName, default: u32) -> u32 {
- assert!(
- local_name
- .chars()
- .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
- );
+ assert!(local_name
+ .chars()
+ .all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(), local_name);
match attribute {
Some(ref attribute) => match *attribute.value() {
@@ -2840,10 +2836,11 @@ impl<'a> SelectorsElement for DomRoot<Element> {
fn is_empty(&self) -> bool {
self.node.children().all(|node| {
- !node.is::<Element>() && match node.downcast::<Text>() {
- None => true,
- Some(text) => text.upcast::<CharacterData>().data().is_empty(),
- }
+ !node.is::<Element>() &&
+ match node.downcast::<Text>() {
+ None => true,
+ Some(text) => text.upcast::<CharacterData>().data().is_empty(),
+ }
})
}
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index 43192587934..6092dcc9935 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use base64;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{
@@ -25,6 +24,7 @@ use crate::dom::progressevent::ProgressEvent;
use crate::task::TaskCanceller;
use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
use crate::task_source::{TaskSource, TaskSourceName};
+use base64;
use dom_struct::dom_struct;
use encoding_rs::{Encoding, UTF_8};
use js::jsapi::Heap;
diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs
index 2e7081cf8ba..82f479b0b80 100644
--- a/components/script/dom/filereadersync.rs
+++ b/components/script/dom/filereadersync.rs
@@ -97,14 +97,12 @@ impl FileReaderSyncMethods for FileReaderSync {
// step 2
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
- assert!(
- ArrayBuffer::create(
- cx,
- CreateWith::Slice(&blob_contents),
- array_buffer.handle_mut()
- )
- .is_ok()
- );
+ assert!(ArrayBuffer::create(
+ cx,
+ CreateWith::Slice(&blob_contents),
+ array_buffer.handle_mut()
+ )
+ .is_ok());
Ok(NonNull::new_unchecked(array_buffer.get()))
}
diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs
index e9a2ccc6eb9..98b24dd1979 100644
--- a/components/script/dom/headers.rs
+++ b/components/script/dom/headers.rs
@@ -367,9 +367,10 @@ pub fn is_forbidden_header_name(name: &str) -> bool {
let disallowed_header_prefixes = ["sec-", "proxy-"];
- disallowed_headers.iter().any(|header| *header == name) || disallowed_header_prefixes
- .iter()
- .any(|prefix| name.starts_with(prefix))
+ disallowed_headers.iter().any(|header| *header == name) ||
+ disallowed_header_prefixes
+ .iter()
+ .any(|prefix| name.starts_with(prefix))
}
// There is some unresolved confusion over the definition of a name and a value.
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index 34f056f3141..e024fb6a00a 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -413,8 +413,8 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
Some(ref url)
if url.host().is_none() || url.cannot_be_a_base() || url.scheme() == "file" =>
{
- return
- },
+ return;
+ }
None => return,
// Step 4.
Some(url) => {
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index 666df0eefed..951643c7ea7 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -61,9 +61,10 @@ impl HTMLBodyElement {
let self_node = self.upcast::<Node>();
let root_elem = self.upcast::<Element>().root_element();
let root_node = root_elem.upcast::<Node>();
- root_node.is_parent_of(self_node) && self_node
- .preceding_siblings()
- .all(|n| !n.is::<HTMLBodyElement>())
+ root_node.is_parent_of(self_node) &&
+ self_node
+ .preceding_siblings()
+ .all(|n| !n.is::<HTMLBodyElement>())
}
}
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 1dbb0806728..f0f3f446157 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.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/. */
-use base64;
-use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
@@ -31,6 +28,9 @@ use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
use crate::dom::webglrenderingcontext::{
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
};
+use base64;
+use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
use euclid::{Rect, Size2D};
use html5ever::{LocalName, Prefix};
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 2bde8893a29..f9e249ca85a 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -628,20 +628,20 @@ impl VirtualMethods for HTMLIFrameElement {
let iframe = Trusted::new(self);
document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || {
- let this = iframe.root();
- // https://html.spec.whatwg.org/multipage/#the-iframe-element
- // "When an iframe element is inserted into a document that has
- // a browsing context, the user agent must create a new
- // browsing context, set the element's nested browsing context
- // to the newly-created browsing context, and then process the
- // iframe attributes for the "first time"."
- if this.upcast::<Node>().is_in_doc_with_browsing_context() {
- debug!("iframe bound to browsing context.");
- debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
- this.create_nested_browsing_context();
- this.process_the_iframe_attributes(ProcessingMode::FirstTime);
- }
- }));
+ let this = iframe.root();
+ // https://html.spec.whatwg.org/multipage/#the-iframe-element
+ // "When an iframe element is inserted into a document that has
+ // a browsing context, the user agent must create a new
+ // browsing context, set the element's nested browsing context
+ // to the newly-created browsing context, and then process the
+ // iframe attributes for the "first time"."
+ if this.upcast::<Node>().is_in_doc_with_browsing_context() {
+ debug!("iframe bound to browsing context.");
+ debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
+ this.create_nested_browsing_context();
+ this.process_the_iframe_attributes(ProcessingMode::FirstTime);
+ }
+ }));
}
fn unbind_from_tree(&self, context: &UnbindContext) {
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 944703de9e7..cf6466b1f27 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::{Au, AU_PER_PX};
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
@@ -43,6 +42,7 @@ use crate::microtask::{Microtask, MicrotaskRunnable};
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
+use app_units::{Au, AU_PER_PX};
use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
@@ -286,12 +286,12 @@ impl HTMLImageElement {
// FIXME(nox): Why are errors silenced here?
let _ = task_source.queue_with_canceller(
task!(process_image_response: move || {
- let element = element.root();
- // Ignore any image response for a previous request that has been discarded.
- if generation == element.generation.get() {
- element.process_image_response(image);
- }
- }),
+ let element = element.root();
+ // Ignore any image response for a previous request that has been discarded.
+ if generation == element.generation.get() {
+ element.process_image_response(image);
+ }
+ }),
&canceller,
);
}),
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 63543652594..4541c38038e 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use caseless::compatibility_caseless_match_str;
use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource};
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@@ -47,6 +46,7 @@ use crate::textinput::KeyReaction::{
};
use crate::textinput::Lines::Single;
use crate::textinput::{Direction, SelectionDirection, TextInput};
+use caseless::compatibility_caseless_match_str;
use dom_struct::dom_struct;
use embedder_traits::FilterPattern;
use html5ever::{LocalName, Prefix};
@@ -946,7 +946,7 @@ impl HTMLInputElement {
match self.input_type() {
// Step 3.1: it's a button but it is not submitter.
InputType::Submit | InputType::Button | InputType::Reset if !is_submitter => {
- return vec![]
+ return vec![];
},
// Step 3.1: it's the "Checkbox" or "Radio Button" and whose checkedness is false.
@@ -1769,21 +1769,22 @@ impl Activatable for HTMLInputElement {
.unwrap()
.filter_map(DomRoot::downcast::<HTMLInputElement>)
.filter(|input| {
- input.form_owner() == owner && match input.input_type() {
- InputType::Text |
- InputType::Search |
- InputType::Url |
- InputType::Tel |
- InputType::Email |
- InputType::Password |
- InputType::Date |
- InputType::Month |
- InputType::Week |
- InputType::Time |
- InputType::DatetimeLocal |
- InputType::Number => true,
- _ => false,
- }
+ input.form_owner() == owner &&
+ match input.input_type() {
+ InputType::Text |
+ InputType::Search |
+ InputType::Url |
+ InputType::Tel |
+ InputType::Email |
+ InputType::Password |
+ InputType::Date |
+ InputType::Month |
+ InputType::Week |
+ InputType::Time |
+ InputType::DatetimeLocal |
+ InputType::Number => true,
+ _ => false,
+ }
});
if inputs.skip(1).next().is_some() {
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 2bde1cf4062..62a24fffede 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -367,15 +367,15 @@ impl HTMLMediaElement {
task_source
.queue(
task!(resolve_pending_play_promises: move || {
- let this = this.root();
- if generation_id != this.generation_id.get() {
- return;
- }
+ let this = this.root();
+ if generation_id != this.generation_id.get() {
+ return;
+ }
- this.fulfill_in_flight_play_promises(|| {
- this.play_media();
- });
- }),
+ this.fulfill_in_flight_play_promises(|| {
+ this.play_media();
+ });
+ }),
window.upcast(),
)
.unwrap();
@@ -820,8 +820,8 @@ impl HTMLMediaElement {
.media_element_task_source()
.queue(
task!(set_media_delay_load_event_flag_to_false: move || {
- this.root().delay_load_event(false);
- }),
+ this.root().delay_load_event(false);
+ }),
window.upcast(),
)
.unwrap();
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 1e827331e53..8aa536c15eb 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -779,8 +779,8 @@ impl VirtualMethods for HTMLScriptElement {
if tree_in_doc && !self.parser_inserted.get() {
let script = Trusted::new(self);
document_from_node(self).add_delayed_task(task!(ScriptDelayedInitialize: move || {
- script.root().prepare();
- }));
+ script.root().prepare();
+ }));
}
}
@@ -822,9 +822,9 @@ impl HTMLScriptElementMethods for HTMLScriptElement {
// https://html.spec.whatwg.org/multipage/#dom-script-async
fn Async(&self) -> bool {
- self.non_blocking.get() || self
- .upcast::<Element>()
- .has_attribute(&local_name!("async"))
+ self.non_blocking.get() ||
+ self.upcast::<Element>()
+ .has_attribute(&local_name!("async"))
}
// https://html.spec.whatwg.org/multipage/#dom-script-async
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index d07f8d315cb..98a0b8226cd 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -44,10 +44,10 @@ struct TableRowFilter {
impl CollectionFilter for TableRowFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
elem.is::<HTMLTableRowElement>() &&
- (root.is_parent_of(elem.upcast()) || self
- .sections
- .iter()
- .any(|ref section| section.is_parent_of(elem.upcast())))
+ (root.is_parent_of(elem.upcast()) ||
+ self.sections
+ .iter()
+ .any(|ref section| section.is_parent_of(elem.upcast())))
}
}
@@ -327,7 +327,8 @@ impl HTMLTableElementMethods for HTMLTableElement {
.filter_map(DomRoot::downcast::<Element>)
.find(|n| {
n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")
- }) {
+ })
+ {
last_tbody
.upcast::<Node>()
.AppendChild(new_row.upcast::<Node>())
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index ff6374a8b99..77b7d66cf2d 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -4,7 +4,6 @@
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
-use app_units::Au;
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
@@ -55,6 +54,7 @@ use crate::dom::text::Text;
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
use crate::dom::window::Window;
use crate::script_thread::ScriptThread;
+use app_units::Au;
use devtools_traits::NodeInfo;
use dom_struct::dom_struct;
use euclid::{Point2D, Rect, Size2D, Vector2D};
@@ -1850,10 +1850,9 @@ impl Node {
// https://dom.spec.whatwg.org/#concept-node-remove
fn remove(node: &Node, parent: &Node, suppress_observers: SuppressObserver) {
parent.owner_doc().add_script_and_layout_blocker();
- assert!(
- node.GetParentNode()
- .map_or(false, |node_parent| &*node_parent == parent)
- );
+ assert!(node
+ .GetParentNode()
+ .map_or(false, |node_parent| &*node_parent == parent));
let cached_index = {
if parent.ranges.is_empty() {
None
@@ -2242,10 +2241,10 @@ impl NodeMethods for Node {
// Step 4-5.
match node.type_id() {
NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is::<Document>() => {
- return Err(Error::HierarchyRequest)
+ return Err(Error::HierarchyRequest);
},
NodeTypeId::DocumentType if !self.is::<Document>() => {
- return Err(Error::HierarchyRequest)
+ return Err(Error::HierarchyRequest);
},
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
_ => (),
@@ -2462,14 +2461,14 @@ impl NodeMethods for Node {
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)
if !is_equal_processinginstruction(this, node) =>
{
- return false
- },
+ return false;
+ }
NodeTypeId::CharacterData(CharacterDataTypeId::Text) |
NodeTypeId::CharacterData(CharacterDataTypeId::Comment)
if !is_equal_characterdata(this, node) =>
{
- return false
- },
+ return false;
+ }
// Step 4.
NodeTypeId::Element(..) if !is_equal_element_attrs(this, node) => return false,
_ => (),
diff --git a/components/script/dom/paintrenderingcontext2d.rs b/components/script/dom/paintrenderingcontext2d.rs
index 3b6fdabcb16..9454cc36c93 100644
--- a/components/script/dom/paintrenderingcontext2d.rs
+++ b/components/script/dom/paintrenderingcontext2d.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/. */
-use canvas_traits::canvas::CanvasImageData;
-use canvas_traits::canvas::CanvasMsg;
-use canvas_traits::canvas::FromLayoutMsg;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
@@ -25,6 +22,9 @@ use crate::dom::canvaspattern::CanvasPattern;
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use crate::dom::workletglobalscope::WorkletGlobalScope;
+use canvas_traits::canvas::CanvasImageData;
+use canvas_traits::canvas::CanvasMsg;
+use canvas_traits::canvas::FromLayoutMsg;
use dom_struct::dom_struct;
use euclid::Size2D;
use euclid::TypedScale;
diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs
index 857dbe569b6..852fc45424d 100644
--- a/components/script/dom/performance.rs
+++ b/components/script/dom/performance.rs
@@ -72,9 +72,10 @@ impl PerformanceEntryList {
.entries
.iter()
.filter(|e| {
- name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
- .as_ref()
- .map_or(true, |type_| *e.entry_type() == *type_)
+ name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
+ entry_type
+ .as_ref()
+ .map_or(true, |type_| *e.entry_type() == *type_)
})
.map(|e| e.clone())
.collect::<Vec<DomRoot<PerformanceEntry>>>();
@@ -92,9 +93,10 @@ impl PerformanceEntryList {
entry_type: Option<DOMString>,
) {
self.entries.retain(|e| {
- name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
- .as_ref()
- .map_or(true, |type_| *e.entry_type() == *type_)
+ name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
+ entry_type
+ .as_ref()
+ .map_or(true, |type_| *e.entry_type() == *type_)
});
}
diff --git a/components/script/dom/promiserejectionevent.rs b/components/script/dom/promiserejectionevent.rs
index f5fc47e1054..c224d8f77e8 100644
--- a/components/script/dom/promiserejectionevent.rs
+++ b/components/script/dom/promiserejectionevent.rs
@@ -76,7 +76,7 @@ impl PromiseRejectionEvent {
None => {
return Err(Error::Type(
"required member promise is undefined.".to_string(),
- ))
+ ));
},
};
let bubbles = EventBubbles::from(init.parent.bubbles);
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index 74dc526c57f..e30c5601cf7 100644
--- a/components/script/dom/range.rs
+++ b/components/script/dom/range.rs
@@ -758,11 +758,12 @@ impl RangeMethods for Range {
let new_offset = reference_node.r().map_or(parent.len(), |node| node.index());
// Step 11
- let new_offset = new_offset + if node.type_id() == NodeTypeId::DocumentFragment {
- node.len()
- } else {
- 1
- };
+ let new_offset = new_offset +
+ if node.type_id() == NodeTypeId::DocumentFragment {
+ node.len()
+ } else {
+ 1
+ };
// Step 12.
Node::pre_insert(node, &parent, reference_node.r())?;
@@ -874,7 +875,7 @@ impl RangeMethods for Range {
// Step 2.
match new_parent.type_id() {
NodeTypeId::Document(_) | NodeTypeId::DocumentType | NodeTypeId::DocumentFragment => {
- return Err(Error::InvalidNodeType)
+ return Err(Error::InvalidNodeType);
},
_ => (),
}
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index 438c49a6407..4a7ae2482a4 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -379,12 +379,12 @@ impl Request {
HttpMethod::GET => {
return Err(Error::Type(
"Init's body is non-null, and request method is GET".to_string(),
- ))
+ ));
},
HttpMethod::HEAD => {
return Err(Error::Type(
"Init's body is non-null, and request method is HEAD".to_string(),
- ))
+ ));
},
_ => {},
}
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 7c52934386a..74624ba45b4 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -213,21 +213,21 @@ impl Storage {
.dom_manipulation_task_source()
.queue(
task!(send_storage_notification: move || {
- let this = this.root();
- let global = this.global();
- let event = StorageEvent::new(
- global.as_window(),
- atom!("storage"),
- EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable,
- key.map(DOMString::from),
- old_value.map(DOMString::from),
- new_value.map(DOMString::from),
- DOMString::from(url.into_string()),
- Some(&this),
- );
- event.upcast::<Event>().fire(global.upcast());
- }),
+ let this = this.root();
+ let global = this.global();
+ let event = StorageEvent::new(
+ global.as_window(),
+ atom!("storage"),
+ EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable,
+ key.map(DOMString::from),
+ old_value.map(DOMString::from),
+ new_value.map(DOMString::from),
+ DOMString::from(url.into_string()),
+ Some(&this),
+ );
+ event.upcast::<Event>().fire(global.upcast());
+ }),
global.upcast(),
)
.unwrap();
diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs
index 74c1e04537e..69c993a1423 100644
--- a/components/script/dom/testrunner.rs
+++ b/components/script/dom/testrunner.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use bluetooth_traits::BluetoothRequest;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
@@ -10,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
+use bluetooth_traits::BluetoothRequest;
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index 3fde3c70090..af5437b2516 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -189,8 +189,8 @@ impl TreeWalkerMethods for TreeWalker {
// This can happen if the user set the current node to somewhere
// outside of the tree rooted at the original root.
{
- return Ok(None)
- },
+ return Ok(None);
+ }
Some(n) => node = n,
}
// "5. Filter node and if the return value is FILTER_ACCEPT, then
@@ -321,8 +321,8 @@ impl TreeWalker {
Some(ref parent)
if self.is_root_node(&parent) || self.is_current_node(&parent) =>
{
- return Ok(None)
- },
+ return Ok(None);
+ }
// "5. Otherwise, set node to parent."
Some(parent) => node = parent,
}
diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs
index 4864e7ae4a1..f41dee046be 100755
--- a/components/script/dom/validitystate.rs
+++ b/components/script/dom/validitystate.rs
@@ -27,7 +27,7 @@ pub enum ValidityStatus {
Valid,
}
-bitflags!{
+bitflags! {
pub struct ValidationFlags: u32 {
const VALUE_MISSING = 0b0000000001;
const TYPE_MISMATCH = 0b0000000010;
diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs
index 9785106c252..c02d5439be8 100644
--- a/components/script/dom/vrdisplay.rs
+++ b/components/script/dom/vrdisplay.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceBinding::PerformanceMethods;
@@ -33,6 +32,7 @@ use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::script_runtime::CommonScriptMsg;
use crate::script_runtime::ScriptThreadEventCategory::WebVREvent;
use crate::task_source::TaskSourceName;
+use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crossbeam_channel::{unbounded, Sender};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
@@ -551,8 +551,8 @@ impl VRDisplay {
let this = address.clone();
let sender = raf_sender.clone();
let task = Box::new(task!(handle_vrdisplay_raf: move || {
- this.root().handle_raf(&sender);
- }));
+ this.root().handle_raf(&sender);
+ }));
// NOTE: WebVR spec doesn't specify what task source we should use. Is
// dom-manipulation a good choice long term?
js_sender
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index 658df0adc85..2196ae4f693 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
@@ -31,6 +29,8 @@ use crate::dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat;
use crate::dom::webgltexture::WebGLTexture;
use crate::dom::webgluniformlocation::WebGLUniformLocation;
use crate::dom::window::Window;
+/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
use euclid::Size2D;
use js::jsapi::{JSContext, JSObject};
diff --git a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
index 9b0fca691f7..ddea5daa043 100644
--- a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
+++ b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
@@ -3,13 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/extblendminmax.rs b/components/script/dom/webgl_extensions/ext/extblendminmax.rs
index 835be6ff540..149ef10b2dc 100644
--- a/components/script/dom/webgl_extensions/ext/extblendminmax.rs
+++ b/components/script/dom/webgl_extensions/ext/extblendminmax.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
index a3dbf6f53a9..2785fcac2d1 100644
--- a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
+++ b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
index c0e363ebcd5..33ea2aa67b8 100644
--- a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
+++ b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
index 3d708f4191f..b8d987c2839 100644
--- a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
+++ b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
index ecb90afd371..3182ed8699f 100644
--- a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
+++ b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESElementIndexUintBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
index 1da30688f67..5505deb543a 100644
--- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
+++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding;
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
index f9c56be9e8c..a0ddf13d987 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
@@ -5,11 +5,11 @@
use super::{
constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESTextureFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs
index 0418c6756fd..4db4e1a54b2 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs
@@ -5,13 +5,13 @@
use super::{
constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::{
self, OESTextureHalfFloatConstants,
};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
index 56b75e7b0d2..d4f2dda95cb 100644
--- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
+++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{
self, OESVertexArrayObjectMethods,
@@ -12,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
index 06affa08fd5..0ac480e9344 100644
--- a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
+++ b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturefloat::OESTextureFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webgl_extensions/extension.rs b/components/script/dom/webgl_extensions/extension.rs
index fd7cb17ffaf..3854acee122 100644
--- a/components/script/dom/webgl_extensions/extension.rs
+++ b/components/script/dom/webgl_extensions/extension.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::WebGLExtensions;
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
/// Trait implemented by WebGL extensions.
pub trait WebGLExtension: Sized
diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs
index 504f0784d82..aa6d128ae89 100644
--- a/components/script/dom/webgl_extensions/extensions.rs
+++ b/components/script/dom/webgl_extensions/extensions.rs
@@ -4,7 +4,6 @@
use super::wrapper::{TypedWebGLExtensionWrapper, WebGLExtensionWrapper};
use super::{ext, WebGLExtension, WebGLExtensionSpec};
-use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
@@ -18,6 +17,7 @@ use crate::dom::oestexturefloat::OESTextureFloat;
use crate::dom::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglcolorbufferfloat::WEBGLColorBufferFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::WebGLVersion;
use fnv::{FnvHashMap, FnvHashSet};
use gleam::gl::{self, GLenum};
use js::jsapi::JSObject;
diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs
index 7cb192802f3..d9bce435234 100644
--- a/components/script/dom/webgl_validations/tex_image_2d.rs
+++ b/components/script/dom/webgl_validations/tex_image_2d.rs
@@ -4,10 +4,10 @@
use super::types::TexImageTarget;
use super::WebGLValidator;
-use canvas_traits::webgl::{TexDataType, TexFormat, WebGLError::*};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::WebGLTexture;
+use canvas_traits::webgl::{TexDataType, TexFormat, WebGLError::*};
use std::{self, fmt};
/// The errors that the texImage* family of functions can generate.
diff --git a/components/script/dom/webgl_validations/types.rs b/components/script/dom/webgl_validations/types.rs
index fe5e7e35f59..597e924724a 100644
--- a/components/script/dom/webgl_validations/types.rs
+++ b/components/script/dom/webgl_validations/types.rs
@@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::gl_enums;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants;
+use canvas_traits::gl_enums;
gl_enums! {
pub enum TexImageTarget {
diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs
index f068cd598e5..acf30e28855 100644
--- a/components/script/dom/webglbuffer.rs
+++ b/components/script/dom/webglbuffer.rs
@@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::webgl_channel;
-use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
use crate::dom::bindings::codegen::Bindings::WebGLBufferBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants;
use crate::dom::bindings::inheritance::Castable;
@@ -12,6 +10,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::webgl_channel;
+use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
use dom_struct::dom_struct;
use ipc_channel::ipc;
use std::cell::Cell;
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs
index 5386a3f5df4..86fb30fb8fd 100644
--- a/components/script/dom/webglframebuffer.rs
+++ b/components/script/dom/webglframebuffer.rs
@@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult};
-use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLFramebufferBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@@ -15,6 +13,8 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderbuffer::WebGLRenderbuffer;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::WebGLTexture;
+use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult};
+use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId};
use dom_struct::dom_struct;
use std::cell::Cell;
@@ -531,11 +531,7 @@ impl WebGLFramebuffer {
Some(WebGLFramebufferAttachment::Texture {
texture: ref att_texture,
..
- })
- if texture.id() == att_texture.id() =>
- {
- true
- },
+ }) if texture.id() == att_texture.id() => true,
_ => false,
}
};
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 9338ad036cf..5ec0e2949fe 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
-use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLCommand, WebGLError};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLProgramBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@@ -17,6 +15,8 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webglshader::WebGLShader;
use crate::dom::webgluniformlocation::WebGLUniformLocation;
+use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
+use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLCommand, WebGLError};
use dom_struct::dom_struct;
use fnv::FnvHashSet;
use std::cell::{Cell, Ref};
@@ -247,7 +247,7 @@ impl WebGLProgram {
match shader_slot.get() {
Some(ref attached_shader) if attached_shader.id() != shader.id() => {
- return Err(WebGLError::InvalidOperation)
+ return Err(WebGLError::InvalidOperation);
},
None => return Err(WebGLError::InvalidOperation),
_ => {},
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index 663b729286d..d1387b277aa 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -3,9 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::{
- is_gles, webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
-};
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding::EXTColorBufferHalfFloatConstants;
use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding::WEBGLColorBufferFloatConstants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants;
@@ -16,6 +13,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{
+ is_gles, webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
+};
use dom_struct::dom_struct;
use std::cell::Cell;
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index c7896b42436..726a59db4ad 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -2,15 +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/. */
-#[cfg(feature = "webgl_backtrace")]
-use backtrace::Backtrace;
-use canvas_traits::webgl::WebGLError::*;
-use canvas_traits::webgl::{
- webgl_channel, AlphaTreatment, DOMToTextureCommand, Parameter, TexDataType, TexFormat,
- TexParameter, WebGLCommand, WebGLCommandBacktrace, WebGLContextShareMode, WebGLError,
- WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, WebGLResult,
- WebGLSLVersion, WebGLSender, WebGLVersion, WebVRCommand, YAxisTreatment,
-};
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding::EXTBlendMinmaxConstants;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
@@ -55,6 +46,15 @@ use crate::dom::webgltexture::{TexParameterValue, WebGLTexture};
use crate::dom::webgluniformlocation::WebGLUniformLocation;
use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
use crate::dom::window::Window;
+#[cfg(feature = "webgl_backtrace")]
+use backtrace::Backtrace;
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{
+ webgl_channel, AlphaTreatment, DOMToTextureCommand, Parameter, TexDataType, TexFormat,
+ TexParameter, WebGLCommand, WebGLCommandBacktrace, WebGLContextShareMode, WebGLError,
+ WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, WebGLResult,
+ WebGLSLVersion, WebGLSender, WebGLVersion, WebVRCommand, YAxisTreatment,
+};
use dom_struct::dom_struct;
use euclid::{Point2D, Rect, Size2D};
use ipc_channel::ipc::{self, IpcSharedMemory};
@@ -1913,9 +1913,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
fn Clear(&self, mask: u32) {
handle_potential_webgl_error!(self, self.validate_framebuffer(), return);
- if mask & !(constants::DEPTH_BUFFER_BIT |
- constants::STENCIL_BUFFER_BIT |
- constants::COLOR_BUFFER_BIT) !=
+ if mask &
+ !(constants::DEPTH_BUFFER_BIT |
+ constants::STENCIL_BUFFER_BIT |
+ constants::COLOR_BUFFER_BIT) !=
0
{
return self.webgl_error(InvalidValue);
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index 0c17aa4e5d5..8f53267b50b 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -3,9 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::{webgl_channel, WebGLVersion};
-use canvas_traits::webgl::{WebGLCommand, WebGLError};
-use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLShaderBinding;
use crate::dom::bindings::inheritance::Castable;
@@ -17,6 +14,9 @@ use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDeriva
use crate::dom::webgl_extensions::WebGLExtensions;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{webgl_channel, WebGLVersion};
+use canvas_traits::webgl::{WebGLCommand, WebGLError};
+use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
use dom_struct::dom_struct;
use mozangle::shaders::{BuiltInResources, Output, ShaderValidator};
use offscreen_gl_context::GLLimits;
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs
index 626ceb22cf7..261edbe67be 100644
--- a/components/script/dom/webgltexture.rs
+++ b/components/script/dom/webgltexture.rs
@@ -4,8 +4,6 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::{webgl_channel, TexDataType, TexFormat, WebGLResult, WebGLTextureId};
-use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@@ -16,6 +14,8 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_validations::types::TexImageTarget;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{webgl_channel, TexDataType, TexFormat, WebGLResult, WebGLTextureId};
+use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError};
use dom_struct::dom_struct;
use std::cell::Cell;
use std::cmp;
diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs
index c1582c40b19..bf142480dc7 100644
--- a/components/script/dom/webgluniformlocation.rs
+++ b/components/script/dom/webgluniformlocation.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
-use canvas_traits::webgl::WebGLProgramId;
use crate::dom::bindings::codegen::Bindings::WebGLUniformLocationBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
+use canvas_traits::webgl::WebGLProgramId;
use dom_struct::dom_struct;
#[dom_struct]
diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs
index 10103bef8ba..871de741c39 100644
--- a/components/script/dom/webglvertexarrayobjectoes.rs
+++ b/components/script/dom/webglvertexarrayobjectoes.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/. */
-use canvas_traits::webgl::{
- ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVertexArrayId,
-};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use crate::dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding;
@@ -14,6 +11,9 @@ use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
+use canvas_traits::webgl::{
+ ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVertexArrayId,
+};
use dom_struct::dom_struct;
use ref_filter_map::ref_filter_map;
use std::cell::{Cell, Ref};
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 4ca4e5fbb9d..4344078a017 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -583,14 +583,12 @@ impl TaskOnce for MessageReceivedTask {
},
BinaryType::Arraybuffer => {
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
- assert!(
- ArrayBuffer::create(
- cx,
- CreateWith::Slice(&data),
- array_buffer.handle_mut()
- )
- .is_ok()
- );
+ assert!(ArrayBuffer::create(
+ cx,
+ CreateWith::Slice(&data),
+ array_buffer.handle_mut()
+ )
+ .is_ok());
(*array_buffer).to_jsval(cx, message.handle_mut());
},
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 1dbe0fc4c3a..ee637e39ebf 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
-use base64;
-use bluetooth_traits::BluetoothRequest;
-use canvas_traits::webgl::WebGLChan;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
DocumentMethods, DocumentReadyState,
@@ -68,6 +64,10 @@ use crate::task_manager::TaskManager;
use crate::task_source::TaskSourceName;
use crate::timers::{IsInterval, TimerCallback};
use crate::webdriver_handlers::jsval_to_webdriver;
+use app_units::Au;
+use base64;
+use bluetooth_traits::BluetoothRequest;
+use canvas_traits::webgl::WebGLChan;
use crossbeam_channel::{unbounded, Sender, TryRecvError};
use cssparser::{Parser, ParserInput};
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
@@ -1747,16 +1747,16 @@ impl Window {
let old_url = doc.url().into_string();
let new_url = url.clone().into_string();
let task = task!(hashchange_event: move || {
- let this = this.root();
- let event = HashChangeEvent::new(
- &this,
- atom!("hashchange"),
- false,
- false,
- old_url,
- new_url);
- event.upcast::<Event>().fire(this.upcast::<EventTarget>());
- });
+ let this = this.root();
+ let event = HashChangeEvent::new(
+ &this,
+ atom!("hashchange"),
+ false,
+ false,
+ old_url,
+ new_url);
+ event.upcast::<Event>().fire(this.upcast::<EventTarget>());
+ });
// FIXME(nox): Why are errors silenced here?
let _ = self.script_chan.send(CommonScriptMsg::Task(
ScriptThreadEventCategory::DomEvent,
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 18628f27f70..7c32c5e9015 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -695,9 +695,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
for param in mime.params() {
if param.0 == mime::CHARSET {
if !param.1.as_ref().eq_ignore_ascii_case(encoding) {
- let new_params: Vec<
- (Name, Name),
- > = mime
+ let new_params: Vec<(Name, Name)> = mime
.params()
.filter(|p| p.0 != mime::CHARSET)
.map(|p| (p.0, p.1))
@@ -829,7 +827,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 1
match self.ready_state.get() {
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => {
- return Err(Error::InvalidState)
+ return Err(Error::InvalidState);
},
_ => {},
}
diff --git a/components/script/lib.rs b/components/script/lib.rs
index b51de15e5ce..2454fff090e 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -12,10 +12,7 @@
#![allow(non_snake_case)]
#![doc = "The script crate contains all matters DOM."]
#![plugin(script_plugins)]
-#![cfg_attr(
- not(feature = "unrooted_must_root_lint"),
- allow(unknown_lints)
-)]
+#![cfg_attr(not(feature = "unrooted_must_root_lint"), allow(unknown_lints))]
#[macro_use]
extern crate bitflags;
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 1558e0fffb7..d10b95a068e 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -687,7 +687,9 @@ unsafe extern "C" fn debug_gc_callback(
}
}
-thread_local!(static THREAD_ACTIVE: Cell<bool> = Cell::new(true););
+thread_local!(
+ static THREAD_ACTIVE: Cell<bool> = Cell::new(true);
+);
#[allow(unsafe_code)]
unsafe extern "C" fn trace_rust_roots(tr: *mut JSTracer, _data: *mut os::raw::c_void) {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 178e121bda9..64cbd0af672 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -17,8 +17,6 @@
//! a page runs its course and the script thread returns to processing events in the main event
//! loop.
-use bluetooth_traits::BluetoothRequest;
-use canvas_traits::webgl::WebGLPipeline;
use crate::devtools;
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
@@ -83,6 +81,8 @@ use crate::task_source::user_interaction::UserInteractionTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
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 devtools_traits::CSSError;
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
@@ -935,7 +935,7 @@ impl ScriptThread {
return warn!(
"Paint worklet registered after pipeline {} closed.",
pipeline_id
- )
+ );
},
};
let _ = window
@@ -1192,14 +1192,16 @@ impl ScriptThread {
} else if let Some(parent) =
new_layout_info.parent_info.and_then(|pipeline_id| {
self.documents.borrow().find_document(pipeline_id)
- }) {
+ })
+ {
parent.origin().clone()
} else if let Some(creator) = new_layout_info
.load_data
.creator_pipeline_id
.and_then(|pipeline_id| {
self.documents.borrow().find_document(pipeline_id)
- }) {
+ })
+ {
creator.origin().clone()
} else {
MutableOrigin::new(ImmutableOrigin::new_opaque())
@@ -1700,7 +1702,7 @@ impl ScriptThread {
return warn!(
"Received fire timer msg for a closed pipeline {}.",
pipeline_id
- )
+ );
},
};
@@ -1892,7 +1894,7 @@ impl ScriptThread {
return warn!(
"Set scroll state message sent to nonexistent pipeline: {:?}",
id
- )
+ );
},
};
@@ -2133,7 +2135,7 @@ impl ScriptThread {
return warn!(
"update history state after pipeline {} closed.",
pipeline_id
- )
+ );
},
Some(window) => window.History().r().activate_state(history_state_id, url),
}
@@ -2149,7 +2151,7 @@ impl ScriptThread {
return warn!(
"update history state after pipeline {} closed.",
pipeline_id
- )
+ );
},
Some(window) => window.History().r().remove_states(history_states),
}
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index e65c48230f2..3113fb0a527 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cookie::Cookie;
use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
@@ -25,6 +24,7 @@ use crate::dom::htmlinputelement::HTMLInputElement;
use crate::dom::htmloptionelement::HTMLOptionElement;
use crate::dom::node::{window_from_node, Node};
use crate::script_thread::Documents;
+use cookie::Cookie;
use euclid::{Point2D, Rect, Size2D};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
@@ -97,7 +97,7 @@ pub fn handle_execute_script(
None => {
return reply
.send(Err(WebDriverJSError::BrowsingContextNotFound))
- .unwrap()
+ .unwrap();
},
};
@@ -124,7 +124,7 @@ pub fn handle_execute_async_script(
None => {
return reply
.send(Err(WebDriverJSError::BrowsingContextNotFound))
- .unwrap()
+ .unwrap();
},
};
@@ -304,7 +304,7 @@ pub fn handle_add_cookie(
None => {
return reply
.send(Err(WebDriverCookieError::UnableToSetCookie))
- .unwrap()
+ .unwrap();
},
};
let url = document.url();
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index d17a8fc5e2f..7600ebe372a 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use app_units::Au;
use crate::rpc::LayoutRPC;
use crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress};
+use app_units::Au;
use crossbeam_channel::{Receiver, Sender};
use euclid::{Point2D, Rect};
use gfx_traits::Epoch;
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 7b519c9ec59..0a7e080bebb 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -4,12 +4,12 @@
#![allow(unsafe_code)]
-use atomic_refcell::AtomicRef;
use crate::HTMLCanvasData;
use crate::HTMLMediaData;
use crate::LayoutNodeType;
use crate::OpaqueStyleAndLayoutData;
use crate::SVGSVGData;
+use atomic_refcell::AtomicRef;
use gfx_traits::{combine_id_with_fragment_type, ByteIndex, FragmentType};
use html5ever::{LocalName, Namespace};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 5f450a65911..788a206b63f 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -19,9 +19,9 @@ extern crate serde;
mod script_msg;
pub mod webdriver_msg;
+use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLPipeline;
-use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
use euclid::{Length, Point2D, Rect, TypedScale, TypedSize2D, Vector2D};
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index 4cb64c162f4..54b52fb33d0 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use canvas_traits::canvas::{CanvasId, CanvasMsg};
use crate::AnimationState;
use crate::AuxiliaryBrowsingContextLoadInfo;
use crate::DocumentState;
@@ -12,6 +11,7 @@ use crate::LayoutControlMsg;
use crate::LoadData;
use crate::WorkerGlobalScopeInit;
use crate::WorkerScriptLoadOrigin;
+use canvas_traits::canvas::{CanvasId, CanvasMsg};
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::EmbedderMsg;
use euclid::{Size2D, TypedSize2D};
diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs
index 7c509e8e673..f50dc8ddecf 100644
--- a/components/selectors/matching.rs
+++ b/components/selectors/matching.rs
@@ -261,10 +261,11 @@ where
let iter = selector.iter_from(selector.len() - from_offset);
debug_assert!(
iter.clone().next().is_some() ||
- (from_offset != selector.len() && matches!(
- selector.combinator_at_parse_order(from_offset),
- Combinator::SlotAssignment | Combinator::PseudoElement
- )),
+ (from_offset != selector.len() &&
+ matches!(
+ selector.combinator_at_parse_order(from_offset),
+ Combinator::SlotAssignment | Combinator::PseudoElement
+ )),
"Got the math wrong: {:?} | {:?} | {} {}",
selector,
selector.iter_raw_match_order().as_slice(),
@@ -454,11 +455,9 @@ where
context.current_host.is_some(),
"Should not be trying to match slotted rules in a non-shadow-tree context"
);
- debug_assert!(
- element
- .assigned_slot()
- .map_or(true, |s| s.is_html_slot_element())
- );
+ debug_assert!(element
+ .assigned_slot()
+ .map_or(true, |s| s.is_html_slot_element()));
let scope = context.current_host?;
let mut current_slot = element.assigned_slot()?;
while current_slot.containing_shadow_host().unwrap().opaque() != scope {
@@ -674,9 +673,9 @@ where
Component::Combinator(_) => unreachable!(),
Component::Slotted(ref selector) => {
// <slots> are never flattened tree slottables.
- !element.is_html_slot_element() && element.assigned_slot().is_some() && context
- .shared
- .nest(|context| {
+ !element.is_html_slot_element() &&
+ element.assigned_slot().is_some() &&
+ context.shared.nest(|context| {
matches_complex_selector(selector.iter(), element, context, flags_setter)
})
},
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index 4dda76d3200..fa043b772a9 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -449,9 +449,7 @@ where
ref local_name,
never_matches,
..
- }
- if !never_matches =>
- {
+ } if !never_matches => {
if !visitor.visit_attribute_selector(
&NamespaceConstraint::Specific(&namespace_empty_string::<Impl>()),
local_name,
@@ -459,7 +457,7 @@ where
) {
return false;
}
- }
+ },
AttributeOther(ref attr_selector) if !attr_selector.never_matches => {
let empty_string;
let namespace = match attr_selector.namespace() {
@@ -1366,7 +1364,7 @@ where
SelectorParseErrorKind::DanglingCombinator
} else {
SelectorParseErrorKind::EmptySelector
- }))
+ }));
},
};
@@ -1634,7 +1632,7 @@ where
OptionalQName::None(t) => {
return Err(input.new_custom_error(
SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(t),
- ))
+ ));
},
OptionalQName::Some(_, None) => unreachable!(),
OptionalQName::Some(ns, Some(ln)) => {
@@ -1691,7 +1689,7 @@ where
Ok(t) => {
return Err(location.new_custom_error(
SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(t.clone()),
- ))
+ ));
},
};
@@ -1768,11 +1766,12 @@ impl AttributeFlags {
AttributeFlags::CaseSensitive => ParsedCaseSensitivity::ExplicitCaseSensitive,
AttributeFlags::AsciiCaseInsensitive => ParsedCaseSensitivity::AsciiCaseInsensitive,
AttributeFlags::CaseSensitivityDependsOnName => {
- if !have_namespace && include!(concat!(
- env!("OUT_DIR"),
- "/ascii_case_insensitive_html_attributes.rs"
- ))
- .contains(local_name)
+ if !have_namespace &&
+ include!(concat!(
+ env!("OUT_DIR"),
+ "/ascii_case_insensitive_html_attributes.rs"
+ ))
+ .contains(local_name)
{
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument
} else {
@@ -1961,7 +1960,7 @@ where
&Token::Ident(ref name) => name.clone(),
t => {
return Err(location
- .new_custom_error(SelectorParseErrorKind::NoIdentForPseudo(t.clone())))
+ .new_custom_error(SelectorParseErrorKind::NoIdentForPseudo(t.clone())));
},
};
diff --git a/components/style/attr.rs b/components/style/attr.rs
index eb7fd9ece2a..780248a2221 100644
--- a/components/style/attr.rs
+++ b/components/style/attr.rs
@@ -6,7 +6,6 @@
//!
//! [attr]: https://dom.spec.whatwg.org/#interface-attr
-use app_units::Au;
use crate::properties::PropertyDeclarationBlock;
use crate::shared_lock::Locked;
use crate::str::str_join;
@@ -14,6 +13,7 @@ use crate::str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
use crate::str::{read_numbers, split_commas, split_html_space_chars};
use crate::values::specified::Length;
use crate::{Atom, LocalName, Namespace, Prefix};
+use app_units::Au;
use cssparser::{self, Color, RGBA};
use euclid::num::Zero;
use num_traits::ToPrimitive;
diff --git a/components/style/bloom.rs b/components/style/bloom.rs
index 077efa92011..92e6b2a48b4 100644
--- a/components/style/bloom.rs
+++ b/components/style/bloom.rs
@@ -7,8 +7,8 @@
#![deny(missing_docs)]
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::dom::{SendElement, TElement};
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use owning_ref::OwningHandle;
use selectors::bloom::BloomFilter;
use servo_arc::Arc;
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index 4b5d36232d5..9b627a4a82e 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -513,8 +513,7 @@ mod bindings {
"pub type nsTArrayBorrowed_{}<'a> = ",
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
),
- cpp_type,
- rust_type
+ cpp_type, rust_type
))
})
.handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
diff --git a/components/style/context.rs b/components/style/context.rs
index 42e506777ab..aca1d24f2ea 100644
--- a/components/style/context.rs
+++ b/components/style/context.rs
@@ -4,7 +4,6 @@
//! The context within which style is calculated.
-use app_units::Au;
#[cfg(feature = "servo")]
use crate::animation::Animation;
use crate::bloom::StyleBloom;
@@ -29,6 +28,7 @@ use crate::thread_state::{self, ThreadState};
use crate::timer::Timer;
use crate::traversal::DomTraversal;
use crate::traversal_flags::TraversalFlags;
+use app_units::Au;
#[cfg(feature = "servo")]
use crossbeam_channel::Sender;
use euclid::Size2D;
diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs
index 130c92b0e9b..6bc2b331e35 100644
--- a/components/style/custom_properties.rs
+++ b/components/style/custom_properties.rs
@@ -434,7 +434,7 @@ fn parse_declaration_value_block<'i, 't>(
return Ok((
TokenSerializationType::nothing(),
TokenSerializationType::nothing(),
- ))
+ ));
},
};
let first_token_type = token.serialization_type();
diff --git a/components/style/dom.rs b/components/style/dom.rs
index eee5b9d90ef..1c64543310c 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -7,7 +7,6 @@
#![allow(unsafe_code)]
#![deny(missing_docs)]
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
#[cfg(feature = "gecko")]
use crate::context::PostAnimationTasks;
@@ -23,6 +22,7 @@ use crate::shared_lock::Locked;
use crate::stylist::CascadeData;
use crate::traversal_flags::TraversalFlags;
use crate::{Atom, LocalName, Namespace, WeakAtom};
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
use selectors::sink::Push;
use selectors::Element as SelectorsElement;
@@ -42,10 +42,7 @@ use std::ops::Deref;
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
/// locality reasons. Using `OpaqueNode` enforces this invariant.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
-#[cfg_attr(
- feature = "servo",
- derive(MallocSizeOf, Deserialize, Serialize)
-)]
+#[cfg_attr(feature = "servo", derive(MallocSizeOf, Deserialize, Serialize))]
pub struct OpaqueNode(pub usize);
impl OpaqueNode {
diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index 7b911cbb76c..38c4bb78833 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -336,9 +336,10 @@ impl<'a> FontFace<'a> {
// We support only opentype fonts and truetype is an alias for
// that format. Sources without format hints need to be
// downloaded in case we support them.
- hints.is_empty() || hints
- .iter()
- .any(|hint| hint == "truetype" || hint == "opentype" || hint == "woff")
+ hints.is_empty() ||
+ hints.iter().any(|hint| {
+ hint == "truetype" || hint == "opentype" || hint == "woff"
+ })
} else {
true
}
diff --git a/components/style/font_metrics.rs b/components/style/font_metrics.rs
index 031faa7c536..0c37a444658 100644
--- a/components/style/font_metrics.rs
+++ b/components/style/font_metrics.rs
@@ -6,12 +6,12 @@
#![deny(missing_docs)]
-use app_units::Au;
use crate::context::SharedStyleContext;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::properties::style_structs::Font;
use crate::Atom;
+use app_units::Au;
/// Represents the font metrics that style needs from a font to compute the
/// value of certain CSS units like `ex`.
diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs
index 426d8c30ae9..c48d56f56e1 100644
--- a/components/style/gecko/conversions.rs
+++ b/components/style/gecko/conversions.rs
@@ -8,7 +8,6 @@
#![allow(unsafe_code)]
-use app_units::Au;
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
@@ -27,6 +26,7 @@ use crate::values::generics::box_::VerticalAlign;
use crate::values::generics::grid::{TrackListValue, TrackSize};
use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
use crate::values::generics::rect::Rect;
+use app_units::Au;
use std::f32::consts::PI;
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs
index 08ebd428b30..d4c976cc2a6 100644
--- a/components/style/gecko/data.rs
+++ b/components/style/gecko/data.rs
@@ -4,7 +4,6 @@
//! Data needed to style a Gecko document.
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::context::QuirksMode;
use crate::dom::TElement;
use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
@@ -19,6 +18,7 @@ use crate::selector_parser::SnapshotMap;
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
use crate::stylist::Stylist;
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use malloc_size_of::MallocSizeOfOps;
use servo_arc::Arc;
use std::fmt;
diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs
index de37629ca28..25355c45d70 100644
--- a/components/style/gecko/media_features.rs
+++ b/components/style/gecko/media_features.rs
@@ -4,7 +4,6 @@
//! Gecko's media feature list and evaluator.
-use app_units::Au;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
@@ -14,6 +13,7 @@ use crate::media_queries::Device;
use crate::values::computed::CSSPixelLength;
use crate::values::computed::Resolution;
use crate::Atom;
+use app_units::Au;
use euclid::Size2D;
fn viewport_size(device: &Device) -> Size2D<Au> {
diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs
index f7fb7e15f59..ab3f3a0de80 100644
--- a/components/style/gecko/media_queries.rs
+++ b/components/style/gecko/media_queries.rs
@@ -4,8 +4,6 @@
//! Gecko's media-query device and expression representation.
-use app_units::Au;
-use app_units::AU_PER_PX;
use crate::custom_properties::CssEnvironment;
use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use crate::gecko_bindings::bindings;
@@ -16,6 +14,8 @@ use crate::properties::ComputedValues;
use crate::string_cache::Atom;
use crate::values::computed::font::FontSize;
use crate::values::{CustomIdent, KeyframesName};
+use app_units::Au;
+use app_units::AU_PER_PX;
use cssparser::RGBA;
use euclid::Size2D;
use euclid::TypedScale;
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs
index 330bf6057a2..b00cb4f909e 100644
--- a/components/style/gecko/selector_parser.rs
+++ b/components/style/gecko/selector_parser.rs
@@ -230,33 +230,34 @@ impl NonTSPseudoClass {
/// Returns true if the given pseudoclass should trigger style sharing cache
/// revalidation.
pub fn needs_cache_revalidation(&self) -> bool {
- self.state_flag().is_empty() && !matches!(*self,
- // :-moz-any is handled by the revalidation visitor walking
- // the things inside it; it does not need to cause
- // revalidation on its own.
- NonTSPseudoClass::MozAny(_) |
- // :dir() depends on state only, but doesn't use state_flag
- // because its semantics don't quite match. Nevertheless, it
- // doesn't need cache revalidation, because we already compare
- // states for elements and candidates.
- NonTSPseudoClass::Dir(_) |
- // :-moz-is-html only depends on the state of the document and
- // the namespace of the element; the former is invariant
- // across all the elements involved and the latter is already
- // checked for by our caching precondtions.
- NonTSPseudoClass::MozIsHTML |
- // :-moz-placeholder is parsed but never matches.
- NonTSPseudoClass::MozPlaceholder |
- // :-moz-locale-dir and :-moz-window-inactive depend only on
- // the state of the document, which is invariant across all
- // the elements involved in a given style cache.
- NonTSPseudoClass::MozLocaleDir(_) |
- NonTSPseudoClass::MozWindowInactive |
- // Similar for the document themes.
- NonTSPseudoClass::MozLWTheme |
- NonTSPseudoClass::MozLWThemeBrightText |
- NonTSPseudoClass::MozLWThemeDarkText
- )
+ self.state_flag().is_empty() &&
+ !matches!(*self,
+ // :-moz-any is handled by the revalidation visitor walking
+ // the things inside it; it does not need to cause
+ // revalidation on its own.
+ NonTSPseudoClass::MozAny(_) |
+ // :dir() depends on state only, but doesn't use state_flag
+ // because its semantics don't quite match. Nevertheless, it
+ // doesn't need cache revalidation, because we already compare
+ // states for elements and candidates.
+ NonTSPseudoClass::Dir(_) |
+ // :-moz-is-html only depends on the state of the document and
+ // the namespace of the element; the former is invariant
+ // across all the elements involved and the latter is already
+ // checked for by our caching precondtions.
+ NonTSPseudoClass::MozIsHTML |
+ // :-moz-placeholder is parsed but never matches.
+ NonTSPseudoClass::MozPlaceholder |
+ // :-moz-locale-dir and :-moz-window-inactive depend only on
+ // the state of the document, which is invariant across all
+ // the elements involved in a given style cache.
+ NonTSPseudoClass::MozLocaleDir(_) |
+ NonTSPseudoClass::MozWindowInactive |
+ // Similar for the document themes.
+ NonTSPseudoClass::MozLWTheme |
+ NonTSPseudoClass::MozLWThemeBrightText |
+ NonTSPseudoClass::MozLWThemeDarkText
+ )
}
/// Returns true if the evaluation of the pseudo-class depends on the
diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs
index 77be7b52472..98dafcd070f 100644
--- a/components/style/gecko/values.rs
+++ b/components/style/gecko/values.rs
@@ -6,7 +6,6 @@
//! Different kind of helpers to interact with Gecko values.
-use app_units::Au;
use crate::counter_style::{Symbol, Symbols};
use crate::gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
use crate::gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
@@ -29,6 +28,7 @@ use crate::values::generics::length::{MaxLength, MozLength};
use crate::values::generics::{CounterStyleOrNone, NonNegative};
use crate::values::{Auto, Either, None_, Normal};
use crate::Atom;
+use app_units::Au;
use cssparser::RGBA;
use nsstring::{nsACString, nsCStr};
use std::cmp::max;
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index ca991b412d6..0768e9e26af 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -14,8 +14,6 @@
//! style system it's kind of pointless in the Stylo case, and only Servo forces
//! the separation between the style system implementation and everything else.
-use app_units::Au;
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::author_styles::AuthorStyles;
use crate::context::{PostAnimationTasks, QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
@@ -72,6 +70,8 @@ use crate::shared_lock::Locked;
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use crate::stylist::CascadeData;
use crate::CaseSensitivityExt;
+use app_units::Au;
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use selectors::matching::VisitedHandlingMode;
@@ -931,13 +931,14 @@ impl<'le> GeckoElement<'le> {
debug_assert_eq!(to.is_some(), from.is_some());
- combined_duration > 0.0f32 && from != to && from
- .unwrap()
- .animate(
- to.as_ref().unwrap(),
- Procedure::Interpolate { progress: 0.5 },
- )
- .is_ok()
+ combined_duration > 0.0f32 &&
+ from != to &&
+ from.unwrap()
+ .animate(
+ to.as_ref().unwrap(),
+ Procedure::Interpolate { progress: 0.5 },
+ )
+ .is_ok()
}
}
@@ -1241,10 +1242,11 @@ impl<'le> TElement for GeckoElement<'le> {
}
fn owner_doc_matches_for_testing(&self, device: &Device) -> bool {
- self.as_node().owner_doc().0 as *const structs::nsIDocument == device
- .pres_context()
- .mDocument
- .raw::<structs::nsIDocument>()
+ self.as_node().owner_doc().0 as *const structs::nsIDocument ==
+ device
+ .pres_context()
+ .mDocument
+ .raw::<structs::nsIDocument>()
}
fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
@@ -1864,9 +1866,8 @@ impl<'le> TElement for GeckoElement<'le> {
.intersects(NonTSPseudoClass::Active.state_flag());
if active {
let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
- let declarations: Option<
- &RawOffsetArc<Locked<PropertyDeclarationBlock>>,
- > = declarations.and_then(|s| s.as_arc_opt());
+ let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
+ declarations.and_then(|s| s.as_arc_opt());
if let Some(decl) = declarations {
hints.push(ApplicableDeclarationBlock::from_declarations(
decl.clone_arc(),
@@ -2081,11 +2082,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
return false;
}
- debug_assert!(
- self.as_node()
- .parent_node()
- .map_or(false, |p| p.is_document())
- );
+ debug_assert!(self
+ .as_node()
+ .parent_node()
+ .map_or(false, |p| p.is_document()));
unsafe { bindings::Gecko_IsRootElement(self.0) }
}
diff --git a/components/style/gecko_bindings/mod.rs b/components/style/gecko_bindings/mod.rs
index 75e045a4bbd..78fc8e3ae76 100644
--- a/components/style/gecko_bindings/mod.rs
+++ b/components/style/gecko_bindings/mod.rs
@@ -4,12 +4,7 @@
//! Gecko's C++ bindings, along with some rust helpers to ease its use.
-#[allow(
- dead_code,
- improper_ctypes,
- non_camel_case_types,
- missing_docs
-)]
+#[allow(dead_code, improper_ctypes, non_camel_case_types, missing_docs)]
pub mod bindings {
include!(concat!(env!("OUT_DIR"), "/gecko/bindings.rs"));
}
diff --git a/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs b/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
index 4a17093ba07..03d68576dea 100644
--- a/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
+++ b/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
@@ -4,9 +4,9 @@
//! Rust helpers for Gecko's `nsCSSShadowItem`.
-use app_units::Au;
use crate::gecko_bindings::structs::nsCSSShadowItem;
use crate::values::computed::effects::{BoxShadow, SimpleShadow};
+use app_units::Au;
impl nsCSSShadowItem {
/// Sets this item from the given box shadow.
diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs
index ca18c6d8e76..c794eb15c2c 100644
--- a/components/style/invalidation/element/element_wrapper.rs
+++ b/components/style/invalidation/element/element_wrapper.rs
@@ -208,10 +208,10 @@ where
// Instead, we use the `visited_handling` to determine if they
// match.
NonTSPseudoClass::Link => {
- return self.is_link() && context.visited_handling().matches_unvisited()
+ return self.is_link() && context.visited_handling().matches_unvisited();
},
NonTSPseudoClass::Visited => {
- return self.is_link() && context.visited_handling().matches_visited()
+ return self.is_link() && context.visited_handling().matches_visited();
},
#[cfg(feature = "gecko")]
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs
index 55ba76a60d5..b6cc9ef5bc6 100644
--- a/components/style/logical_geometry.rs
+++ b/components/style/logical_geometry.rs
@@ -1221,11 +1221,12 @@ impl<T: Copy + Add<T, Output = T> + Sub<T, Output = T>> LogicalRect<T> {
pub fn translate(&self, offset: &LogicalPoint<T>) -> LogicalRect<T> {
LogicalRect {
- start: self.start + LogicalSize {
- inline: offset.i,
- block: offset.b,
- debug_writing_mode: offset.debug_writing_mode,
- },
+ start: self.start +
+ LogicalSize {
+ inline: offset.i,
+ block: offset.b,
+ debug_writing_mode: offset.debug_writing_mode,
+ },
size: self.size,
debug_writing_mode: self.debug_writing_mode,
}
diff --git a/components/style/matching.rs b/components/style/matching.rs
index c7c547a3c61..b1240443dea 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -469,11 +469,9 @@ trait PrivateMatchMethods: TElement {
pseudo: Option<&PseudoElement>,
) -> ChildCascadeRequirement {
debug!("accumulate_damage_for: {:?}", self);
- debug_assert!(
- !shared_context
- .traversal_flags
- .contains(TraversalFlags::Forgetful)
- );
+ debug_assert!(!shared_context
+ .traversal_flags
+ .contains(TraversalFlags::Forgetful));
let difference = self.compute_style_difference(old_values, new_values, pseudo);
diff --git a/components/style/media_queries/media_feature.rs b/components/style/media_queries/media_feature.rs
index 69808242772..d5e015b3b07 100644
--- a/components/style/media_queries/media_feature.rs
+++ b/components/style/media_queries/media_feature.rs
@@ -30,9 +30,10 @@ type MediaFeatureEvaluator<T> = fn(
pub type KeywordSerializer = fn(KeywordDiscriminant) -> String;
/// Parses a given identifier.
-pub type KeywordParser =
- for<'a, 'i, 't> fn(context: &'a ParserContext, input: &'a mut Parser<'i, 't>)
- -> Result<KeywordDiscriminant, ParseError<'i>>;
+pub type KeywordParser = for<'a, 'i, 't> fn(
+ context: &'a ParserContext,
+ input: &'a mut Parser<'i, 't>,
+) -> Result<KeywordDiscriminant, ParseError<'i>>;
/// An evaluator for a given media feature.
///
diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs
index 5144189778d..ec864510c72 100644
--- a/components/style/media_queries/media_feature_expression.rs
+++ b/components/style/media_queries/media_feature_expression.rs
@@ -134,10 +134,11 @@ impl RangeOrOperator {
match range_or_op {
RangeOrOperator::Range(range) => {
- cmp == Ordering::Equal || match range {
- Range::Min => cmp == Ordering::Greater,
- Range::Max => cmp == Ordering::Less,
- }
+ cmp == Ordering::Equal ||
+ match range {
+ Range::Min => cmp == Ordering::Greater,
+ Range::Max => cmp == Ordering::Less,
+ }
},
RangeOrOperator::Operator(op) => match op {
Operator::Equal => cmp == Ordering::Equal,
@@ -344,7 +345,7 @@ impl MediaFeatureExpression {
Err(()) => {
return Err(location.new_custom_error(
StyleParseErrorKind::MediaQueryExpectedFeatureName(ident.clone()),
- ))
+ ));
},
}
diff --git a/components/style/media_queries/media_list.rs b/components/style/media_queries/media_list.rs
index bd4125d5324..0acf4f1bdf9 100644
--- a/components/style/media_queries/media_list.rs
+++ b/components/style/media_queries/media_list.rs
@@ -74,21 +74,22 @@ impl MediaList {
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> bool {
// Check if it is an empty media query list or any queries match.
// https://drafts.csswg.org/mediaqueries-4/#mq-list
- self.media_queries.is_empty() || self.media_queries.iter().any(|mq| {
- let media_match = mq.media_type.matches(device.media_type());
+ self.media_queries.is_empty() ||
+ self.media_queries.iter().any(|mq| {
+ let media_match = mq.media_type.matches(device.media_type());
- // Check if the media condition match.
- let query_match = media_match && mq
- .condition
- .as_ref()
- .map_or(true, |c| c.matches(device, quirks_mode));
+ // Check if the media condition match.
+ let query_match = media_match &&
+ mq.condition
+ .as_ref()
+ .map_or(true, |c| c.matches(device, quirks_mode));
- // Apply the logical NOT qualifier to the result
- match mq.qualifier {
- Some(Qualifier::Not) => !query_match,
- _ => query_match,
- }
- })
+ // Apply the logical NOT qualifier to the result
+ match mq.qualifier {
+ Some(Qualifier::Not) => !query_match,
+ _ => query_match,
+ }
+ })
}
/// Whether this `MediaList` contains no media queries.
diff --git a/components/style/parallel.rs b/components/style/parallel.rs
index 1b9f80f5722..237453084df 100644
--- a/components/style/parallel.rs
+++ b/components/style/parallel.rs
@@ -22,11 +22,11 @@
#![deny(missing_docs)]
-use arrayvec::ArrayVec;
use crate::context::{StyleContext, ThreadLocalStyleContext};
use crate::dom::{OpaqueNode, SendNode, TElement};
use crate::scoped_tls::ScopedTLS;
use crate::traversal::{DomTraversal, PerLevelTraversalData};
+use arrayvec::ArrayVec;
use itertools::Itertools;
use rayon;
use smallvec::SmallVec;
diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs
index d35e8dc3ccd..b3c99cf875a 100644
--- a/components/style/servo/media_queries.rs
+++ b/components/style/servo/media_queries.rs
@@ -4,7 +4,6 @@
//! Servo's media-query device and expression representation.
-use app_units::Au;
use crate::custom_properties::CssEnvironment;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
@@ -14,6 +13,7 @@ use crate::properties::ComputedValues;
use crate::values::computed::font::FontSize;
use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
+use app_units::Au;
use cssparser::RGBA;
use euclid::{Size2D, TypedScale, TypedSize2D};
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs
index cd725228017..9abfe976919 100644
--- a/components/style/servo/selector_parser.rs
+++ b/components/style/servo/selector_parser.rs
@@ -457,7 +457,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
parser: &mut CssParser<'i, 't>,
) -> Result<NonTSPseudoClass, ParseError<'i>> {
use self::NonTSPseudoClass::*;
- let pseudo_class = match_ignore_ascii_case!{ &name,
+ let pseudo_class = match_ignore_ascii_case! { &name,
"lang" => {
Lang(parser.expect_ident_or_string()?.as_ref().into())
}
diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs
index 57038f627fe..09bfa163503 100644
--- a/components/style/shared_lock.rs
+++ b/components/style/shared_lock.rs
@@ -4,10 +4,10 @@
//! Different objects protected by the same lock
-#[cfg(feature = "gecko")]
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::str::{CssString, CssStringWriter};
use crate::stylesheets::Origin;
+#[cfg(feature = "gecko")]
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
#[cfg(feature = "servo")]
use parking_lot::RwLock;
use servo_arc::Arc;
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs
index 843fd76e2e6..c7be23572c6 100644
--- a/components/style/sharing/mod.rs
+++ b/components/style/sharing/mod.rs
@@ -64,7 +64,6 @@
//! selectors are effectively stripped off, so that matching them all against
//! elements makes sense.
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::bloom::StyleBloom;
use crate::context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
@@ -75,6 +74,7 @@ use crate::rule_tree::StrongRuleNode;
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles};
use crate::stylist::Stylist;
use crate::Atom;
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use owning_ref::OwningHandle;
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
use selectors::NthIndexCache;
diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs
index ea4e6a43d74..248d0ad0661 100644
--- a/components/style/style_adjuster.rs
+++ b/components/style/style_adjuster.rs
@@ -5,7 +5,6 @@
//! A struct to encapsulate all the style fixups and flags propagations
//! a computed style needs in order for it to adhere to the CSS spec.
-use app_units::Au;
use crate::dom::TElement;
use crate::properties::computed_value_flags::ComputedValueFlags;
use crate::properties::longhands::display::computed_value::T as Display;
@@ -13,6 +12,7 @@ use crate::properties::longhands::float::computed_value::T as Float;
use crate::properties::longhands::overflow_x::computed_value::T as Overflow;
use crate::properties::longhands::position::computed_value::T as Position;
use crate::properties::{self, ComputedValues, StyleBuilder};
+use app_units::Au;
/// A struct that implements all the adjustment methods.
///
@@ -190,12 +190,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
let is_root = self.style.pseudo.is_none() && element.map_or(false, |e| e.is_root());
blockify_if!(is_root);
if !self.skip_item_display_fixup(element) {
- blockify_if!(
- layout_parent_style
- .get_box()
- .clone_display()
- .is_item_container()
- );
+ blockify_if!(layout_parent_style
+ .get_box()
+ .clone_display()
+ .is_item_container());
}
let is_item_or_root = blockify;
@@ -220,11 +218,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
pub fn set_bits(&mut self) {
let display = self.style.get_box().clone_display();
- if !display.is_contents() && !self
- .style
- .get_text()
- .clone_text_decoration_line()
- .is_empty()
+ if !display.is_contents() &&
+ !self
+ .style
+ .get_text()
+ .clone_text_decoration_line()
+ .is_empty()
{
self.style
.flags
@@ -299,10 +298,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
#[cfg(feature = "gecko")]
fn adjust_for_text_in_ruby(&mut self) {
let parent_display = self.style.get_parent_box().clone_display();
- if parent_display.is_ruby_type() || self
- .style
- .get_parent_flags()
- .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK)
+ if parent_display.is_ruby_type() ||
+ self.style
+ .get_parent_flags()
+ .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK)
{
self.style
.flags
diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs
index d7e7315d7be..a93ed43d475 100644
--- a/components/style/stylesheets/font_feature_values_rule.rs
+++ b/components/style/stylesheets/font_feature_values_rule.rs
@@ -70,11 +70,7 @@ impl Parse for SingleValue {
match *input.next()? {
Token::Number {
int_value: Some(v), ..
- }
- if v >= 0 =>
- {
- Ok(SingleValue(v as u32))
- },
+ } if v >= 0 => Ok(SingleValue(v as u32)),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
@@ -103,22 +99,14 @@ impl Parse for PairValues {
let first = match *input.next()? {
Token::Number {
int_value: Some(a), ..
- }
- if a >= 0 =>
- {
- a as u32
- },
+ } if a >= 0 => a as u32,
ref t => return Err(location.new_unexpected_token_error(t.clone())),
};
let location = input.current_source_location();
match input.next() {
Ok(&Token::Number {
int_value: Some(b), ..
- })
- if b >= 0 =>
- {
- Ok(PairValues(first, Some(b as u32)))
- },
+ }) if b >= 0 => Ok(PairValues(first, Some(b as u32))),
// It can't be anything other than number.
Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
// It can be just one value.
@@ -157,11 +145,9 @@ impl Parse for VectorValues {
match input.next() {
Ok(&Token::Number {
int_value: Some(a), ..
- })
- if a >= 0 =>
- {
+ }) if a >= 0 => {
vec.push(a as u32);
- }
+ },
// It can't be anything other than number.
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(_) => break,
diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs
index 59f015bf4ae..662bc9ae481 100644
--- a/components/style/stylesheets/keyframes_rule.rs
+++ b/components/style/stylesheets/keyframes_rule.rs
@@ -141,11 +141,7 @@ impl KeyframePercentage {
Token::Percentage {
unit_value: percentage,
..
- }
- if percentage >= 0. && percentage <= 1. =>
- {
- Ok(KeyframePercentage::new(percentage))
- },
+ } if percentage >= 0. && percentage <= 1. => Ok(KeyframePercentage::new(percentage)),
_ => Err(input.new_unexpected_token_error(token)),
}
}
@@ -600,7 +596,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for KeyframeDeclarationParser<'a, 'b> {
let id = match PropertyId::parse(&name, self.context) {
Ok(id) => id,
Err(()) => {
- return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)))
+ return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
},
};
diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs
index a2a062ba173..44943259b38 100644
--- a/components/style/stylesheets/rule_parser.rs
+++ b/components/style/stylesheets/rule_parser.rs
@@ -107,9 +107,10 @@ impl<'b> TopLevelRuleParser<'b> {
// If there's anything that isn't a namespace rule (or import rule, but
// we checked that already at the beginning), reject with a
// StateError.
- if new_state == State::Namespaces && ctx.rule_list[ctx.index..]
- .iter()
- .any(|r| !matches!(*r, CssRule::Namespace(..)))
+ if new_state == State::Namespaces &&
+ ctx.rule_list[ctx.index..]
+ .iter()
+ .any(|r| !matches!(*r, CssRule::Namespace(..)))
{
self.dom_error = Some(RulesMutateError::InvalidState);
return false;
diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs
index e0d23ea0f5d..45f6f97812d 100644
--- a/components/style/stylesheets/supports_rule.rs
+++ b/components/style/stylesheets/supports_rule.rs
@@ -145,7 +145,7 @@ impl SupportsCondition {
function: &str,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
- match_ignore_ascii_case!{ function,
+ match_ignore_ascii_case! { function,
// Although this is an internal syntax, it is not necessary
// to check parsing context as far as we accept any
// unexpected token as future syntax, and evaluate it to
@@ -350,9 +350,8 @@ impl RawSelector {
use crate::selector_parser::PseudoElement;
use selectors::parser::Component;
- let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() && selector
- .iter_raw_match_order()
- .any(|component| {
+ let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() &&
+ selector.iter_raw_match_order().any(|component| {
matches!(
*component,
Component::PseudoElement(PseudoElement::UnknownWebkit(..))
diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs
index d7b644114c6..4df576a15ab 100644
--- a/components/style/stylesheets/viewport_rule.rs
+++ b/components/style/stylesheets/viewport_rule.rs
@@ -7,7 +7,6 @@
//! [at]: https://drafts.csswg.org/css-device-adapt/#atviewport-rule
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
-use app_units::Au;
use crate::context::QuirksMode;
use crate::error_reporting::ContextualParseError;
use crate::font_metrics::get_metrics_provider_for_product;
@@ -20,6 +19,7 @@ use crate::str::CssStringWriter;
use crate::stylesheets::{Origin, StylesheetInDocument};
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
+use app_units::Au;
use cssparser::CowRcStr;
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use euclid::TypedSize2D;
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index c5129520b29..592e4e81081 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -355,10 +355,7 @@ pub struct Stylist {
stylesheets: StylistStylesheetSet,
/// If true, the quirks-mode stylesheet is applied.
- #[cfg_attr(
- feature = "servo",
- ignore_malloc_size_of = "defined in selectors"
- )]
+ #[cfg_attr(feature = "servo", ignore_malloc_size_of = "defined in selectors")]
quirks_mode: QuirksMode,
/// Selector maps for all of the style sheets in the stylist, after
@@ -1570,9 +1567,8 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
// Also, note that this call happens before we visit any of the simple
// selectors in the next ComplexSelector, so we can use this to skip
// looking at them.
- self.passed_rightmost_selector =
- self.passed_rightmost_selector ||
- !matches!(combinator, None | Some(Combinator::PseudoElement));
+ self.passed_rightmost_selector = self.passed_rightmost_selector ||
+ !matches!(combinator, None | Some(Combinator::PseudoElement));
true
}
@@ -1589,9 +1585,8 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
}
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
- self.needs_revalidation =
- self.needs_revalidation ||
- component_needs_revalidation(s, self.passed_rightmost_selector);
+ self.needs_revalidation = self.needs_revalidation ||
+ component_needs_revalidation(s, self.passed_rightmost_selector);
match *s {
Component::NonTSPseudoClass(ref p) => {
@@ -2024,10 +2019,10 @@ impl CascadeData {
debug!("Found valid keyframes rule: {:?}", *keyframes_rule);
// Don't let a prefixed keyframes animation override a non-prefixed one.
- let needs_insertion = keyframes_rule.vendor_prefix.is_none() || self
- .animations
- .get(keyframes_rule.name.as_atom())
- .map_or(true, |rule| rule.vendor_prefix.is_some());
+ let needs_insertion = keyframes_rule.vendor_prefix.is_none() ||
+ self.animations
+ .get(keyframes_rule.name.as_atom())
+ .map_or(true, |rule| rule.vendor_prefix.is_some());
if needs_insertion {
let animation = KeyframesAnimation::from_keyframes(
&keyframes_rule.keyframes,
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 89cbfb83477..f1821900bb4 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -208,11 +208,11 @@ pub trait DomTraversal<E: TElement>: Sync {
// animation-only restyle hint or recascade.
if traversal_flags.for_animation_only() {
return data.map_or(false, |d| d.has_styles()) &&
- (el.has_animation_only_dirty_descendants() || data
- .as_ref()
- .unwrap()
- .hint
- .has_animation_hint_or_recascade());
+ (el.has_animation_only_dirty_descendants() ||
+ data.as_ref()
+ .unwrap()
+ .hint
+ .has_animation_hint_or_recascade());
}
// Non-incremental layout visits every node.
@@ -516,9 +516,8 @@ pub fn recalc_style_at<E, D, F>(
!child_cascade_requirement.can_skip_cascade() ||
is_servo_nonincremental_layout();
- traverse_children =
- traverse_children &&
- !traversal.should_cull_subtree(context, element, &data, is_initial_style);
+ traverse_children = traverse_children &&
+ !traversal.should_cull_subtree(context, element, &data, is_initial_style);
// Examine our children, and enqueue the appropriate ones for traversal.
if traverse_children {
diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs
index 6711dcf3c83..38de8a359a1 100644
--- a/components/style/values/animated/mod.rs
+++ b/components/style/values/animated/mod.rs
@@ -8,13 +8,13 @@
//! computed values and need yet another intermediate representation. This
//! module's raison d'être is to ultimately contain all these types.
-use app_units::Au;
use crate::properties::PropertyId;
use crate::values::computed::length::CalcLengthOrPercentage;
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::Angle as ComputedAngle;
use crate::values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
use crate::values::CSSFloat;
+use app_units::Au;
use euclid::{Point2D, Size2D};
use smallvec::SmallVec;
use std::cmp;
diff --git a/components/style/values/computed/border.rs b/components/style/values/computed/border.rs
index 5a6e7082bd9..676e8c1b6be 100644
--- a/components/style/values/computed/border.rs
+++ b/components/style/values/computed/border.rs
@@ -4,7 +4,6 @@
//! Computed types for CSS values related to borders.
-use app_units::Au;
use crate::values::animated::ToAnimatedZero;
use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
use crate::values::computed::{Number, NumberOrPercentage};
@@ -15,6 +14,7 @@ use crate::values::generics::border::BorderRadius as GenericBorderRadius;
use crate::values::generics::border::BorderSpacing as GenericBorderSpacing;
use crate::values::generics::rect::Rect;
use crate::values::generics::size::Size;
+use app_units::Au;
pub use crate::values::specified::border::BorderImageRepeat;
diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs
index 3c192b5dd38..ad795ff6b29 100644
--- a/components/style/values/computed/font.rs
+++ b/components/style/values/computed/font.rs
@@ -4,8 +4,6 @@
//! Computed values for font properties
-use app_units::Au;
-use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
@@ -19,6 +17,8 @@ use crate::values::specified::font::{self as specified, MAX_FONT_WEIGHT, MIN_FON
use crate::values::specified::length::{FontBaseSize, NoCalcLength};
use crate::values::CSSFloat;
use crate::Atom;
+use app_units::Au;
+use byteorder::{BigEndian, ByteOrder};
use cssparser::{serialize_identifier, CssStringWriter, Parser};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs
index 16e5b5df65b..96886e9096a 100644
--- a/components/style/values/computed/length.rs
+++ b/components/style/values/computed/length.rs
@@ -5,7 +5,6 @@
//! `<length>` computed values, and related ones.
use super::{Context, Number, Percentage, ToComputedValue};
-use app_units::Au;
use crate::values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::length::MaxLength as GenericMaxLength;
@@ -15,6 +14,7 @@ use crate::values::generics::NonNegative;
use crate::values::specified::length::ViewportPercentageLength;
use crate::values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
use crate::values::{specified, Auto, CSSFloat, Either, IsAuto, Normal};
+use app_units::Au;
use ordered_float::NotNan;
use std::fmt::{self, Write};
use std::ops::{Add, Neg};
diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs
index 4fbcc6e754f..cbcdadd055f 100644
--- a/components/style/values/generics/basic_shape.rs
+++ b/components/style/values/generics/basic_shape.rs
@@ -241,11 +241,7 @@ where
(
&ShapeSource::Shape(ref this, ref this_box),
&ShapeSource::Shape(ref other, ref other_box),
- )
- if this_box == other_box =>
- {
- this.compute_squared_distance(other)
- },
+ ) if this_box == other_box => this.compute_squared_distance(other),
(&ShapeSource::Path(ref this), &ShapeSource::Path(ref other))
if this.fill == other.fill =>
{
diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs
index 0d5e6b21eee..ee14e15bfe5 100644
--- a/components/style/values/generics/font.rs
+++ b/components/style/values/generics/font.rs
@@ -4,9 +4,9 @@
//! Generic types for font stuff.
+use crate::parser::{Parse, ParserContext};
use app_units::Au;
use byteorder::{BigEndian, ReadBytesExt};
-use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use num_traits::One;
use std::fmt::{self, Write};
diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs
index df0279c7121..090c3c1f687 100644
--- a/components/style/values/generics/text.rs
+++ b/components/style/values/generics/text.rs
@@ -4,10 +4,10 @@
//! Generic types for text properties.
-use app_units::Au;
use crate::parser::ParserContext;
use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
+use app_units::Au;
use cssparser::Parser;
use style_traits::ParseError;
diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs
index 91af1355a27..158b7456c76 100644
--- a/components/style/values/generics/transform.rs
+++ b/components/style/values/generics/transform.rs
@@ -4,13 +4,13 @@
//! Generic types for CSS values that are related to transformations.
-use app_units::Au;
use crate::values::computed::length::Length as ComputedLength;
use crate::values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
use crate::values::specified::angle::Angle as SpecifiedAngle;
use crate::values::specified::length::Length as SpecifiedLength;
use crate::values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage;
use crate::values::{computed, CSSFloat};
+use app_units::Au;
use euclid::{self, Rect, Transform3D};
use num_traits::Zero;
use std::fmt::{self, Write};
diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs
index 8a47220fd6a..659ff95b1a7 100644
--- a/components/style/values/mod.rs
+++ b/components/style/values/mod.rs
@@ -93,10 +93,7 @@ where
}
/// Convenience void type to disable some properties and values through types.
-#[cfg_attr(
- feature = "servo",
- derive(Deserialize, MallocSizeOf, Serialize)
-)]
+#[cfg_attr(feature = "servo", derive(Deserialize, MallocSizeOf, Serialize))]
#[derive(
Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss,
)]
diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs
index 6e8cd059f35..35a0944aed5 100644
--- a/components/style/values/specified/angle.rs
+++ b/components/style/values/specified/angle.rs
@@ -193,7 +193,7 @@ impl Angle {
AllowUnitlessZeroAngle::No => Err(()),
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {
- return input.parse_nested_block(|i| CalcNode::parse_angle(context, i))
+ return input.parse_nested_block(|i| CalcNode::parse_angle(context, i));
},
_ => Err(()),
}
diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs
index 54030ba7139..c785fb0c0db 100644
--- a/components/style/values/specified/box.rs
+++ b/components/style/values/specified/box.rs
@@ -218,10 +218,7 @@ impl Display {
// Special handling for contents and list-item on the root
// element for Gecko.
#[cfg(feature = "gecko")]
- Display::Contents | Display::ListItem if _is_root_element =>
- {
- Display::Block
- },
+ Display::Contents | Display::ListItem if _is_root_element => Display::Block,
// These are not changed by blockification.
Display::None | Display::Block | Display::Flex | Display::ListItem | Display::Table => {
@@ -747,7 +744,9 @@ impl Parse for Contain {
let flag = match flag {
Some(flag) if !result.contains(flag) => flag,
_ => {
- return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name)))
+ return Err(
+ input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name))
+ );
},
};
result.insert(flag);
@@ -826,7 +825,7 @@ impl Parse for TransitionProperty {
location,
ident,
&["none"],
- )?))
+ )?));
},
};
@@ -1309,7 +1308,7 @@ impl BreakBetween {
Ok(v) => v,
Err(()) => {
return Err(location
- .new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
+ .new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())));
},
};
match break_value {
diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs
index 6abb94b946c..2fe00ff8799 100644
--- a/components/style/values/specified/calc.rs
+++ b/components/style/values/specified/calc.rs
@@ -180,7 +180,7 @@ impl CalcNode {
) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(CalcNode::Length)
- .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))
+ .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
(
&Token::Dimension {
@@ -204,7 +204,7 @@ impl CalcNode {
},
(&Token::Percentage { unit_value, .. }, CalcUnit::LengthOrPercentage) |
(&Token::Percentage { unit_value, .. }, CalcUnit::Percentage) => {
- return Ok(CalcNode::Percentage(unit_value))
+ return Ok(CalcNode::Percentage(unit_value));
},
(&Token::ParenthesisBlock, _) => {},
(&Token::Function(ref name), _) if name.eq_ignore_ascii_case("calc") => {},
diff --git a/components/style/values/specified/counters.rs b/components/style/values/specified/counters.rs
index b89d7ebafe0..6ee6575fc94 100644
--- a/components/style/values/specified/counters.rs
+++ b/components/style/values/specified/counters.rs
@@ -181,7 +181,7 @@ impl Parse for Content {
None => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnexpectedFunction(name.clone()),
- ))
+ ));
},
}
},
diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs
index 9cf97e2879c..e5699742b14 100644
--- a/components/style/values/specified/font.rs
+++ b/components/style/values/specified/font.rs
@@ -4,8 +4,6 @@
//! Specified values for font properties
-use app_units::Au;
-use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::bindings;
use crate::parser::{Parse, ParserContext};
@@ -22,6 +20,8 @@ use crate::values::specified::{AllowQuirks, Angle, Integer, LengthOrPercentage};
use crate::values::specified::{NoCalcLength, Number, Percentage};
use crate::values::CustomIdent;
use crate::Atom;
+use app_units::Au;
+use byteorder::{BigEndian, ByteOrder};
use cssparser::{Parser, Token};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs
index cd879e26e48..8fdaf51b275 100644
--- a/components/style/values/specified/grid.rs
+++ b/components/style/values/specified/grid.rs
@@ -22,11 +22,7 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseE
match *input.next()? {
Token::Dimension {
value, ref unit, ..
- }
- if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() =>
- {
- Ok(value)
- },
+ } if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() => Ok(value),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs
index 53d028e5711..d4ace9789a2 100644
--- a/components/style/values/specified/image.rs
+++ b/components/style/values/specified/image.rs
@@ -262,7 +262,7 @@ impl Parse for Gradient {
let (shape, repeating, mut compat_mode) = match result {
Some(result) => result,
None => {
- return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)))
+ return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)));
},
};
@@ -792,7 +792,7 @@ impl LineDirection {
CompatMode::WebKit if to_ident.is_ok() => {
return Err(
i.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("to".into()))
- )
+ );
},
_ => {},
}
diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs
index b615e56ea7e..13877dbe594 100644
--- a/components/style/values/specified/length.rs
+++ b/components/style/values/specified/length.rs
@@ -7,7 +7,6 @@
//! [length]: https://drafts.csswg.org/css-values/#lengths
use super::{AllowQuirks, Number, Percentage, ToComputedValue};
-use app_units::Au;
use crate::font_metrics::FontMetricsQueryResult;
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, CSSPixelLength, Context, ExtremumLength};
@@ -17,6 +16,7 @@ use crate::values::generics::transform::IsZeroLength;
use crate::values::generics::NonNegative;
use crate::values::specified::calc::CalcNode;
use crate::values::{Auto, CSSFloat, Either, IsAuto, Normal};
+use app_units::Au;
use cssparser::{Parser, Token};
use euclid::Size2D;
use std::cmp;
@@ -601,12 +601,10 @@ impl Length {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(Length::NoCalc)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
@@ -790,20 +788,18 @@ impl LengthOrPercentage {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentage::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentage::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -922,20 +918,18 @@ impl LengthOrPercentageOrAuto {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrAuto::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrAuto::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -948,7 +942,7 @@ impl LengthOrPercentageOrAuto {
)));
},
Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => {
- return Ok(LengthOrPercentageOrAuto::Auto)
+ return Ok(LengthOrPercentageOrAuto::Auto);
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
_ => return Err(location.new_unexpected_token_error(token.clone())),
@@ -1088,20 +1082,18 @@ impl LengthOrPercentageOrNone {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrNone::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrNone::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -1115,7 +1107,7 @@ impl LengthOrPercentageOrNone {
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
Token::Ident(ref value) if value.eq_ignore_ascii_case("none") => {
- return Ok(LengthOrPercentageOrNone::None)
+ return Ok(LengthOrPercentageOrNone::None);
},
_ => return Err(location.new_unexpected_token_error(token.clone())),
}
diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs
index 3b8278c3287..d3df66a0eea 100644
--- a/components/style/values/specified/mod.rs
+++ b/components/style/values/specified/mod.rs
@@ -138,7 +138,7 @@ fn parse_number_with_clamping_mode<'i, 't>(
return Ok(Number {
value: value.min(f32::MAX).max(f32::MIN),
calc_clamping_mode: None,
- })
+ });
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
ref t => return Err(location.new_unexpected_token_error(t.clone())),
@@ -808,7 +808,7 @@ impl Attr {
Some(ns) => ns,
None => {
return Err(location
- .new_custom_error(StyleParseErrorKind::UnspecifiedError))
+ .new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
};
Some((prefix, ns))
diff --git a/components/style/values/specified/source_size_list.rs b/components/style/values/specified/source_size_list.rs
index fd07dc8007f..b27bc2875a6 100644
--- a/components/style/values/specified/source_size_list.rs
+++ b/components/style/values/specified/source_size_list.rs
@@ -4,13 +4,13 @@
//! https://html.spec.whatwg.org/multipage/#source-size-list
-use app_units::Au;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
+use app_units::Au;
use cssparser::{Delimiter, Parser, Token};
use selectors::context::QuirksMode;
use style_traits::ParseError;
@@ -118,7 +118,7 @@ impl SourceSizeList {
return Self {
source_sizes,
value: Some(value),
- }
+ };
},
Ok(SourceSizeOrLength::SourceSize(source_size)) => {
source_sizes.push(source_size);
diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs
index 4733864f7bd..3a5663c4bfd 100644
--- a/components/style/values/specified/text.rs
+++ b/components/style/values/specified/text.rs
@@ -91,8 +91,7 @@ impl Parse for LineHeight {
match ident {
ref ident if ident.eq_ignore_ascii_case("normal") => Ok(GenericLineHeight::Normal),
#[cfg(feature = "gecko")]
- ref ident if ident.eq_ignore_ascii_case("-moz-block-height") =>
- {
+ ref ident if ident.eq_ignore_ascii_case("-moz-block-height") => {
Ok(GenericLineHeight::MozBlockHeight)
},
ident => {
diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs
index 22ef8053cca..740232f5cbc 100644
--- a/components/style/values/specified/time.rs
+++ b/components/style/values/specified/time.rs
@@ -92,12 +92,10 @@ impl Time {
// ParsingMode::DEFAULT directly.
Ok(&Token::Dimension {
value, ref unit, ..
- })
- if clamping_mode.is_ok(ParsingMode::DEFAULT, value) =>
- {
+ }) if clamping_mode.is_ok(ParsingMode::DEFAULT, value) => {
return Time::parse_dimension(value, unit, /* from_calc = */ false)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
- }
+ },
Ok(&Token::Function(ref name)) if name.eq_ignore_ascii_case("calc") => {},
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(e) => return Err(e.into()),
diff --git a/components/style_derive/cg.rs b/components/style_derive/cg.rs
index ad8d8d26a65..24c33a8e7a7 100644
--- a/components/style_derive/cg.rs
+++ b/components/style_derive/cg.rs
@@ -172,9 +172,7 @@ fn path_to_ident(path: &Path) -> Option<&Ident> {
Path {
leading_colon: None,
ref segments,
- }
- if segments.len() == 1 =>
- {
+ } if segments.len() == 1 => {
if segments[0].arguments.is_empty() {
Some(&segments[0].ident)
} else {
diff --git a/components/style_derive/parse.rs b/components/style_derive/parse.rs
index 74ac5c4d85d..0f68f1df5ff 100644
--- a/components/style_derive/parse.rs
+++ b/components/style_derive/parse.rs
@@ -43,7 +43,7 @@ pub fn derive(input: DeriveInput) -> TokenStream {
saw_condition |= parse_attrs.condition.is_some();
let condition = match parse_attrs.condition {
Some(ref p) => quote! { if #p(context) },
- None => quote!{},
+ None => quote! {},
};
let mut body = quote! {
diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs
index 9984854ea49..09f5997da8a 100644
--- a/components/style_traits/lib.rs
+++ b/components/style_traits/lib.rs
@@ -48,10 +48,7 @@ pub enum DevicePixel {}
/// Represents a mobile style pinch zoom factor.
/// TODO(gw): Once WR supports pinch zoom, use a type directly from webrender_api.
#[derive(Clone, Copy, Debug, PartialEq)]
-#[cfg_attr(
- feature = "servo",
- derive(Deserialize, Serialize, MallocSizeOf)
-)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, MallocSizeOf))]
pub struct PinchZoomFactor(f32);
impl PinchZoomFactor {
diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs
index f9fb5752699..f1aa18412e3 100644
--- a/components/style_traits/viewport.rs
+++ b/components/style_traits/viewport.rs
@@ -28,10 +28,7 @@ define_css_keyword_enum! {
///
/// <https://drafts.csswg.org/css-device-adapt/#viewport-desc>
#[derive(Clone, Debug, PartialEq)]
-#[cfg_attr(
- feature = "servo",
- derive(Deserialize, Serialize, MallocSizeOf)
-)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, MallocSizeOf))]
pub struct ViewportConstraints {
/// Width and height:
/// * https://drafts.csswg.org/css-device-adapt/#width-desc
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 472bc7ab00e..e67a185c8ae 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -443,7 +443,7 @@ impl Handler {
return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
"Invalid URL",
- ))
+ ));
},
};
@@ -1080,7 +1080,7 @@ impl Handler {
return Err(WebDriverError::new(
ErrorStatus::Timeout,
"Taking screenshot timed out",
- ))
+ ));
},
};
diff --git a/ports/libmlservo/src/lib.rs b/ports/libmlservo/src/lib.rs
index e07b855ab40..b930ed1c1f9 100644
--- a/ports/libmlservo/src/lib.rs
+++ b/ports/libmlservo/src/lib.rs
@@ -277,8 +277,8 @@ pub unsafe extern "C" fn move_servo(servo: *mut ServoInstance, x: f32, y: f32) {
ScrollState::TriggerDown(start)
if (start - point).square_length() < DRAG_CUTOFF_SQUARED =>
{
- return
- },
+ return;
+ }
ScrollState::TriggerDown(start) => (
ScrollState::TriggerDragging(start, point),
vec![
diff --git a/ports/libsimpleservo/api/src/gl_glue.rs b/ports/libsimpleservo/api/src/gl_glue.rs
index e4e5176089e..3eb1f087afd 100644
--- a/ports/libsimpleservo/api/src/gl_glue.rs
+++ b/ports/libsimpleservo/api/src/gl_glue.rs
@@ -22,11 +22,7 @@ pub mod egl {
pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(target_os = "android")]
pub type EGLNativeWindowType = *const libc::c_void;
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "openbsd"
- ))]
+ #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
pub type EGLNativeWindowType = *const libc::c_void;
pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
@@ -81,11 +77,7 @@ pub mod egl {
}
}
-#[cfg(any(
- target_os = "windows",
- target_os = "linux",
- target_os = "macos"
-))]
+#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
pub mod gl {
pub fn init() -> Result<crate::gl_glue::ServoGl, &'static str> {
// FIXME: Add an OpenGL version
diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs
index 4319b858d62..fec34752299 100644
--- a/ports/libsimpleservo/capi/src/lib.rs
+++ b/ports/libsimpleservo/capi/src/lib.rs
@@ -105,11 +105,7 @@ pub extern "C" fn init_with_egl(
init(opts, gl, wakeup, readfile, callbacks)
}
-#[cfg(any(
- target_os = "linux",
- target_os = "windows",
- target_os = "macos"
-))]
+#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
#[no_mangle]
pub extern "C" fn init_with_gl(
opts: CInitOptions,
diff --git a/tests/unit/style/parsing/transition_timing_function.rs b/tests/unit/style/parsing/transition_timing_function.rs
index 546607b6b68..1b61bf1795d 100644
--- a/tests/unit/style/parsing/transition_timing_function.rs
+++ b/tests/unit/style/parsing/transition_timing_function.rs
@@ -22,27 +22,21 @@ fn test_cubic_bezier() {
);
// p1x and p2x values must be in range [0, 1]
- assert!(
- parse(
- transition_timing_function::parse,
- "cubic-bezier(-1, 0, 0, 0"
- )
- .is_err()
- );
- assert!(
- parse(
- transition_timing_function::parse,
- "cubic-bezier(0, 0, -1, 0"
- )
- .is_err()
- );
- assert!(
- parse(
- transition_timing_function::parse,
- "cubic-bezier(-1, 0, -1, 0"
- )
- .is_err()
- );
+ assert!(parse(
+ transition_timing_function::parse,
+ "cubic-bezier(-1, 0, 0, 0"
+ )
+ .is_err());
+ assert!(parse(
+ transition_timing_function::parse,
+ "cubic-bezier(0, 0, -1, 0"
+ )
+ .is_err());
+ assert!(parse(
+ transition_timing_function::parse,
+ "cubic-bezier(-1, 0, -1, 0"
+ )
+ .is_err());
assert!(parse(transition_timing_function::parse, "cubic-bezier(2, 0, 0, 0").is_err());
assert!(parse(transition_timing_function::parse, "cubic-bezier(0, 0, 2, 0").is_err());
diff --git a/tests/unit/style/stylist.rs b/tests/unit/style/stylist.rs
index 64973c07b61..ce247229740 100644
--- a/tests/unit/style/stylist.rs
+++ b/tests/unit/style/stylist.rs
@@ -205,12 +205,10 @@ fn test_insert() {
.unwrap()[0]
.source_order
);
- assert!(
- selector_map
- .class_hash
- .get(&Atom::from("intro"), QuirksMode::NoQuirks)
- .is_none()
- );
+ assert!(selector_map
+ .class_hash
+ .get(&Atom::from("intro"), QuirksMode::NoQuirks)
+ .is_none());
}
fn mock_stylist() -> Stylist {