From 9e92eb205a2a12fe0be883e42cb7f82deebc9031 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Tue, 6 Nov 2018 20:38:02 +0100 Subject: [PATCH] Reorder imports --- components/allocator/lib.rs | 4 +- components/atoms/build.rs | 2 +- components/bluetooth/lib.rs | 6 +- components/bluetooth/test.rs | 6 +- components/canvas/canvas_data.rs | 8 ++- components/canvas/gl_context.rs | 10 +-- components/canvas/webgl_mode/inprocess.rs | 4 +- components/canvas/webgl_thread.rs | 2 +- components/canvas_traits/canvas.rs | 2 +- components/canvas_traits/webgl.rs | 16 ++--- components/channel/lib.rs | 2 +- components/compositing/compositor.rs | 20 +++--- components/compositing/compositor_thread.rs | 2 +- components/compositing/lib.rs | 2 +- components/compositing/touch.rs | 4 +- components/compositing/windowing.rs | 2 +- components/config/opts.rs | 2 +- components/config/prefs.rs | 2 +- components/config/tests/opts.rs | 2 +- components/config/tests/prefs.rs | 2 +- components/constellation/constellation.rs | 44 +++++++----- components/constellation/event_loop.rs | 2 +- components/constellation/lib.rs | 4 +- components/constellation/network_listener.rs | 4 +- components/constellation/pipeline.rs | 12 ++-- components/constellation/session_history.rs | 6 +- components/devtools/actors/console.rs | 2 +- components/devtools/actors/device.rs | 2 +- components/devtools/actors/inspector.rs | 2 +- components/devtools/actors/timeline.rs | 2 +- components/devtools/lib.rs | 4 +- components/devtools_traits/lib.rs | 2 +- components/fallible/lib.rs | 2 +- components/gfx/font.rs | 4 +- components/gfx/font_cache_thread.rs | 6 +- components/gfx/font_context.rs | 4 +- .../platform/freetype/android/font_list.rs | 2 +- components/gfx/platform/freetype/font.rs | 6 +- .../gfx/platform/freetype/font_context.rs | 2 +- components/gfx/platform/freetype/font_list.rs | 6 +- .../gfx/platform/freetype/font_template.rs | 2 +- components/gfx/platform/macos/font.rs | 8 ++- .../gfx/platform/macos/font_template.rs | 4 +- components/gfx/platform/windows/font.rs | 4 +- components/gfx/platform/windows/font_list.rs | 4 +- components/gfx/tests/font_context.rs | 10 ++- components/gfx/tests/font_template.rs | 4 +- components/gfx/tests/text_util.rs | 2 +- components/gfx/text/glyph.rs | 2 +- components/gfx/text/shaping/harfbuzz.rs | 20 +++--- components/gfx/text/text_run.rs | 2 +- components/gfx_traits/lib.rs | 2 +- components/hashglobe/src/fake.rs | 4 +- components/hashglobe/src/hash_map.rs | 8 +-- components/hashglobe/src/hash_set.rs | 8 +-- components/hashglobe/src/table.rs | 2 +- components/layout/animation.rs | 4 +- components/layout/block.rs | 22 ++++-- components/layout/construct.rs | 32 ++++++--- components/layout/context.rs | 2 +- components/layout/display_list/background.rs | 2 +- components/layout/display_list/border.rs | 8 +-- components/layout/display_list/builder.rs | 18 ++--- components/layout/display_list/conversions.rs | 2 +- components/layout/display_list/gradient.rs | 4 +- components/layout/display_list/items.rs | 2 +- components/layout/flex.rs | 8 ++- components/layout/flow.rs | 8 +-- components/layout/flow_list.rs | 4 +- components/layout/fragment.rs | 24 ++++--- components/layout/generated_content.rs | 6 +- components/layout/incremental.rs | 2 +- components/layout/inline.rs | 12 ++-- components/layout/layout_debug.rs | 2 +- components/layout/lib.rs | 2 +- components/layout/list_item.rs | 8 ++- components/layout/model.rs | 2 +- components/layout/multicol.rs | 8 +-- components/layout/parallel.rs | 2 +- components/layout/query.rs | 20 +++--- components/layout/sequential.rs | 4 +- components/layout/table.rs | 13 ++-- components/layout/table_row.rs | 4 +- components/layout/table_wrapper.rs | 12 ++-- components/layout/text.rs | 6 +- components/layout/traversal.rs | 6 +- components/layout/wrapper.rs | 2 +- components/layout_thread/dom_wrapper.rs | 40 ++++++----- components/layout_thread/lib.rs | 36 ++++++---- components/layout_traits/lib.rs | 2 +- components/malloc_size_of/lib.rs | 2 +- components/metrics/lib.rs | 4 +- components/net/blob_loader.rs | 4 +- components/net/connector.rs | 6 +- components/net/cookie.rs | 4 +- components/net/cookie_storage.rs | 2 +- components/net/data_loader.rs | 2 +- components/net/fetch/methods.rs | 12 ++-- components/net/filemanager_thread.rs | 6 +- components/net/hsts.rs | 2 +- components/net/http_cache.rs | 12 ++-- components/net/http_loader.rs | 27 +++++--- components/net/image_cache.rs | 6 +- components/net/lib.rs | 2 +- components/net/resource_thread.rs | 16 ++--- components/net/subresource_integrity.rs | 2 +- components/net/tests/data_loader.rs | 2 +- components/net/tests/fetch.rs | 25 ++++--- components/net/tests/filemanager_thread.rs | 4 +- components/net/tests/http_loader.rs | 20 +++--- components/net/tests/main.rs | 8 +-- components/net/tests/subresource_integrity.rs | 2 +- components/net/websocket_loader.rs | 11 +-- components/net_traits/image_cache.rs | 2 +- components/net_traits/lib.rs | 2 +- components/net_traits/response.rs | 2 +- components/profile/heartbeats.rs | 6 +- components/profile/mem.rs | 14 ++-- components/profile/time.rs | 6 +- components/profile_traits/time.rs | 2 +- components/rand/lib.rs | 4 +- components/remutex/lib.rs | 2 +- components/script/clipboard_provider.rs | 2 +- components/script/devtools.rs | 6 +- components/script/document_loader.rs | 4 +- .../script/dom/abstractworkerglobalscope.rs | 2 +- components/script/dom/analysernode.rs | 8 ++- components/script/dom/attr.rs | 4 +- components/script/dom/audiobuffer.rs | 10 +-- .../script/dom/audiobuffersourcenode.rs | 2 +- components/script/dom/audiocontext.rs | 10 ++- components/script/dom/audiodestinationnode.rs | 8 ++- components/script/dom/audiolistener.rs | 4 +- components/script/dom/audionode.rs | 10 ++- components/script/dom/audioparam.rs | 6 +- .../script/dom/audioscheduledsourcenode.rs | 2 +- components/script/dom/baseaudiocontext.rs | 6 +- components/script/dom/bindings/callback.rs | 10 +-- components/script/dom/bindings/constant.rs | 4 +- components/script/dom/bindings/conversions.rs | 16 +++-- components/script/dom/bindings/error.rs | 8 ++- .../script/dom/bindings/htmlconstructor.rs | 2 +- components/script/dom/bindings/inheritance.rs | 2 +- components/script/dom/bindings/interface.rs | 18 +++-- components/script/dom/bindings/iterable.rs | 2 +- components/script/dom/bindings/mozmap.rs | 8 +-- .../script/dom/bindings/proxyhandler.rs | 8 +-- components/script/dom/bindings/refcounted.rs | 2 +- components/script/dom/bindings/reflector.rs | 2 +- components/script/dom/bindings/root.rs | 4 +- components/script/dom/bindings/str.rs | 2 +- .../script/dom/bindings/structuredclone.rs | 14 ++-- components/script/dom/bindings/trace.rs | 34 ++++++---- components/script/dom/bindings/utils.rs | 14 ++-- components/script/dom/bindings/xmlname.rs | 2 +- components/script/dom/biquadfilternode.rs | 10 ++- components/script/dom/blob.rs | 6 +- .../script/dom/bluetoothadvertisingevent.rs | 4 +- .../dom/bluetoothcharacteristicproperties.rs | 5 +- components/script/dom/bluetoothdevice.rs | 4 +- .../script/dom/bluetoothpermissionresult.rs | 12 ++-- .../dom/bluetoothremotegattcharacteristic.rs | 16 ++--- .../dom/bluetoothremotegattdescriptor.rs | 13 ++-- .../script/dom/bluetoothremotegattserver.rs | 4 +- .../script/dom/bluetoothremotegattservice.rs | 2 +- components/script/dom/canvasgradient.rs | 8 ++- components/script/dom/canvaspattern.rs | 2 +- .../script/dom/canvasrenderingcontext2d.rs | 12 ++-- components/script/dom/channelmergernode.rs | 8 ++- components/script/dom/client.rs | 4 +- components/script/dom/compositionevent.rs | 4 +- components/script/dom/crypto.rs | 6 +- components/script/dom/css.rs | 4 +- components/script/dom/cssconditionrule.rs | 2 +- components/script/dom/cssgroupingrule.rs | 2 +- components/script/dom/csskeyframerule.rs | 6 +- components/script/dom/csskeyframesrule.rs | 4 +- components/script/dom/cssmediarule.rs | 2 +- components/script/dom/cssrulelist.rs | 2 +- components/script/dom/cssstyledeclaration.rs | 16 +++-- components/script/dom/cssstylerule.rs | 6 +- components/script/dom/cssstylevalue.rs | 2 +- components/script/dom/csssupportsrule.rs | 4 +- .../script/dom/customelementregistry.rs | 16 +++-- .../script/dom/dedicatedworkerglobalscope.rs | 12 ++-- .../script/dom/dissimilaroriginlocation.rs | 2 +- components/script/dom/document.rs | 43 +++++++----- components/script/dom/documentfragment.rs | 2 +- components/script/dom/domexception.rs | 2 +- components/script/dom/domimplementation.rs | 8 ++- components/script/dom/dommatrix.rs | 8 ++- components/script/dom/dommatrixreadonly.rs | 10 +-- components/script/dom/domparser.rs | 4 +- components/script/dom/dompoint.rs | 4 +- components/script/dom/dompointreadonly.rs | 6 +- components/script/dom/domquad.rs | 2 +- components/script/dom/domrectreadonly.rs | 6 +- components/script/dom/domstringmap.rs | 2 +- components/script/dom/domtokenlist.rs | 2 +- components/script/dom/element.rs | 42 +++++++----- components/script/dom/event.rs | 2 +- components/script/dom/eventsource.rs | 10 +-- components/script/dom/eventtarget.rs | 12 ++-- components/script/dom/file.rs | 2 +- components/script/dom/filelist.rs | 2 +- components/script/dom/filereader.rs | 8 ++- components/script/dom/filereadersync.rs | 6 +- components/script/dom/formdata.rs | 6 +- components/script/dom/gainnode.rs | 8 ++- components/script/dom/gamepad.rs | 4 +- components/script/dom/gamepadbutton.rs | 2 +- components/script/dom/gamepadbuttonlist.rs | 2 +- components/script/dom/gamepadevent.rs | 2 +- components/script/dom/gamepadlist.rs | 2 +- components/script/dom/globalscope.rs | 24 +++---- components/script/dom/headers.rs | 8 ++- components/script/dom/history.rs | 2 +- components/script/dom/htmlanchorelement.rs | 2 +- components/script/dom/htmlareaelement.rs | 2 +- components/script/dom/htmlbaseelement.rs | 2 +- components/script/dom/htmlbodyelement.rs | 8 ++- components/script/dom/htmlbuttonelement.rs | 8 +-- components/script/dom/htmlcanvaselement.rs | 20 ++++-- components/script/dom/htmlcollection.rs | 4 +- components/script/dom/htmldatalistelement.rs | 2 +- components/script/dom/htmldetailselement.rs | 2 +- components/script/dom/htmldialogelement.rs | 2 +- components/script/dom/htmlelement.rs | 6 +- components/script/dom/htmlfieldsetelement.rs | 2 +- components/script/dom/htmlfontelement.rs | 2 +- .../script/dom/htmlformcontrolscollection.rs | 2 +- components/script/dom/htmlformelement.rs | 4 +- components/script/dom/htmlframesetelement.rs | 2 +- components/script/dom/htmlheadelement.rs | 4 +- components/script/dom/htmliframeelement.rs | 10 +-- components/script/dom/htmlimageelement.rs | 18 ++--- components/script/dom/htmlinputelement.rs | 20 ++++-- components/script/dom/htmllabelelement.rs | 2 +- components/script/dom/htmllegendelement.rs | 2 +- components/script/dom/htmllinkelement.rs | 8 ++- components/script/dom/htmlmediaelement.rs | 12 ++-- components/script/dom/htmlmetaelement.rs | 4 +- components/script/dom/htmlmeterelement.rs | 4 +- components/script/dom/htmlobjectelement.rs | 4 +- .../script/dom/htmloptionscollection.rs | 4 +- components/script/dom/htmloutputelement.rs | 2 +- components/script/dom/htmlprogresselement.rs | 4 +- components/script/dom/htmlscriptelement.rs | 10 +-- components/script/dom/htmlselectelement.rs | 6 +- components/script/dom/htmlsourceelement.rs | 2 +- components/script/dom/htmlstyleelement.rs | 6 +- components/script/dom/htmltableelement.rs | 4 +- components/script/dom/htmltablerowelement.rs | 6 +- .../script/dom/htmltablesectionelement.rs | 6 +- components/script/dom/htmltemplateelement.rs | 2 +- components/script/dom/htmltextareaelement.rs | 4 +- components/script/dom/imagedata.rs | 6 +- components/script/dom/location.rs | 2 +- components/script/dom/mediaerror.rs | 2 +- components/script/dom/medialist.rs | 4 +- components/script/dom/mimetypearray.rs | 2 +- components/script/dom/mutationobserver.rs | 4 +- components/script/dom/mutationrecord.rs | 4 +- components/script/dom/namednodemap.rs | 2 +- components/script/dom/navigator.rs | 2 +- components/script/dom/node.rs | 16 ++--- components/script/dom/nodeiterator.rs | 2 +- components/script/dom/nodelist.rs | 2 +- components/script/dom/offlineaudiocontext.rs | 4 +- components/script/dom/oscillatornode.rs | 8 ++- components/script/dom/paintsize.rs | 2 +- .../script/dom/paintworkletglobalscope.rs | 10 +-- components/script/dom/pannernode.rs | 18 +++-- components/script/dom/performance.rs | 6 +- components/script/dom/performanceentry.rs | 2 +- components/script/dom/performanceobserver.rs | 2 +- .../dom/performanceobserverentrylist.rs | 2 +- components/script/dom/performancetiming.rs | 2 +- components/script/dom/permissions.rs | 6 +- components/script/dom/permissionstatus.rs | 4 +- components/script/dom/pluginarray.rs | 2 +- components/script/dom/promise.rs | 10 +-- components/script/dom/promisenativehandler.rs | 2 +- components/script/dom/range.rs | 6 +- components/script/dom/request.rs | 10 +-- components/script/dom/response.rs | 14 ++-- components/script/dom/screen.rs | 2 +- components/script/dom/serviceworker.rs | 10 +-- .../script/dom/serviceworkercontainer.rs | 6 +- .../script/dom/serviceworkerglobalscope.rs | 12 ++-- .../script/dom/serviceworkerregistration.rs | 6 +- .../script/dom/servoparser/async_html.rs | 12 ++-- components/script/dom/servoparser/html.rs | 4 +- components/script/dom/servoparser/mod.rs | 16 +++-- components/script/dom/storage.rs | 4 +- .../script/dom/stylepropertymapreadonly.rs | 2 +- components/script/dom/stylesheet.rs | 2 +- components/script/dom/stylesheetlist.rs | 2 +- components/script/dom/testbinding.rs | 34 +++++++--- components/script/dom/testbindingiterable.rs | 6 +- .../script/dom/testbindingpairiterable.rs | 2 +- components/script/dom/testrunner.rs | 2 +- components/script/dom/testworklet.rs | 2 +- components/script/dom/textcontrol.rs | 2 +- components/script/dom/textdecoder.rs | 6 +- components/script/dom/textencoder.rs | 4 +- components/script/dom/timeranges.rs | 2 +- components/script/dom/touch.rs | 2 +- components/script/dom/touchlist.rs | 2 +- components/script/dom/transitionevent.rs | 4 +- components/script/dom/treewalker.rs | 2 +- components/script/dom/url.rs | 4 +- components/script/dom/urlsearchparams.rs | 2 +- components/script/dom/userscripts.rs | 2 +- components/script/dom/validitystate.rs | 2 +- components/script/dom/vr.rs | 2 +- components/script/dom/vrdisplay.rs | 2 +- .../script/dom/vrdisplaycapabilities.rs | 2 +- components/script/dom/vrdisplayevent.rs | 2 +- components/script/dom/vreyeparameters.rs | 4 +- components/script/dom/vrfieldofview.rs | 2 +- components/script/dom/vrframedata.rs | 4 +- components/script/dom/vrpose.rs | 4 +- components/script/dom/vrstageparameters.rs | 4 +- .../script/dom/webgl2renderingcontext.rs | 4 +- .../ext/angleinstancedarrays.rs | 4 +- .../webgl_extensions/ext/extblendminmax.rs | 4 +- .../ext/extcolorbufferhalffloat.rs | 4 +- .../ext/extshadertexturelod.rs | 6 +- .../ext/exttexturefilteranisotropic.rs | 4 +- .../script/dom/webgl_extensions/ext/mod.rs | 2 +- .../ext/oeselementindexuint.rs | 6 +- .../ext/oesstandardderivatives.rs | 6 +- .../webgl_extensions/ext/oestexturefloat.rs | 6 +- .../ext/oestexturefloatlinear.rs | 4 +- .../ext/oestexturehalffloat.rs | 10 ++- .../ext/oestexturehalffloatlinear.rs | 4 +- .../ext/oesvertexarrayobject.rs | 8 ++- .../ext/webglcolorbufferfloat.rs | 4 +- .../script/dom/webgl_extensions/extension.rs | 2 +- .../script/dom/webgl_extensions/extensions.rs | 4 +- .../script/dom/webgl_extensions/wrapper.rs | 2 +- .../dom/webgl_validations/tex_image_2d.rs | 4 +- components/script/dom/webglactiveinfo.rs | 2 +- components/script/dom/webglbuffer.rs | 4 +- components/script/dom/webglframebuffer.rs | 4 +- components/script/dom/webglprogram.rs | 4 +- components/script/dom/webglrenderbuffer.rs | 6 +- .../script/dom/webglrenderingcontext.rs | 28 +++++--- components/script/dom/webglshader.rs | 8 +-- .../script/dom/webglshaderprecisionformat.rs | 2 +- components/script/dom/webgltexture.rs | 6 +- components/script/dom/webgluniformlocation.rs | 2 +- .../script/dom/webglvertexarrayobjectoes.rs | 6 +- components/script/dom/websocket.rs | 12 ++-- components/script/dom/window.rs | 46 ++++++++----- components/script/dom/windowproxy.rs | 28 ++++---- components/script/dom/worker.rs | 8 ++- components/script/dom/workerglobalscope.rs | 10 +-- components/script/dom/workerlocation.rs | 2 +- components/script/dom/workernavigator.rs | 2 +- components/script/dom/worklet.rs | 16 ++--- components/script/dom/workletglobalscope.rs | 2 +- components/script/dom/xmlhttprequest.rs | 16 ++--- components/script/fetch.rs | 8 +-- components/script/layout_image.rs | 4 +- components/script/network_listener.rs | 2 +- components/script/script_runtime.rs | 20 +++--- components/script/script_thread.rs | 50 ++++++++------ components/script/serviceworker_manager.rs | 6 +- components/script/serviceworkerjob.rs | 2 +- components/script/stylesheet_loader.rs | 14 ++-- components/script/task.rs | 2 +- components/script/task_queue.rs | 2 +- components/script/task_source/file_reading.rs | 4 +- .../script/task_source/history_traversal.rs | 2 +- components/script/test.rs | 4 +- components/script/timers.rs | 2 +- components/script/webdriver_handlers.rs | 12 ++-- components/script_layout_interface/lib.rs | 2 +- components/script_layout_interface/message.rs | 4 +- .../script_layout_interface/reporter.rs | 4 +- components/script_layout_interface/rpc.rs | 2 +- .../script_layout_interface/wrapper_traits.rs | 6 +- .../script_plugins/unrooted_must_root.rs | 6 +- components/script_traits/lib.rs | 20 +++--- components/script_traits/script_msg.rs | 6 +- components/selectors/builder.rs | 2 +- components/selectors/parser.rs | 4 +- components/servo/lib.rs | 14 ++-- components/servo_arc/lib.rs | 4 +- components/style/animation.rs | 6 +- components/style/attr.rs | 4 +- components/style/build_gecko.rs | 8 +-- components/style/context.rs | 4 +- components/style/counter_style/mod.rs | 4 +- components/style/custom_properties.rs | 2 +- components/style/dom.rs | 4 +- components/style/dom_apis.rs | 4 +- components/style/font_face.rs | 10 +-- components/style/font_metrics.rs | 2 +- components/style/gecko/arc_types.rs | 4 +- components/style/gecko/conversions.rs | 16 +++-- components/style/gecko/data.rs | 6 +- components/style/gecko/global_style_data.rs | 2 +- components/style/gecko/media_features.rs | 6 +- components/style/gecko/media_queries.rs | 6 +- components/style/gecko/pseudo_element.rs | 2 +- components/style/gecko/selector_parser.rs | 4 +- components/style/gecko/snapshot.rs | 2 +- components/style/gecko/snapshot_helpers.rs | 2 +- components/style/gecko/url.rs | 4 +- components/style/gecko/values.rs | 22 +++--- components/style/gecko/wrapper.rs | 30 ++++---- .../sugar/ns_css_shadow_array.rs | 4 +- .../sugar/ns_style_auto_array.rs | 2 +- .../gecko_bindings/sugar/ns_style_coord.rs | 6 +- .../style/gecko_bindings/sugar/refptr.rs | 6 +- .../sugar/style_complex_color.rs | 4 +- components/style/gecko_string_cache/mod.rs | 2 +- .../invalidation/element/element_wrapper.rs | 4 +- .../invalidation/element/invalidation_map.rs | 2 +- .../style/invalidation/element/invalidator.rs | 2 +- .../element/state_and_attributes.rs | 6 +- components/style/invalidation/stylesheets.rs | 6 +- components/style/lib.rs | 12 ++-- components/style/logical_geometry.rs | 2 +- components/style/matching.rs | 2 +- .../style/media_queries/media_condition.rs | 2 +- .../style/media_queries/media_feature.rs | 6 +- .../media_queries/media_feature_expression.rs | 12 ++-- components/style/media_queries/media_list.rs | 2 +- components/style/media_queries/media_query.rs | 4 +- components/style/media_queries/mod.rs | 6 +- components/style/rule_tree/mod.rs | 2 +- components/style/selector_map.rs | 4 +- components/style/selector_parser.rs | 2 +- components/style/servo/media_queries.rs | 10 +-- components/style/servo/selector_parser.rs | 6 +- components/style/sharing/mod.rs | 4 +- components/style/style_adjuster.rs | 2 +- components/style/style_resolver.rs | 6 +- .../stylesheets/font_feature_values_rule.rs | 2 +- .../style/stylesheets/keyframes_rule.rs | 8 +-- components/style/stylesheets/mod.rs | 6 +- .../style/stylesheets/namespace_rule.rs | 2 +- components/style/stylesheets/rule_list.rs | 2 +- components/style/stylesheets/rule_parser.rs | 10 +-- .../style/stylesheets/rules_iterator.rs | 2 +- components/style/stylesheets/style_rule.rs | 4 +- components/style/stylesheets/stylesheet.rs | 8 ++- components/style/stylesheets/supports_rule.rs | 2 +- components/style/stylesheets/viewport_rule.rs | 4 +- components/style/stylist.rs | 18 ++--- components/style/traversal.rs | 2 +- components/style/values/animated/effects.rs | 6 +- components/style/values/animated/font.rs | 2 +- components/style/values/animated/length.rs | 4 +- components/style/values/animated/mod.rs | 4 +- components/style/values/animated/svg.rs | 8 +-- components/style/values/computed/angle.rs | 4 +- .../style/values/computed/background.rs | 2 +- .../style/values/computed/basic_shape.rs | 2 +- components/style/values/computed/border.rs | 2 +- components/style/values/computed/box.rs | 6 +- components/style/values/computed/color.rs | 2 +- components/style/values/computed/effects.rs | 6 +- components/style/values/computed/font.rs | 10 +-- components/style/values/computed/image.rs | 10 +-- components/style/values/computed/length.rs | 10 +-- components/style/values/computed/list.rs | 2 +- components/style/values/computed/mod.rs | 68 +++++++++++-------- .../style/values/computed/percentage.rs | 2 +- .../style/values/computed/resolution.rs | 2 +- components/style/values/computed/svg.rs | 6 +- components/style/values/computed/text.rs | 4 +- components/style/values/computed/transform.rs | 2 +- components/style/values/computed/ui.rs | 4 +- components/style/values/computed/url.rs | 4 +- components/style/values/generics/counters.rs | 2 +- components/style/values/generics/grid.rs | 4 +- components/style/values/generics/image.rs | 2 +- components/style/values/generics/mod.rs | 2 +- components/style/values/generics/transform.rs | 2 +- components/style/values/generics/ui.rs | 2 +- components/style/values/mod.rs | 10 +-- components/style/values/specified/angle.rs | 4 +- .../style/values/specified/basic_shape.rs | 4 +- components/style/values/specified/border.rs | 2 +- components/style/values/specified/box.rs | 12 ++-- components/style/values/specified/calc.rs | 8 +-- components/style/values/specified/color.rs | 2 +- components/style/values/specified/counters.rs | 8 +-- components/style/values/specified/easing.rs | 2 +- components/style/values/specified/effects.rs | 10 +-- components/style/values/specified/font.rs | 18 ++--- components/style/values/specified/gecko.rs | 2 +- components/style/values/specified/grid.rs | 2 +- components/style/values/specified/image.rs | 14 ++-- components/style/values/specified/length.rs | 10 +-- components/style/values/specified/list.rs | 4 +- components/style/values/specified/mod.rs | 42 ++++++------ .../style/values/specified/percentage.rs | 6 +- components/style/values/specified/position.rs | 4 +- components/style/values/specified/svg.rs | 6 +- components/style/values/specified/svg_path.rs | 4 +- components/style/values/specified/text.rs | 6 +- components/style/values/specified/time.rs | 6 +- .../style/values/specified/transform.rs | 2 +- components/style/values/specified/ui.rs | 6 +- components/style/values/specified/url.rs | 4 +- components/style_derive/cg.rs | 2 +- .../style_derive/compute_squared_distance.rs | 2 +- components/style_traits/values.rs | 2 +- components/style_traits/viewport.rs | 4 +- components/url/lib.rs | 6 +- components/webdriver_server/lib.rs | 16 +++-- components/webvr/lib.rs | 2 +- components/webvr/webvr_thread.rs | 4 +- components/webvr_traits/lib.rs | 4 +- ports/libmlservo/src/lib.rs | 8 +-- ports/libsimpleservo/src/api.rs | 8 ++- ports/libsimpleservo/src/capi.rs | 2 +- ports/libsimpleservo/src/jniapi.rs | 8 +-- rustfmt.toml | 3 +- tests/unit/metrics/interactive_time.rs | 2 +- tests/unit/script/headers.rs | 2 +- tests/unit/script/htmlimageelement.rs | 2 +- tests/unit/script/textinput.rs | 2 +- tests/unit/style/attr.rs | 2 +- tests/unit/style/custom_properties.rs | 4 +- tests/unit/style/logical_geometry.rs | 4 +- tests/unit/style/parsing/animation.rs | 2 +- tests/unit/style/parsing/background.rs | 8 ++- tests/unit/style/parsing/border.rs | 2 +- tests/unit/style/parsing/inherited_text.rs | 4 +- tests/unit/style/parsing/mod.rs | 2 +- tests/unit/style/parsing/selectors.rs | 2 +- tests/unit/style/properties/mod.rs | 2 +- tests/unit/style/properties/scaffolding.rs | 2 +- tests/unit/style/properties/serialization.rs | 12 ++-- tests/unit/style/rule_tree/bench.rs | 4 +- tests/unit/style/str.rs | 2 +- tests/unit/style/stylesheets.rs | 20 +++--- tests/unit/style/stylist.rs | 4 +- tests/unit/style/viewport.rs | 6 +- 546 files changed, 1964 insertions(+), 1532 deletions(-) diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs index 97b7ac20531f..963ff5f759b3 100644 --- a/components/allocator/lib.rs +++ b/components/allocator/lib.rs @@ -23,7 +23,7 @@ mod platform { /// Memory allocation APIs compatible with libc pub mod libc_compat { - pub use super::ffi::{malloc, realloc, free}; + pub use super::ffi::{free, malloc, realloc}; } pub struct Allocator; @@ -98,8 +98,8 @@ mod platform { mod platform { extern crate kernel32; - pub use std::alloc::System as Allocator; use self::kernel32::{GetProcessHeap, HeapSize, HeapValidate}; + pub use std::alloc::System as Allocator; use std::os::raw::c_void; /// Get the size of a heap block. diff --git a/components/atoms/build.rs b/components/atoms/build.rs index 309e111dbd7a..245440b06e5c 100644 --- a/components/atoms/build.rs +++ b/components/atoms/build.rs @@ -6,7 +6,7 @@ extern crate string_cache_codegen; use std::env; use std::fs::File; -use std::io::{BufReader, BufRead}; +use std::io::{BufRead, BufReader}; use std::path::Path; fn main() { diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 79525820a37e..8d9f7bd0af59 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -16,11 +16,13 @@ extern crate uuid; pub mod test; +use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; +use bluetooth_traits::scanfilter::{ + BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions, +}; use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg}; use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse, GATTType}; use bluetooth_traits::{BluetoothError, BluetoothResponseResult, BluetoothResult}; -use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; -use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions}; use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic}; use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService}; use embedder_traits::{EmbedderMsg, EmbedderProxy}; diff --git a/components/bluetooth/test.rs b/components/bluetooth/test.rs index e0eacc2d8e51..6138bbdb35ee 100644 --- a/components/bluetooth/test.rs +++ b/components/bluetooth/test.rs @@ -4,10 +4,12 @@ use crate::BluetoothManager; use device::bluetooth::{BluetoothAdapter, BluetoothDevice}; -use device::bluetooth::{BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService}; +use device::bluetooth::{ + BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService, +}; use std::borrow::ToOwned; use std::cell::RefCell; -use std::collections::{HashSet, HashMap}; +use std::collections::{HashMap, HashSet}; use std::error::Error; use std::string::String; use uuid::Uuid; diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 31da765f59f4..97e2dee4800f 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -3,14 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use azure::azure::AzFloat; +use azure::azure_hl::SurfacePattern; use azure::azure_hl::{AntialiasMode, CapStyle, CompositionOp, JoinStyle}; -use azure::azure_hl::{BackendType, DrawOptions, DrawTarget, Pattern, StrokeOptions, SurfaceFormat}; +use azure::azure_hl::{ + BackendType, DrawOptions, DrawTarget, Pattern, StrokeOptions, SurfaceFormat, +}; use azure::azure_hl::{Color, ColorPattern, DrawSurfaceOptions, Filter, PathBuilder}; use azure::azure_hl::{ExtendMode, GradientStop, LinearGradientPattern, RadialGradientPattern}; -use azure::azure_hl::SurfacePattern; use canvas_traits::canvas::*; use cssparser::RGBA; -use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D}; +use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use ipc_channel::ipc::IpcSender; use num_traits::ToPrimitive; use pixels; diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs index 916f381a286c..077ea3b7f9f3 100644 --- a/components/canvas/gl_context.rs +++ b/components/canvas/gl_context.rs @@ -2,16 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::webgl::{WebGLCommand, WebGLVersion, WebGLCommandBacktrace}; -use compositing::compositor_thread::{CompositorProxy, self}; +use super::webgl_thread::{GLState, WebGLImpl}; +use canvas_traits::webgl::{WebGLCommand, WebGLCommandBacktrace, WebGLVersion}; +use compositing::compositor_thread::{self, CompositorProxy}; use euclid::Size2D; use gleam::gl; -use offscreen_gl_context::{ColorAttachmentType, GLContext, GLContextAttributes, GLContextDispatcher}; +use offscreen_gl_context::{ + ColorAttachmentType, GLContext, GLContextAttributes, GLContextDispatcher, +}; use offscreen_gl_context::{GLLimits, GLVersion}; use offscreen_gl_context::{NativeGLContext, NativeGLContextHandle, NativeGLContextMethods}; use offscreen_gl_context::{OSMesaContext, OSMesaContextHandle}; use std::sync::{Arc, Mutex}; -use super::webgl_thread::{WebGLImpl, GLState}; /// The GLContextFactory is used to create shared GL contexts with the main thread GL context. /// Currently, shared textures are used to render WebGL textures into the WR compositor. diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index c7b1756aa329..1f7ade4eb56f 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use 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 canvas_traits::webgl::DOMToTextureCommand; -use canvas_traits::webgl::webgl_channel; use crate::gl_context::GLContextFactory; use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread}; use euclid::Size2D; diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index d6d6e98f28e1..e47bfffdbccf 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::gl_context::{GLContextFactory, GLContextWrapper}; use canvas_traits::webgl::*; use euclid::Size2D; use fnv::FnvHashMap; @@ -9,7 +10,6 @@ use gleam::gl; use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods}; use pixels; use std::thread; -use super::gl_context::{GLContextFactory, GLContextWrapper}; use webrender; use webrender_api; diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs index 4acdde707b33..3c28943a8305 100644 --- a/components/canvas_traits/canvas.rs +++ b/components/canvas_traits/canvas.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::RGBA; -use euclid::{Transform2D, Point2D, Rect, Size2D}; +use euclid::{Point2D, Rect, Size2D, Transform2D}; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender}; use serde_bytes::ByteBuf; use std::default::Default; diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index ac9bbb403152..dce9c441e1ca 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -11,18 +11,18 @@ use std::borrow::Cow; use std::num::NonZeroU32; use webrender_api::{DocumentId, ImageKey, PipelineId}; -/// Sender type used in WebGLCommands. -pub use crate::webgl_channel::WebGLSender; -/// Receiver type used in WebGLCommands. -pub use crate::webgl_channel::WebGLReceiver; -/// Result type for send()/recv() calls in in WebGLCommands. -pub use crate::webgl_channel::WebGLSendResult; /// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands. pub use crate::webgl_channel::webgl_channel; -/// Entry point type used in a Script Pipeline to get the WebGLChan to be used in that thread. -pub use crate::webgl_channel::WebGLPipeline; /// Entry point channel type used for sending WebGLMsg messages to the WebGL renderer. pub use crate::webgl_channel::WebGLChan; +/// Entry point type used in a Script Pipeline to get the WebGLChan to be used in that thread. +pub use crate::webgl_channel::WebGLPipeline; +/// Receiver type used in WebGLCommands. +pub use crate::webgl_channel::WebGLReceiver; +/// Result type for send()/recv() calls in in WebGLCommands. +pub use crate::webgl_channel::WebGLSendResult; +/// Sender type used in WebGLCommands. +pub use crate::webgl_channel::WebGLSender; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WebGLCommandBacktrace { diff --git a/components/channel/lib.rs b/components/channel/lib.rs index df1c49a64c85..fd8dc7e5824e 100644 --- a/components/channel/lib.rs +++ b/components/channel/lib.rs @@ -15,8 +15,8 @@ pub use crossbeam_channel::*; use ipc_channel::ipc::IpcReceiver; use ipc_channel::router::ROUTER; use serde::{Deserialize, Serialize}; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; pub fn route_ipc_receiver_to_new_servo_receiver(ipc_receiver: IpcReceiver) -> Receiver where diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index c58fa02cd506..c3974c7fd01d 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -2,15 +2,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::CompositionPipeline; -use crate::SendableFrameTree; use crate::compositor_thread::{CompositorProxy, CompositorReceiver}; use crate::compositor_thread::{InitialCompositorState, Msg}; #[cfg(feature = "gleam")] use crate::gl; -use crate::touch::{TouchHandler, TouchAction}; -use crate::windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods}; -use euclid::{TypedPoint2D, TypedVector2D, TypedScale}; +use crate::touch::{TouchAction, TouchHandler}; +use crate::windowing::{ + self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods, +}; +use crate::CompositionPipeline; +use crate::SendableFrameTree; +use euclid::{TypedPoint2D, TypedScale, TypedVector2D}; use gfx_traits::Epoch; #[cfg(feature = "gleam")] use image::{DynamicImage, ImageFormat}; @@ -20,23 +22,23 @@ use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId}; use net_traits::image::base::Image; #[cfg(feature = "gleam")] use net_traits::image::base::PixelFormat; -use profile_traits::time::{self as profile_time, ProfilerCategory, profile}; +use profile_traits::time::{self as profile_time, profile, ProfilerCategory}; +use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent}; use script_traits::{AnimationState, AnimationTickType, ConstellationMsg, LayoutControlMsg}; use script_traits::{MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId}; use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType}; -use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent}; use servo_channel::Sender; use servo_config::opts; use servo_geometry::DeviceIndependentPixel; use std::collections::HashMap; use std::env; -use std::fs::{File, create_dir_all}; +use std::fs::{create_dir_all, File}; use std::io::Write; use std::num::NonZeroU32; use std::rc::Rc; -use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor}; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; +use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor}; use time::{now, precise_time_ns, precise_time_s}; use webrender; use webrender_api::{self, DeviceIntPoint, DevicePoint, HitTestFlags, HitTestResult}; diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index 3203c7aa2909..a897f141fed6 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -4,8 +4,8 @@ //! Communication with the compositor thread. -use crate::SendableFrameTree; use crate::compositor::CompositingReason; +use crate::SendableFrameTree; use embedder_traits::EventLoopWaker; use gfx_traits::Epoch; use ipc_channel::ipc::IpcSender; diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 8b9e30c0d466..c631f39275ec 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -29,10 +29,10 @@ extern crate time; extern crate webrender; extern crate webrender_api; -pub use crate::compositor_thread::CompositorProxy; pub use crate::compositor::IOCompositor; pub use crate::compositor::RenderNotifier; pub use crate::compositor::ShutdownState; +pub use crate::compositor_thread::CompositorProxy; use euclid::TypedSize2D; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; diff --git a/components/compositing/touch.rs b/components/compositing/touch.rs index 28a2588a91f4..227758ddd113 100644 --- a/components/compositing/touch.rs +++ b/components/compositing/touch.rs @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use euclid::{TypedPoint2D, TypedVector2D}; +use self::TouchState::*; use euclid::TypedScale; +use euclid::{TypedPoint2D, TypedVector2D}; use script_traits::{EventResult, TouchId}; -use self::TouchState::*; use style_traits::DevicePixel; /// Minimum number of `DeviceIndependentPixel` to begin touch scrolling. diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 453517801332..9ff7e9197464 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -17,7 +17,7 @@ use std::fmt::{Debug, Error, Formatter}; #[cfg(feature = "gleam")] use std::rc::Rc; use style_traits::DevicePixel; -use webrender_api::{DeviceIntPoint, DevicePoint, DeviceUintSize, DeviceUintRect, ScrollLocation}; +use webrender_api::{DeviceIntPoint, DevicePoint, DeviceUintRect, DeviceUintSize, ScrollLocation}; #[derive(Clone)] pub enum MouseWindowEvent { diff --git a/components/config/opts.rs b/components/config/opts.rs index 47112e15bee7..96b38a568353 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -19,7 +19,7 @@ use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use std::process; -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; +use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT}; use url::{self, Url}; /// Global flags for Servo, currently set on the command line. diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 9a97bbdca041..5b47a1a51a79 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -11,7 +11,7 @@ use std::borrow::ToOwned; use std::cmp::max; use std::collections::HashMap; use std::fs::File; -use std::io::{Read, Write, stderr}; +use std::io::{stderr, Read, Write}; use std::path::PathBuf; use std::sync::{Arc, RwLock}; diff --git a/components/config/tests/opts.rs b/components/config/tests/opts.rs index e2db853a991c..3e4270748236 100644 --- a/components/config/tests/opts.rs +++ b/components/config/tests/opts.rs @@ -4,7 +4,7 @@ extern crate servo_config; -use servo_config::opts::{parse_url_or_filename, parse_pref_from_command_line}; +use servo_config::opts::{parse_pref_from_command_line, parse_url_or_filename}; use servo_config::prefs::{PrefValue, PREFS}; use std::path::Path; diff --git a/components/config/tests/prefs.rs b/components/config/tests/prefs.rs index 823b03b76c2e..ee3916b7f5ae 100644 --- a/components/config/tests/prefs.rs +++ b/components/config/tests/prefs.rs @@ -5,7 +5,7 @@ extern crate servo_config; use servo_config::basedir; -use servo_config::prefs::{PREFS, PrefValue, read_prefs}; +use servo_config::prefs::{read_prefs, PrefValue, PREFS}; use std::fs::{self, File}; use std::io::{Read, Write}; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 4aef61c6ccac..668aa0aae27b 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -96,49 +96,61 @@ use canvas::webgl_thread::WebGLThreads; use canvas_traits::canvas::CanvasId; use canvas_traits::canvas::CanvasMsg; use clipboard::{ClipboardContext, ClipboardProvider}; -use compositing::SendableFrameTree; use compositing::compositor_thread::CompositorProxy; use compositing::compositor_thread::Msg as ToCompositorMsg; -use crate::browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator}; +use compositing::SendableFrameTree; use crate::browsingcontext::NewBrowsingContextInfo; +use crate::browsingcontext::{ + AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator, +}; use crate::event_loop::EventLoop; use crate::network_listener::NetworkListener; use crate::pipeline::{InitialPipelineState, Pipeline}; -use crate::session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff}; +use crate::session_history::{ + JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff, +}; use crate::timer_scheduler::TimerScheduler; use debugger; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use embedder_traits::{EmbedderMsg, EmbedderProxy}; -use euclid::{Size2D, TypedSize2D, TypedScale}; +use euclid::{Size2D, TypedScale, TypedSize2D}; use gfx::font_cache_thread::FontCacheThread; use gfx_traits::Epoch; -use ipc_channel::{Error as IpcError}; -use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; +use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; +use ipc_channel::Error as IpcError; use keyboard_types::KeyboardEvent; use layout_traits::LayoutThreadFactory; -use log::{Log, Level, LevelFilter, Metadata, Record}; -use msg::constellation_msg::{BrowsingContextId, PipelineId, HistoryStateId, TopLevelBrowsingContextId}; +use log::{Level, LevelFilter, Log, Metadata, Record}; +use msg::constellation_msg::{ + BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId, +}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection}; -use net_traits::{self, IpcSend, FetchResponseMsg, ResourceThreads}; use net_traits::pub_domains::reg_host; use net_traits::request::RequestInit; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; +use net_traits::{self, FetchResponseMsg, IpcSend, ResourceThreads}; use profile_traits::mem; use profile_traits::time; -use script_traits::{AnimationState, AuxiliaryBrowsingContextLoadInfo, AnimationTickType, CompositorEvent}; -use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg, DiscardBrowsingContext}; +use script_traits::{webdriver_msg, LogEntry, ScriptToConstellationChan, ServiceWorkerMsg}; +use script_traits::{ + AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo, CompositorEvent, +}; +use script_traits::{ + ConstellationControlMsg, ConstellationMsg as FromCompositorMsg, DiscardBrowsingContext, +}; use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData}; -use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg}; +use script_traits::{ + IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg, +}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; -use script_traits::{LogEntry, ScriptToConstellationChan, ServiceWorkerMsg, webdriver_msg}; use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg}; use script_traits::{WindowSizeData, WindowSizeType}; use serde::{Deserialize, Serialize}; -use servo_channel::{Receiver, Sender, channel}; +use servo_channel::{channel, Receiver, Sender}; use servo_config::opts; use servo_config::prefs::PREFS; -use servo_rand::{Rng, SeedableRng, ServoRng, random}; +use servo_rand::{random, Rng, SeedableRng, ServoRng}; use servo_remutex::ReentrantMutex; use servo_url::{Host, ImmutableOrigin, ServoUrl}; use std::borrow::ToOwned; @@ -149,9 +161,9 @@ use std::process; use std::rc::{Rc, Weak}; use std::sync::Arc; use std::thread; -use style_traits::CSSPixel; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; +use style_traits::CSSPixel; use webrender_api; use webvr_traits::{WebVREvent, WebVRMsg}; diff --git a/components/constellation/event_loop.rs b/components/constellation/event_loop.rs index 7506e029570a..ac8c06c29974 100644 --- a/components/constellation/event_loop.rs +++ b/components/constellation/event_loop.rs @@ -6,8 +6,8 @@ //! view of a script thread. When an `EventLoop` is dropped, an `ExitScriptThread` //! message is sent to the script thread, asking it to shut down. -use ipc_channel::Error; use ipc_channel::ipc::IpcSender; +use ipc_channel::Error; use script_traits::ConstellationControlMsg; use std::marker::PhantomData; use std::rc::Rc; diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs index c2446ebca4c4..54235a9b09c8 100644 --- a/components/constellation/lib.rs +++ b/components/constellation/lib.rs @@ -53,7 +53,9 @@ mod sandboxing; mod session_history; mod timer_scheduler; -pub use crate::constellation::{Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState}; +pub use crate::constellation::{ + Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState, +}; pub use crate::pipeline::UnprivilegedPipelineContent; #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] pub use crate::sandboxing::content_process_sandbox_profile; diff --git a/components/constellation/network_listener.rs b/components/constellation/network_listener.rs index 71a8e66cb620..a417f5cdeeb7 100644 --- a/components/constellation/network_listener.rs +++ b/components/constellation/network_listener.rs @@ -11,10 +11,10 @@ use ipc_channel::ipc; use ipc_channel::router::ROUTER; use msg::constellation_msg::PipelineId; use net::http_loader::{set_default_accept, set_default_accept_language}; -use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg}; -use net_traits::{IpcSend, NetworkError, ResourceThreads}; use net_traits::request::{Destination, RequestInit}; use net_traits::response::ResponseInit; +use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg}; +use net_traits::{IpcSend, NetworkError, ResourceThreads}; use servo_channel::Sender; pub struct NetworkListener { diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 118403451d6f..881e290164ad 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -4,23 +4,23 @@ use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; +use compositing::compositor_thread::Msg as CompositorMsg; use compositing::CompositionPipeline; use compositing::CompositorProxy; -use compositing::compositor_thread::Msg as CompositorMsg; use crate::event_loop::EventLoop; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; -use euclid::{TypedSize2D, TypedScale}; +use euclid::{TypedScale, TypedSize2D}; use gfx::font_cache_thread::FontCacheThread; -use ipc_channel::Error; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; +use ipc_channel::Error; use layout_traits::LayoutThreadFactory; use metrics::PaintTimeMetrics; -use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespaceId}; use msg::constellation_msg::TopLevelBrowsingContextId; +use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespaceId}; use net::image_cache::ImageCacheImpl; -use net_traits::{IpcSend, ResourceThreads}; use net_traits::image_cache::ImageCache; +use net_traits::{IpcSend, ResourceThreads}; use profile_traits::mem as profile_mem; use profile_traits::time; use script_traits::{ConstellationControlMsg, DiscardBrowsingContext, ScriptToConstellationChan}; @@ -30,7 +30,7 @@ use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders}; use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData}; use servo_channel::Sender; use servo_config::opts::{self, Opts}; -use servo_config::prefs::{PREFS, Pref}; +use servo_config::prefs::{Pref, PREFS}; use servo_url::ServoUrl; use std::collections::{HashMap, HashSet}; #[cfg(not(windows))] diff --git a/components/constellation/session_history.rs b/components/constellation/session_history.rs index 996fe59fc858..ae467432bf81 100644 --- a/components/constellation/session_history.rs +++ b/components/constellation/session_history.rs @@ -3,11 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::browsingcontext::NewBrowsingContextInfo; -use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId}; +use msg::constellation_msg::{ + BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId, +}; use script_traits::LoadData; use servo_url::ServoUrl; -use std::{fmt, mem}; use std::cmp::PartialEq; +use std::{fmt, mem}; /// Represents the joint session history /// https://html.spec.whatwg.org/multipage/#joint-session-history diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 1c7230c95a1b..f2841d86f278 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -10,10 +10,10 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::object::ObjectActor; use crate::protocol::JsonPacketStream; -use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg}; use devtools_traits::CachedConsoleMessage; use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue}; use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue}; +use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; use serde_json::{self, Map, Number, Value}; diff --git a/components/devtools/actors/device.rs b/components/devtools/actors/device.rs index 27823db2ce5b..93f87168d09c 100644 --- a/components/devtools/actors/device.rs +++ b/components/devtools/actors/device.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; -use crate::protocol::{ActorDescription, Method}; use crate::protocol::JsonPacketStream; +use crate::protocol::{ActorDescription, Method}; use serde_json::{Map, Value}; use std::net::TcpStream; diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index a88651efd260..b18e2647f61c 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -7,9 +7,9 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::protocol::JsonPacketStream; -use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, GetRootNode}; use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute}; +use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use ipc_channel::ipc::{self, IpcSender}; use msg::constellation_msg::PipelineId; use serde_json::{self, Map, Value}; diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index d318321e27ec..e1ad44d1ee5b 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -6,9 +6,9 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actors::framerate::FramerateActor; use crate::actors::memory::{MemoryActor, TimelineMemoryReply}; use crate::protocol::JsonPacketStream; -use devtools_traits::{PreciseTime, TimelineMarker, TimelineMarkerType}; use devtools_traits::DevtoolScriptControlMsg; use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers}; +use devtools_traits::{PreciseTime, TimelineMarker, TimelineMarkerType}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::PipelineId; use serde::{Serialize, Serializer}; diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 07c9cc2d8253..be40e70eec6e 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -48,11 +48,11 @@ use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo, LogLevel, Netwo use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use servo_channel::{Receiver, Sender, channel}; +use servo_channel::{channel, Receiver, Sender}; use std::borrow::ToOwned; use std::cell::RefCell; -use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::collections::HashMap; use std::net::{Shutdown, TcpListener, TcpStream}; use std::sync::{Arc, Mutex}; use std::thread; diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs index 9d95adb3d26c..dc0979f580c5 100644 --- a/components/devtools_traits/lib.rs +++ b/components/devtools_traits/lib.rs @@ -24,8 +24,8 @@ extern crate serde; extern crate servo_url; extern crate time; -use http::HeaderMap; use http::method::Method; +use http::HeaderMap; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; use servo_url::ServoUrl; diff --git a/components/fallible/lib.rs b/components/fallible/lib.rs index ae6a40dc789d..f807bc9ce7a6 100644 --- a/components/fallible/lib.rs +++ b/components/fallible/lib.rs @@ -5,9 +5,9 @@ extern crate hashglobe; extern crate smallvec; -use hashglobe::FailedAllocationError; #[cfg(feature = "known_system_malloc")] use hashglobe::alloc; +use hashglobe::FailedAllocationError; use smallvec::Array; use smallvec::SmallVec; use std::vec::Vec; diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 086f8a253f5b..5971d0ed1306 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -9,9 +9,9 @@ use crate::platform::font::{FontHandle, FontTable}; use crate::platform::font_context::FontContextHandle; pub use crate::platform::font_list::fallback_font_families; use crate::platform::font_template::FontTemplateData; -use crate::text::Shaper; use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::shaping::ShaperMethods; +use crate::text::Shaper; use euclid::{Point2D, Rect, Size2D}; use ordered_float::NotNan; use servo_atoms::Atom; @@ -22,8 +22,8 @@ use std::collections::HashMap; use std::iter; use std::rc::Rc; use std::str; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; use std::sync::Arc; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight}; use style::properties::style_structs::Font as FontStyleStruct; use style::values::computed::font::SingleFontFamily; diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index 669544004bbd..77a816db9b95 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -7,22 +7,22 @@ use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; use crate::font_context::FontSource; use crate::font_template::{FontTemplate, FontTemplateDescriptor}; use crate::platform::font_context::FontContextHandle; -use crate::platform::font_list::SANS_SERIF_FONT_FAMILY; use crate::platform::font_list::for_each_available_family; use crate::platform::font_list::for_each_variation; use crate::platform::font_list::system_default_family; +use crate::platform::font_list::SANS_SERIF_FONT_FAMILY; use crate::platform::font_template::FontTemplateData; use fontsan; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; -use net_traits::{CoreResourceThread, FetchResponseMsg, fetch_async}; use net_traits::request::{Destination, RequestInit}; +use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg}; use servo_atoms::Atom; use servo_url::ServoUrl; -use std::{fmt, f32, mem, thread}; use std::borrow::ToOwned; use std::collections::HashMap; use std::ops::Deref; use std::sync::{Arc, Mutex}; +use std::{f32, fmt, mem, thread}; use style::font_face::{EffectiveSources, Source}; use style::values::computed::font::FamilyName; use webrender_api; diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 655f165c38f5..2fc8ee6a1f8b 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use crate::font::{Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef}; +use crate::font::{ + Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef, +}; use crate::font_cache_thread::FontTemplateInfo; use crate::font_template::FontTemplateDescriptor; use crate::platform::font::FontHandle; diff --git a/components/gfx/platform/freetype/android/font_list.rs b/components/gfx/platform/freetype/android/font_list.rs index c156b630db0e..d4b422ef111e 100644 --- a/components/gfx/platform/freetype/android/font_list.rs +++ b/components/gfx/platform/freetype/android/font_list.rs @@ -8,11 +8,11 @@ use std::fs::File; use std::io::{self, Read}; use std::path::Path; use ucd::{Codepoint, UnicodeBlock}; -use xml5ever::Attribute; use xml5ever::driver::parse_document; use xml5ever::rcdom::*; use xml5ever::rcdom::{Node, RcDom}; use xml5ever::tendril::TendrilSink; +use xml5ever::Attribute; lazy_static! { static ref FONT_LIST: FontList = FontList::new(); diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index e0b34ae9be15..ab315b7cc024 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::c_str_to_string; use app_units::Au; use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN}; @@ -9,6 +10,7 @@ use crate::platform::font_context::FontContextHandle; use crate::platform::font_template::FontTemplateData; use crate::text::glyph::GlyphId; use crate::text::util::fixed_to_float; +use freetype::freetype::FT_Sfnt_Tag; use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face}; use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec}; use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name}; @@ -17,18 +19,16 @@ use freetype::freetype::{FT_GlyphSlot, FT_Library, FT_Long, FT_ULong}; use freetype::freetype::{FT_Int32, FT_Kerning_Mode, FT_STYLE_FLAG_ITALIC}; use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size}; use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector}; -use freetype::freetype::FT_Sfnt_Tag; use freetype::succeeded; use freetype::tt_os2::TT_OS2; use servo_atoms::Atom; -use std::{mem, ptr}; use std::ffi::CString; use std::os::raw::{c_char, c_long}; use std::sync::Arc; +use std::{mem, ptr}; use style::computed_values::font_stretch::T as FontStretch; use style::computed_values::font_weight::T as FontWeight; use style::values::computed::font::FontStyle; -use super::c_str_to_string; // This constant is not present in the freetype // bindings due to bindgen not handling the way diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs index dbc8816efc56..2da91cf5008d 100644 --- a/components/gfx/platform/freetype/font_context.rs +++ b/components/gfx/platform/freetype/font_context.rs @@ -10,7 +10,7 @@ use freetype::freetype::FT_MemoryRec_; use freetype::freetype::FT_New_Library; use freetype::succeeded; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -use servo_allocator::libc_compat::{malloc, realloc, free}; +use servo_allocator::libc_compat::{free, malloc, realloc}; use servo_allocator::usable_size; use std::os::raw::{c_long, c_void}; use std::ptr; diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index 71b7e9bc4e06..e285a4eee588 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -2,18 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::c_str_to_string; use crate::text::util::is_cjk; use fontconfig::fontconfig::{FcChar8, FcResultMatch, FcSetSystem}; use fontconfig::fontconfig::{FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute}; use fontconfig::fontconfig::{FcDefaultSubstitute, FcFontMatch, FcNameParse, FcPatternGetString}; use fontconfig::fontconfig::{FcFontSetDestroy, FcMatchPattern, FcPatternCreate, FcPatternDestroy}; -use fontconfig::fontconfig::{FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString}; +use fontconfig::fontconfig::{ + FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString, +}; use fontconfig::fontconfig::{FcObjectSetAdd, FcPatternGetInteger}; use libc; use libc::{c_char, c_int}; use std::ffi::CString; use std::ptr; -use super::c_str_to_string; static FC_FAMILY: &'static [u8] = b"family\0"; static FC_FILE: &'static [u8] = b"file\0"; diff --git a/components/gfx/platform/freetype/font_template.rs b/components/gfx/platform/freetype/font_template.rs index 136f30f73372..90bb5677167c 100644 --- a/components/gfx/platform/freetype/font_template.rs +++ b/components/gfx/platform/freetype/font_template.rs @@ -5,7 +5,7 @@ use servo_atoms::Atom; use std::fmt; use std::fs::File; -use std::io::{Read, Error}; +use std::io::{Error, Read}; use webrender_api::NativeFontHandle; /// Platform specific font representation for Linux. diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index 9e6379db20f9..a27cc2a7c438 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -11,17 +11,19 @@ use core_foundation::string::UniChar; use core_graphics::font::CGGlyph; use core_graphics::geometry::CGRect; use core_text::font::CTFont; -use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors}; use core_text::font_descriptor::kCTFontDefaultOrientation; -use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel}; +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::{fmt, ptr}; use std::ops::Range; use std::sync::Arc; +use std::{fmt, ptr}; use style::values::computed::font::{FontStretch, FontStyle, FontWeight}; const KERN_PAIR_LEN: usize = 6; diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs index 9452266ba93a..ea6bd57e413f 100644 --- a/components/gfx/platform/macos/font_template.rs +++ b/components/gfx/platform/macos/font_template.rs @@ -7,15 +7,15 @@ use core_graphics::data_provider::CGDataProvider; use core_graphics::font::CGFont; use core_text; use core_text::font::CTFont; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::de::{Error, Visitor}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; use servo_atoms::Atom; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::collections::HashMap; use std::fmt; use std::fs::File; -use std::io::{Read, Error as IoError}; +use std::io::{Error as IoError, Read}; use std::ops::Deref; use std::sync::{Arc, Mutex}; use webrender_api::NativeFontHandle; diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs index b0dd1273cf7e..54649fe01ef8 100644 --- a/components/gfx/platform/windows/font.rs +++ b/components/gfx/platform/windows/font.rs @@ -23,8 +23,8 @@ use std::sync::Arc; use style::computed_values::font_stretch::T as StyleFontStretch; use style::computed_values::font_weight::T as StyleFontWeight; use style::values::computed::font::FontStyle as StyleFontStyle; -use style::values::generics::NonNegative; use style::values::generics::font::FontStyle as GenericFontStyle; +use style::values::generics::NonNegative; use style::values::specified::font::FontStretchKeyword; use truetype; @@ -119,7 +119,7 @@ struct FontInfo { impl FontInfo { fn new_from_face(face: &FontFace) -> Result { - use std::cmp::{min, max}; + use std::cmp::{max, min}; use std::io::Cursor; use truetype::{NamingTable, Value, WindowsMetrics}; diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs index 21e47aa76e69..ac58f7c91d4d 100644 --- a/components/gfx/platform/windows/font_list.rs +++ b/components/gfx/platform/windows/font_list.rs @@ -3,11 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::text::util::unicode_plane; -use dwrote::{Font, FontDescriptor, FontCollection}; +use dwrote::{Font, FontCollection, FontDescriptor}; use servo_atoms::Atom; use std::collections::HashMap; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Mutex; -use std::sync::atomic::{Ordering, AtomicUsize}; use ucd::{Codepoint, UnicodeBlock}; lazy_static! { diff --git a/components/gfx/tests/font_context.rs b/components/gfx/tests/font_context.rs index ba9e7afbdb0b..d4dea69597df 100644 --- a/components/gfx/tests/font_context.rs +++ b/components/gfx/tests/font_context.rs @@ -10,8 +10,10 @@ extern crate style; extern crate webrender_api; use app_units::Au; -use gfx::font::{fallback_font_families, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope}; -use gfx::font_cache_thread::{FontTemplates, FontTemplateInfo}; +use gfx::font::{ + fallback_font_families, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope, +}; +use gfx::font_cache_thread::{FontTemplateInfo, FontTemplates}; use gfx::font_context::{FontContext, FontContextHandle, FontSource}; use gfx::font_template::FontTemplateDescriptor; use servo_arc::Arc; @@ -24,7 +26,9 @@ use std::path::PathBuf; use std::rc::Rc; use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps; use style::properties::style_structs::Font as FontStyleStruct; -use style::values::computed::font::{FamilyName, FamilyNameSyntax, FontFamily, FontFamilyList, FontSize}; +use style::values::computed::font::{ + FamilyName, FamilyNameSyntax, FontFamily, FontFamilyList, FontSize, +}; use style::values::computed::font::{FontStretch, FontWeight, SingleFontFamily}; use style::values::generics::font::FontStyle; diff --git a/components/gfx/tests/font_template.rs b/components/gfx/tests/font_template.rs index 6e7fa8aea5aa..8d1935f738d2 100644 --- a/components/gfx/tests/font_template.rs +++ b/components/gfx/tests/font_template.rs @@ -19,10 +19,10 @@ fn test_font_template_descriptor() { use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; - use style::values::computed::Percentage; use style::values::computed::font::{FontStretch, FontWeight}; - use style::values::generics::NonNegative; + use style::values::computed::Percentage; use style::values::generics::font::FontStyle; + use style::values::generics::NonNegative; fn descriptor(filename: &str) -> FontTemplateDescriptor { let mut path: PathBuf = [ diff --git a/components/gfx/tests/text_util.rs b/components/gfx/tests/text_util.rs index 0b8132e9c885..c35a06a2e2f2 100644 --- a/components/gfx/tests/text_util.rs +++ b/components/gfx/tests/text_util.rs @@ -4,7 +4,7 @@ extern crate gfx; -use gfx::text::util::{CompressionMode, transform_text}; +use gfx::text::util::{transform_text, CompressionMode}; #[test] fn test_transform_compress_none() { diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 3f3a92ccb7af..d7029e862254 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -10,9 +10,9 @@ use euclid::Point2D; ))] use packed_simd::u32x4; use range::{self, EachIndex, Range, RangeIndex}; -use std::{fmt, mem, u16}; use std::cmp::{Ordering, PartialOrd}; use std::vec::Vec; +use std::{fmt, mem, u16}; pub use gfx_traits::ByteIndex; diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 343c27c63c94..675c57b4615a 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -5,15 +5,7 @@ #![allow(unsafe_code)] use app_units::Au; -use crate::font::{ShapingFlags, Font, FontTableMethods, FontTableTag, ShapingOptions, KERN}; -use crate::harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; -use crate::harfbuzz::{hb_blob_create, hb_face_create_for_tables}; -use crate::harfbuzz::{hb_buffer_create, hb_font_destroy}; -use crate::harfbuzz::{hb_buffer_get_glyph_infos, hb_shape}; -use crate::harfbuzz::{hb_buffer_set_direction, hb_buffer_set_script}; -use crate::harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t}; -use crate::harfbuzz::{hb_face_t, hb_font_t}; -use crate::harfbuzz::{hb_position_t, hb_tag_t}; +use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN}; use crate::harfbuzz::hb_blob_t; use crate::harfbuzz::hb_bool_t; use crate::harfbuzz::hb_buffer_add_utf8; @@ -32,13 +24,21 @@ use crate::harfbuzz::hb_font_set_ppem; use crate::harfbuzz::hb_font_set_scale; use crate::harfbuzz::hb_glyph_info_t; use crate::harfbuzz::hb_glyph_position_t; +use crate::harfbuzz::{hb_blob_create, hb_face_create_for_tables}; +use crate::harfbuzz::{hb_buffer_create, hb_font_destroy}; +use crate::harfbuzz::{hb_buffer_get_glyph_infos, hb_shape}; +use crate::harfbuzz::{hb_buffer_set_direction, hb_buffer_set_script}; +use crate::harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t}; +use crate::harfbuzz::{hb_face_t, hb_font_t}; +use crate::harfbuzz::{hb_position_t, hb_tag_t}; +use crate::harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; 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 euclid::Point2D; -use std::{char, cmp, ptr}; use std::os::raw::{c_char, c_int, c_uint, c_void}; +use std::{char, cmp, ptr}; const NO_GLYPH: i32 = -1; const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a'); diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index e4871615fa05..40e8aaf24276 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -9,7 +9,7 @@ use crate::platform::font_template::FontTemplateData; use crate::text::glyph::{ByteIndex, GlyphStore}; use range::Range; use std::cell::Cell; -use std::cmp::{Ordering, max}; +use std::cmp::{max, Ordering}; use std::slice::Iter; use std::sync::Arc; use style::str::char_is_whitespace; diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs index 457814abddfb..308c01cd2791 100644 --- a/components/gfx_traits/lib.rs +++ b/components/gfx_traits/lib.rs @@ -17,7 +17,7 @@ extern crate serde; pub mod print_tree; use range::RangeIndex; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; /// A newtype struct for denoting the age of messages; prevents race conditions. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] diff --git a/components/hashglobe/src/fake.rs b/components/hashglobe/src/fake.rs index c5cd9d39bb75..d2cdd549e48d 100644 --- a/components/hashglobe/src/fake.rs +++ b/components/hashglobe/src/fake.rs @@ -20,8 +20,8 @@ use std::fmt; use std::hash::{BuildHasher, Hash}; use std::ops::{Deref, DerefMut}; -pub use std::collections::hash_map::{Entry, RandomState, Iter as MapIter, IterMut as MapIterMut}; -pub use std::collections::hash_set::{Iter as SetIter, IntoIter as SetIntoIter}; +pub use std::collections::hash_map::{Entry, Iter as MapIter, IterMut as MapIterMut, RandomState}; +pub use std::collections::hash_set::{IntoIter as SetIntoIter, Iter as SetIter}; #[derive(Clone)] pub struct HashMap(StdMap); diff --git a/components/hashglobe/src/hash_map.rs b/components/hashglobe/src/hash_map.rs index 57ac9bcc049c..03ade951e1ec 100644 --- a/components/hashglobe/src/hash_map.rs +++ b/components/hashglobe/src/hash_map.rs @@ -15,13 +15,13 @@ use std::borrow::Borrow; use std::cmp::max; use std::fmt::{self, Debug}; #[allow(deprecated)] -use std::hash::{Hash, BuildHasher}; +use std::hash::{BuildHasher, Hash}; use std::iter::FromIterator; use std::mem::{self, replace}; use std::ops::{Deref, Index}; -use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash}; use super::table::BucketState::{Empty, Full}; +use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash}; use FailedAllocationError; @@ -2214,11 +2214,11 @@ fn assert_covariance() { #[cfg(test)] mod test_map { extern crate rand; - use super::HashMap; + use self::rand::{thread_rng, Rng}; use super::Entry::{Occupied, Vacant}; + use super::HashMap; use super::RandomState; use cell::RefCell; - use self::rand::{thread_rng, Rng}; #[test] fn test_zero_capacities() { diff --git a/components/hashglobe/src/hash_set.rs b/components/hashglobe/src/hash_set.rs index 34e657e44fcc..694e01c46eb8 100644 --- a/components/hashglobe/src/hash_set.rs +++ b/components/hashglobe/src/hash_set.rs @@ -10,12 +10,12 @@ use std::borrow::Borrow; use std::fmt; -use std::hash::{Hash, BuildHasher}; +use std::hash::{BuildHasher, Hash}; use std::iter::{Chain, FromIterator}; -use std::ops::{BitOr, BitAnd, BitXor, Sub}; +use std::ops::{BitAnd, BitOr, BitXor, Sub}; -use super::Recover; use super::hash_map::{self, HashMap, Keys, RandomState}; +use super::Recover; // Future Optimization (FIXME!) // ============================= @@ -1258,8 +1258,8 @@ fn assert_covariance() { #[cfg(test)] mod test_set { - use super::HashSet; use super::hash_map::RandomState; + use super::HashSet; #[test] fn test_zero_capacities() { diff --git a/components/hashglobe/src/table.rs b/components/hashglobe/src/table.rs index 0b8b49001e2d..15e3394884ff 100644 --- a/components/hashglobe/src/table.rs +++ b/components/hashglobe/src/table.rs @@ -9,13 +9,13 @@ // except according to those terms. use alloc::{alloc, dealloc}; +use shim::{Shared, Unique}; use std::cmp; use std::hash::{BuildHasher, Hash, Hasher}; use std::marker; use std::mem::{self, align_of, size_of}; use std::ops::{Deref, DerefMut}; use std::ptr; -use shim::{Unique, Shared}; use self::BucketState::*; use FailedAllocationError; diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 9ce47e16d5a6..2a2b49d97156 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -11,10 +11,10 @@ use crate::opaque_node::OpaqueNodeMethods; use fxhash::FxHashMap; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::UntrustedNodeAddress; +use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use servo_channel::Receiver; -use style::animation::{Animation, update_style_for_animation}; +use style::animation::{update_style_for_animation, Animation}; use style::dom::TElement; use style::font_metrics::ServoMetricsProvider; use style::selector_parser::RestyleDamage; diff --git a/components/layout/block.rs b/components/layout/block.rs index 99ca7ada5233..9fbd7434ea9b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -27,18 +27,26 @@ use app_units::{Au, MAX_AU}; use crate::context::LayoutContext; +use crate::display_list::items::DisplayListSection; +use crate::display_list::StackingContextCollectionState; use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags}; -use crate::display_list::StackingContextCollectionState; -use crate::display_list::items::DisplayListSection; use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo}; -use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow}; -use crate::flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags}; +use crate::flow::{ + BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow, +}; +use crate::flow::{ + FlowFlags, FragmentationContext, ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, +}; use crate::flow_list::FlowList; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags}; +use crate::fragment::{ + CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow, +}; use crate::incremental::RelayoutMode; use crate::layout_debug; -use crate::model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto}; +use crate::model::{ + AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto, +}; use crate::sequential; use crate::traversal::PreorderFlowTraversal; use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; @@ -58,8 +66,8 @@ use style::context::SharedStyleContext; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone}; /// Information specific to floated blocks. #[derive(Clone, Serialize)] diff --git a/components/layout/construct.rs b/components/layout/construct.rs index bfa6e8789436..ee0e0ee451ab 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -11,21 +11,28 @@ //! maybe it's an absolute or fixed position thing that hasn't found its containing block yet. //! Construction items bubble up the tree from children to parents until they find their homes. -use crate::ServoArc; use crate::block::BlockFlow; -use crate::context::{LayoutContext, with_thread_local_font_context}; -use crate::data::{LayoutDataFlags, LayoutData}; +use crate::context::{with_thread_local_font_context, LayoutContext}; +use crate::data::{LayoutData, LayoutDataFlags}; use crate::display_list::items::OpaqueNode; use crate::flex::FlexFlow; use crate::floats::FloatKind; use crate::flow::{AbsoluteDescendants, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils}; use crate::flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils}; use crate::flow_ref::FlowRef; -use crate::fragment::{CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo}; -use crate::fragment::{ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo}; -use crate::fragment::{InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo}; -use crate::fragment::{TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult}; -use crate::inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags}; +use crate::fragment::{ + CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo, +}; +use crate::fragment::{ + ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo, +}; +use crate::fragment::{ + InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo, +}; +use crate::fragment::{ + TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult, +}; +use crate::inline::{InlineFlow, InlineFragmentNodeFlags, InlineFragmentNodeInfo}; use crate::linked_list::prepend_from; use crate::list_item::{ListItemFlow, ListStyleTypeContent}; use crate::multicol::{MulticolColumnFlow, MulticolFlow}; @@ -40,15 +47,18 @@ use crate::table_wrapper::TableWrapperFlow; use crate::text::TextRunScanner; use crate::traversal::PostorderNodeMutTraversal; use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers}; -use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data}; -use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; +use crate::ServoArc; +use script_layout_interface::wrapper_traits::{ + PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; +use script_layout_interface::{is_image_data, LayoutElementType, LayoutNodeType}; use servo_config::opts; use servo_url::ServoUrl; use std::collections::LinkedList; use std::marker::PhantomData; use std::mem; -use std::sync::Arc; use std::sync::atomic::Ordering; +use std::sync::Arc; use style::computed_values::caption_side::T as CaptionSide; use style::computed_values::display::T as Display; use style::computed_values::empty_cells::T as EmptyCells; diff --git a/components/layout/context.rs b/components/layout/context.rs index 134a3cedec15..1ab4637cd8ac 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -4,7 +4,7 @@ //! Data needed by the layout thread. -use crate::display_list::items::{WebRenderImageInfo, OpaqueNode}; +use crate::display_list::items::{OpaqueNode, WebRenderImageInfo}; use crate::opaque_node::OpaqueNodeMethods; use fnv::FnvHasher; use gfx::font_cache_thread::FontCacheThread; diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs index 23e519f1c1d6..a8d0cebde12c 100644 --- a/components/layout/display_list/background.rs +++ b/components/layout/display_list/background.rs @@ -13,8 +13,8 @@ use style::computed_values::background_clip::single_value::T as BackgroundClip; use style::computed_values::background_origin::single_value::T as BackgroundOrigin; use style::properties::style_structs::Background; use style::values::computed::{BackgroundSize, LengthOrPercentageOrAuto}; -use style::values::generics::NonNegative; use style::values::generics::background::BackgroundSize as GenericBackgroundSize; +use style::values::generics::NonNegative; use style::values::specified::background::BackgroundRepeatKeyword; use webrender_api::BorderRadius; diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs index f32f5a843997..a70fc2bb452b 100644 --- a/components/layout/display_list/border.rs +++ b/components/layout/display_list/border.rs @@ -9,14 +9,14 @@ use crate::display_list::ToLayout; use euclid::{Rect, SideOffsets2D, Size2D}; use style::computed_values::border_image_outset::T as BorderImageOutset; use style::properties::style_structs::Border; -use style::values::Either; +use style::values::computed::NumberOrPercentage; use style::values::computed::{BorderCornerRadius, BorderImageWidth}; use style::values::computed::{BorderImageSideWidth, LengthOrNumber}; -use style::values::computed::NumberOrPercentage; -use style::values::generics::border::{BorderImageSideWidth as GenericBorderImageSideWidth}; +use style::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth; use style::values::generics::rect::Rect as StyleRect; +use style::values::Either; use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF}; -use webrender_api::{LayoutSize, LayoutSideOffsets, NormalBorder}; +use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder}; /// Computes a border radius size against the containing size. /// diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 2d99900eac21..a57f9292bb1c 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -12,31 +12,31 @@ 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::ToLayout; use crate::display_list::background::{self, get_cyclic}; use crate::display_list::border; use crate::display_list::gradient; -use crate::display_list::items::{BaseDisplayItem, BLUR_INFLATION_FACTOR, ClipScrollNode}; +use crate::display_list::items::{BaseDisplayItem, ClipScrollNode, BLUR_INFLATION_FACTOR}; use crate::display_list::items::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingAndScrolling}; use crate::display_list::items::{ClippingRegion, DisplayItem, DisplayItemMetadata, DisplayList}; -use crate::display_list::items::{DisplayListSection, CommonDisplayItem}; +use crate::display_list::items::{CommonDisplayItem, DisplayListSection}; use crate::display_list::items::{IframeDisplayItem, OpaqueNode}; use crate::display_list::items::{PopAllTextShadowsDisplayItem, PushTextShadowDisplayItem}; use crate::display_list::items::{StackingContext, StackingContextType, StickyFrameData}; use crate::display_list::items::{TextOrientation, WebRenderImageInfo}; +use crate::display_list::ToLayout; use crate::flex::FlexFlow; use crate::flow::{BaseFlow, Flow, FlowFlags}; use crate::flow_ref::FlowRef; -use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo}; use crate::fragment::SpecificFragmentInfo; +use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo}; use crate::inline::{InlineFlow, InlineFragmentNodeFlags}; use crate::list_item::ListItemFlow; use crate::model::MaybeAuto; use crate::table_cell::CollapsedBordersForCell; use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D, Vector2D}; use fnv::FnvHashMap; -use gfx::text::TextRun; use gfx::text::glyph::ByteIndex; +use gfx::text::TextRun; use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId}; use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId}; @@ -56,20 +56,20 @@ use style::computed_values::visibility::T as Visibility; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect}; use style::properties::{style_structs, ComputedValues}; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::{Either, RGBA}; -use style::values::computed::Gradient; use style::values::computed::effects::SimpleShadow; use style::values::computed::image::Image as ComputedImage; +use style::values::computed::Gradient; use style::values::generics::background::BackgroundSize; use style::values::generics::image::{GradientKind, Image, PaintWorklet}; use style::values::generics::ui::Cursor; +use style::values::{Either, RGBA}; +use style_traits::cursor::CursorKind; use style_traits::CSSPixel; use style_traits::ToCss; -use style_traits::cursor::CursorKind; use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF}; use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LayoutRect}; use webrender_api::{LayoutSize, LayoutTransform, LayoutVector2D, LineStyle, NinePatchBorder}; -use webrender_api::{NinePatchBorderSource, NormalBorder, StickyOffsetBounds, ScrollSensitivity}; +use webrender_api::{NinePatchBorderSource, NormalBorder, ScrollSensitivity, StickyOffsetBounds}; fn establishes_containing_block_for_absolute( flags: StackingContextCollectionFlags, diff --git a/components/layout/display_list/conversions.rs b/components/layout/display_list/conversions.rs index a40dadb0eb9b..39c672539153 100644 --- a/components/layout/display_list/conversions.rs +++ b/components/layout/display_list/conversions.rs @@ -7,10 +7,10 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D}; use style::computed_values::image_rendering::T as ImageRendering; use style::computed_values::mix_blend_mode::T as MixBlendMode; use style::computed_values::transform_style::T as TransformStyle; -use style::values::RGBA; use style::values::computed::{BorderStyle, Filter}; use style::values::generics::effects::Filter as GenericFilter; use style::values::specified::border::BorderImageRepeatKeyword; +use style::values::RGBA; use webrender_api as wr; pub trait ToLayout { diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs index 70f53cce0247..5ce61f84615d 100644 --- a/components/layout/display_list/gradient.rs +++ b/components/layout/display_list/gradient.rs @@ -8,11 +8,11 @@ use app_units::Au; use crate::display_list::ToLayout; use euclid::{Point2D, Size2D, Vector2D}; use style::properties::ComputedValues; -use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position}; use style::values::computed::image::{EndingShape, LineDirection}; -use style::values::generics::image::{Circle, Ellipse, ShapeExtent}; +use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position}; use style::values::generics::image::EndingShape as GenericEndingShape; use style::values::generics::image::GradientItem as GenericGradientItem; +use style::values::generics::image::{Circle, Ellipse, ShapeExtent}; use style::values::specified::position::{X, Y}; use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient}; diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs index 0a85e0a290aa..f07099c5b07a 100644 --- a/components/layout/display_list/items.rs +++ b/components/layout/display_list/items.rs @@ -13,8 +13,8 @@ //! low-level drawing primitives. use euclid::{SideOffsets2D, TypedRect, Vector2D}; -use gfx_traits::{self, StackingContextId}; use gfx_traits::print_tree::PrintTree; +use gfx_traits::{self, StackingContextId}; use msg::constellation_msg::PipelineId; use net_traits::image::base::Image; use servo_geometry::MaxRect; diff --git a/components/layout/flex.rs b/components/layout/flex.rs index d8f0f1671988..42cf2c454fe6 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -7,10 +7,10 @@ use app_units::{Au, MAX_AU}; use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag}; use crate::context::LayoutContext; -use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, FlowFlags}; +use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::model::{AdjoiningMargins, CollapsibleMargins}; @@ -27,8 +27,10 @@ use style::computed_values::justify_content::T as JustifyContent; use style::logical_geometry::{Direction, LogicalSize}; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use style::values::computed::flex::FlexBasis; +use style::values::computed::{ + LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone, +}; use style::values::generics::flex::FlexBasis as GenericFlexBasis; /// The size of an axis. May be a specified size, a min/max diff --git a/components/layout/flow.rs b/components/layout/flow.rs index aa6b1b1e79d1..fea1c94f89d0 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -28,8 +28,8 @@ use app_units::Au; use crate::block::{BlockFlow, FormattingContextType}; use crate::context::LayoutContext; -use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::display_list::items::ClippingAndScrolling; +use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::flex::FlexFlow; use crate::floats::{Floats, SpeculatedFloatPlacement}; use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; @@ -46,16 +46,16 @@ use crate::table_colgroup::TableColGroupFlow; use crate::table_row::TableRowFlow; use crate::table_rowgroup::TableRowGroupFlow; use crate::table_wrapper::TableWrapperFlow; -use euclid::{Point2D, Vector2D, Rect, Size2D}; -use gfx_traits::StackingContextId; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use gfx_traits::print_tree::PrintTree; +use gfx_traits::StackingContextId; use serde::ser::{Serialize, SerializeStruct, Serializer}; use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect}; use std::fmt; use std::iter::Zip; use std::slice::IterMut; -use std::sync::Arc; use std::sync::atomic::Ordering; +use std::sync::Arc; use style::computed_values::clear::T as Clear; use style::computed_values::float::T as Float; use style::computed_values::overflow_x::T as StyleOverflow; diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index ca6fffe627be..c24734a5a7d2 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -5,8 +5,8 @@ use crate::flow::{Flow, FlowClass}; use crate::flow_ref::FlowRef; use serde::ser::{Serialize, SerializeSeq, Serializer}; -use serde_json::{Map, Value, to_value}; -use std::collections::{LinkedList, linked_list}; +use serde_json::{to_value, Map, Value}; +use std::collections::{linked_list, LinkedList}; use std::ops::Deref; use std::sync::Arc; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index cb781484e638..37a23807e827 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -5,24 +5,24 @@ //! The `Fragment` type, which represents the leaves of the layout tree. use app_units::Au; -use canvas_traits::canvas::{CanvasMsg, CanvasId}; -use crate::ServoArc; -use crate::context::{LayoutContext, with_thread_local_font_context}; +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; -use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; use crate::flow_ref::FlowRef; -use crate::inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo}; +use crate::inline::{InlineFragmentContext, InlineFragmentNodeFlags, InlineFragmentNodeInfo}; use crate::inline::{InlineMetrics, LineMetrics}; #[cfg(debug_assertions)] use crate::layout_debug; -use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint}; use crate::model::style_length; +use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint}; use crate::text; use crate::text::TextRunScanner; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use euclid::{Point2D, Vector2D, Rect, Size2D}; +use crate::ServoArc; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use gfx; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::{TextRun, TextRunSlice}; @@ -32,15 +32,17 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use range::*; +use script_layout_interface::wrapper_traits::{ + PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource, HTMLMediaData, SVGSVGData}; -use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use serde::ser::{Serialize, SerializeStruct, Serializer}; use servo_url::ServoUrl; -use std::{f32, fmt}; use std::borrow::ToOwned; -use std::cmp::{Ordering, max, min}; +use std::cmp::{max, min, Ordering}; use std::collections::LinkedList; use std::sync::{Arc, Mutex}; +use std::{f32, fmt}; use style::computed_values::border_collapse::T as BorderCollapse; use style::computed_values::box_sizing::T as BoxSizing; use style::computed_values::clear::T as Clear; @@ -59,8 +61,8 @@ use style::properties::ComputedValues; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::str::char_is_whitespace; -use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::counters::ContentItem; +use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::generics::box_::{Perspective, VerticalAlign}; use style::values::generics::transform; use webrender_api::{self, LayoutTransform}; diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index f7a2836e036c..024d51b22fb7 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -8,10 +8,12 @@ //! done in parallel and is therefore a sequential pass that runs on as little of the flow tree //! as possible. -use crate::context::{LayoutContext, with_thread_local_font_context}; +use crate::context::{with_thread_local_font_context, LayoutContext}; use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; -use crate::fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; +use crate::fragment::{ + Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo, +}; use crate::text::TextRunScanner; use crate::traversal::InorderFlowTraversal; use script_layout_interface::wrapper_traits::PseudoElementType; diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index b0b4ec51437b..6734620e5a0c 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::flow::{FlowFlags, Flow, GetBaseFlow}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow}; use style::computed_values::float::T as Float; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 7f52c817dd1c..08a371bac084 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -3,32 +3,32 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::{Au, MIN_AU}; -use crate::ServoArc; use crate::block::AbsoluteAssignBSizesTraversal; use crate::context::{LayoutContext, LayoutFontContext}; -use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding}; -use crate::display_list::StackingContextCollectionState; use crate::display_list::items::OpaqueNode; +use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding}; use crate::floats::{FloatKind, Floats, PlacementInfo}; use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag}; -use crate::flow::{FlowFlags, EarlyAbsolutePositionInfo, GetBaseFlow, OpaqueFlow}; +use crate::flow::{EarlyAbsolutePositionInfo, FlowFlags, GetBaseFlow, OpaqueFlow}; use crate::flow_ref::FlowRef; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; use crate::fragment::FragmentFlags; use crate::fragment::SpecificFragmentInfo; +use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::model::IntrinsicISizesContribution; use crate::text; use crate::traversal::PreorderFlowTraversal; +use crate::ServoArc; use euclid::{Point2D, Size2D}; use gfx::font::FontMetrics; use gfx_traits::print_tree::PrintTree; use range::{Range, RangeIndex}; use script_layout_interface::wrapper_traits::PseudoElementType; -use std::{fmt, i32, isize, mem}; use std::cmp::max; use std::collections::VecDeque; use std::sync::Arc; +use std::{fmt, i32, isize, mem}; use style::computed_values::display::T as Display; use style::computed_values::overflow_x::T as StyleOverflow; use style::computed_values::position::T as Position; diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 88bae7be23ca..dec9d49def54 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -13,7 +13,7 @@ use std::cell::RefCell; use std::fs::File; use std::io::Write; #[cfg(debug_assertions)] -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; thread_local!(static STATE_KEY: RefCell> = RefCell::new(None)); diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 725ad09061fe..b91ee22eba8c 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -87,9 +87,9 @@ pub mod traversal; pub mod wrapper; // For unit tests: +pub use self::data::LayoutData; pub use crate::fragment::Fragment; pub use crate::fragment::SpecificFragmentInfo; -pub use self::data::LayoutData; // We can't use servo_arc for everything in layout, because the Flow stuff uses // weak references. diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 08473cb89efb..cef1487f2f07 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -7,13 +7,15 @@ use app_units::Au; use crate::block::BlockFlow; -use crate::context::{LayoutContext, with_thread_local_font_context}; -use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding}; +use crate::context::{with_thread_local_font_context, LayoutContext}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding}; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, OpaqueFlow}; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo}; use crate::fragment::Overflow; +use crate::fragment::{ + CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo, +}; use crate::generated_content; use crate::inline::InlineFlow; use euclid::Point2D; diff --git a/components/layout/model.rs b/components/layout/model.rs index 0c10159f4809..3fba3e27fba6 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -11,8 +11,8 @@ use std::cmp::{max, min}; use std::fmt; use style::logical_geometry::{LogicalMargin, WritingMode}; use style::properties::ComputedValues; -use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrNone; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; /// A collapsible margin. See CSS 2.1 ยง 8.3.1. #[derive(Clone, Copy, Debug)] diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 79f25482d9e2..71d9befac613 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -5,23 +5,23 @@ //! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/ use app_units::Au; -use crate::ServoArc; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, OpaqueFlow, FragmentationContext, GetBaseFlow}; +use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; +use crate::ServoArc; use euclid::{Point2D, Vector2D}; use gfx_traits::print_tree::PrintTree; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::fmt; use std::sync::Arc; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; -use style::values::Either; use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use style::values::generics::column::ColumnCount; +use style::values::Either; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for MulticolFlow {} diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 1587e9570079..f510851ce922 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -14,7 +14,7 @@ use crate::flow::{Flow, GetBaseFlow}; use crate::flow_ref::FlowRef; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes}; use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal}; -use profile_traits::time::{self, TimerMetadata, profile}; +use profile_traits::time::{self, profile, TimerMetadata}; use rayon; use servo_config::opts; use smallvec::SmallVec; diff --git a/components/layout/query.rs b/components/layout/query.rs index 95623c7a98b8..7a6a85824ed6 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -7,27 +7,29 @@ use app_units::Au; use crate::construct::ConstructionResult; use crate::context::LayoutContext; -use crate::display_list::IndexableText; use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap}; +use crate::display_list::IndexableText; use crate::flow::{Flow, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use crate::inline::InlineFragmentNodeFlags; use crate::opaque_node::OpaqueNodeMethods; use crate::sequential; use crate::wrapper::LayoutNodeLayoutData; -use euclid::{Point2D, Vector2D, Rect, Size2D}; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use script_layout_interface::{LayoutElementType, LayoutNodeType}; -use script_layout_interface::StyleData; +use script_layout_interface::rpc::TextIndexResponse; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollIdResponse}; use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, StyleResponse}; -use script_layout_interface::rpc::TextIndexResponse; -use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; +use script_layout_interface::wrapper_traits::{ + LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; +use script_layout_interface::StyleData; +use script_layout_interface::{LayoutElementType, LayoutNodeType}; use script_traits::LayoutMsg as ConstellationMsg; use script_traits::UntrustedNodeAddress; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::ops::Deref; use std::sync::{Arc, Mutex}; use style::computed_values::display::T as Display; @@ -35,8 +37,8 @@ use style::computed_values::position::T as Position; use style::computed_values::visibility::T as Visibility; use style::context::{StyleContext, ThreadLocalStyleContext}; use style::dom::TElement; -use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection}; -use style::properties::{style_structs, PropertyId, PropertyDeclarationId, LonghandId}; +use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode}; +use style::properties::{style_structs, LonghandId, PropertyDeclarationId, PropertyId}; use style::selector_parser::PseudoElement; use style_traits::ToCss; use webrender_api::ExternalScrollId; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index b35bba206b22..3203dee5e49a 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -8,8 +8,8 @@ use app_units::Au; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::floats::SpeculatedFloatPlacement; -use crate::flow::{Flow, ImmutableFlowUtils, FlowFlags, GetBaseFlow}; -use crate::fragment::{FragmentBorderBoxIterator, CoordinateSystem}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; +use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator}; use crate::generated_content::ResolveGeneratedContent; use crate::incremental::RelayoutMode; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList}; diff --git a/components/layout/table.rs b/components/layout/table.rs index f167f74911e6..4f28b22e6f65 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -9,8 +9,13 @@ use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer}; use crate::block::{ISizeConstraintInput, ISizeConstraintSolution}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; -use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState}; -use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; +use crate::display_list::{ + DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState, +}; +use crate::flow::{ + BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, + OpaqueFlow, +}; use crate::flow_list::{FlowListIterator, MutFlowListIterator}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; @@ -25,11 +30,11 @@ use std::{cmp, fmt}; use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; -use style::properties::ComputedValues; use style::properties::style_structs::Background; +use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::CSSFloat; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableFlow {} diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 15d660098bf7..5b50b48448ef 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -9,7 +9,9 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use crate::flow::{EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; +use crate::flow::{ + EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, +}; use crate::flow_list::MutFlowListIterator; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index cb4a033298ce..ad6bee3b4e30 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -12,13 +12,17 @@ //! Hereafter this document is referred to as INTRINSIC. use app_units::Au; -use crate::block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput}; +use crate::block::{ + AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput, +}; use crate::block::{ISizeConstraintSolution, MarginsMayCollapseFlag}; use crate::context::LayoutContext; -use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{ + BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags, +}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow}; +use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::model::MaybeAuto; use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; @@ -31,8 +35,8 @@ use style::computed_values::{position, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::{LogicalRect, LogicalSize}; use style::properties::ComputedValues; -use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::CSSFloat; #[derive(Clone, Copy, Debug, Serialize)] pub enum TableLayout { diff --git a/components/layout/text.rs b/components/layout/text.rs index 358a386d887c..6ba30eb2cc0d 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -10,7 +10,7 @@ use crate::fragment::{Fragment, ScannedTextFlags}; use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; use crate::inline::{InlineFragmentNodeFlags, InlineFragments}; use crate::linked_list::split_off_head; -use gfx::font::{FontRef, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions}; +use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; @@ -26,11 +26,11 @@ use style::computed_values::text_transform::T as TextTransform; use style::computed_values::white_space::T as WhiteSpace; use style::computed_values::word_break::T as WordBreak; use style::logical_geometry::{LogicalSize, WritingMode}; -use style::properties::ComputedValues; use style::properties::style_structs::Font as FontStyleStruct; +use style::properties::ComputedValues; use style::values::generics::text::LineHeight; use unicode_bidi as bidi; -use unicode_script::{Script, get_script}; +use unicode_script::{get_script, Script}; use xi_unicode::LineBreakLeafIter; /// Returns the concatenated text of a list of unscanned text fragments. diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index c18eeae51122..51888069cacd 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -7,9 +7,9 @@ use crate::construct::FlowConstructor; use crate::context::LayoutContext; use crate::display_list::DisplayListBuildState; -use crate::flow::{FlowFlags, Flow, GetBaseFlow, ImmutableFlowUtils}; -use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; +use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode}; use servo_config::opts; use style::context::{SharedStyleContext, StyleContext}; @@ -17,8 +17,8 @@ use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; -use style::traversal::{DomTraversal, recalc_style_at}; use style::traversal::PerLevelTraversalData; +use style::traversal::{recalc_style_at, DomTraversal}; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 42369c047617..82ffd6be718f 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -32,8 +32,8 @@ use atomic_refcell::{AtomicRef, AtomicRefMut}; use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData}; -use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use script_layout_interface::wrapper_traits::GetLayoutData; +use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use style::dom::{NodeInfo, TNode}; use style::selector_parser::RestyleDamage; use style::values::computed::counters::ContentItem; diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index 4eac43a6a321..21e61d96fff0 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -30,7 +30,7 @@ #![allow(unsafe_code)] -use atomic_refcell::{AtomicRef, AtomicRefMut, AtomicRefCell}; +use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use gfx_traits::ByteIndex; use html5ever::{LocalName, Namespace}; use layout::data::StyleAndLayoutData; @@ -38,19 +38,27 @@ use layout::wrapper::GetRawData; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use range::Range; +use script::layout_exports::NodeFlags; +use script::layout_exports::PendingRestyle; use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use script::layout_exports::{Document, Element, Node, Text}; use script::layout_exports::{LayoutCharacterDataHelpers, LayoutDocumentHelpers}; -use script::layout_exports::{LayoutElementHelpers, LayoutNodeHelpers, LayoutDom, RawLayoutElementHelpers}; -use script::layout_exports::NodeFlags; -use script::layout_exports::PendingRestyle; -use script_layout_interface::{HTMLCanvasData, HTMLMediaData, LayoutNodeType, OpaqueStyleAndLayoutData}; +use script::layout_exports::{ + LayoutDom, LayoutElementHelpers, LayoutNodeHelpers, RawLayoutElementHelpers, +}; +use script_layout_interface::wrapper_traits::{ + DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode, +}; +use script_layout_interface::wrapper_traits::{ + PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; +use script_layout_interface::{ + HTMLCanvasData, HTMLMediaData, LayoutNodeType, OpaqueStyleAndLayoutData, +}; use script_layout_interface::{SVGSVGData, StyleData, TrustedNodeAddress}; -use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode}; -use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; -use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity}; -use selectors::matching::{ElementSelectorFlags, MatchingContext, QuirksMode}; +use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::matching::VisitedHandlingMode; +use selectors::matching::{ElementSelectorFlags, MatchingContext, QuirksMode}; use selectors::sink::Push; use servo_arc::{Arc, ArcBorrow}; use servo_atoms::Atom; @@ -60,9 +68,8 @@ use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::ptr::NonNull; -use std::sync::Arc as StdArc; use std::sync::atomic::Ordering; -use style::CaseSensitivityExt; +use std::sync::Arc as StdArc; use style::applicable_declarations::ApplicableDeclarationBlock; use style::attr::AttrValue; use style::context::SharedStyleContext; @@ -72,11 +79,12 @@ use style::dom::{TDocument, TElement, TNode, TShadowRoot}; use style::element_state::*; use style::font_metrics::ServoMetricsProvider; use style::properties::{ComputedValues, PropertyDeclarationBlock}; -use style::selector_parser::{AttrValue as SelectorAttrValue, NonTSPseudoClass, Lang}; -use style::selector_parser::{PseudoElement, SelectorImpl, extended_filtering}; -use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; +use style::selector_parser::{extended_filtering, PseudoElement, SelectorImpl}; +use style::selector_parser::{AttrValue as SelectorAttrValue, Lang, NonTSPseudoClass}; +use style::shared_lock::{Locked as StyleLocked, SharedRwLock as StyleSharedRwLock}; use style::str::is_whitespace; use style::stylist::CascadeData; +use style::CaseSensitivityExt; pub unsafe fn drop_style_and_layout_data(data: OpaqueStyleAndLayoutData) { let ptr = data.ptr.as_ptr() as *mut StyleData; @@ -664,7 +672,7 @@ impl<'le> ServoLayoutElement<'le> { } pub unsafe fn note_dirty_descendant(&self) { - use ::selectors::Element; + use selectors::Element; let mut current = Some(*self); while let Some(el) = current { @@ -1132,7 +1140,7 @@ where { type Item = ConcreteNode; fn next(&mut self) -> Option { - use ::selectors::Element; + use selectors::Element; match self.parent_node.get_pseudo_element_type() { PseudoElementType::Before | PseudoElementType::After => None, diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index ca5bd40a313e..bf10a7957323 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -55,8 +55,8 @@ extern crate webrender_api; mod dom_wrapper; use app_units::Au; -use crate::dom_wrapper::{ServoLayoutElement, ServoLayoutDocument, ServoLayoutNode}; use crate::dom_wrapper::drop_style_and_layout_data; +use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode}; use embedder_traits::resources::{self, Resource}; use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D}; use fnv::FnvHashMap; @@ -64,28 +64,34 @@ use fxhash::FxHashMap; use gfx::font; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context; -use gfx_traits::{Epoch, node_id_from_scroll_id}; +use gfx_traits::{node_id_from_scroll_id, Epoch}; use histogram::Histogram; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use layout::animation; use layout::construct::ConstructionResult; +use layout::context::malloc_size_of_persistent_local_context; use layout::context::LayoutContext; use layout::context::RegisteredPainter; use layout::context::RegisteredPainters; -use layout::context::malloc_size_of_persistent_local_context; -use layout::display_list::{IndexableText, ToLayout, WebRenderDisplayListConverter}; use layout::display_list::items::{OpaqueNode, WebRenderImageInfo}; +use layout::display_list::{IndexableText, ToLayout, WebRenderDisplayListConverter}; use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils}; use layout::flow_ref::FlowRef; use layout::incremental::{LayoutDamageComputation, RelayoutMode, SpecialRestyleDamage}; use layout::layout_debug; use layout::parallel; -use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request}; +use layout::query::{ + process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData, +}; use layout::query::{process_element_inner_text_query, process_node_geometry_request}; use layout::query::{process_node_scroll_area_request, process_node_scroll_id_request}; -use layout::query::{process_offset_parent_query, process_resolved_style_request, process_style_query}; +use layout::query::{ + process_offset_parent_query, process_resolved_style_request, process_style_query, +}; use layout::sequential; -use layout::traversal::{ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows}; +use layout::traversal::{ + ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows, +}; use layout::wrapper::LayoutNodeLayoutData; use layout_traits::LayoutThreadFactory; use libc::c_void; @@ -96,21 +102,21 @@ use msg::constellation_msg::TopLevelBrowsingContextId; use net_traits::image_cache::{ImageCache, UsePlaceholder}; use parking_lot::RwLock; use profile_traits::mem::{self, Report, ReportKind, ReportsChan}; -use profile_traits::time::{self, TimerMetadata, profile}; +use profile_traits::time::{self, profile, TimerMetadata}; use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; use script_layout_interface::message::{Msg, NewLayoutThreadInfo, NodesFromPointQueryType, Reflow}; -use script_layout_interface::message::{ReflowComplete, QueryMsg, ReflowGoal, ScriptReflow}; -use script_layout_interface::rpc::{LayoutRPC, StyleResponse, OffsetParentResponse}; +use script_layout_interface::message::{QueryMsg, ReflowComplete, ReflowGoal, ScriptReflow}; use script_layout_interface::rpc::TextIndexResponse; +use script_layout_interface::rpc::{LayoutRPC, OffsetParentResponse, StyleResponse}; use script_layout_interface::wrapper_traits::LayoutNode; +use script_traits::Painter; use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::{DrawAPaintImageResult, PaintWorkletError}; use script_traits::{ScrollState, UntrustedNodeAddress}; -use script_traits::Painter; use selectors::Element; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; -use servo_channel::{Receiver, Sender, channel, route_ipc_receiver_to_new_servo_receiver}; +use servo_channel::{channel, route_ipc_receiver_to_new_servo_receiver, Receiver, Sender}; use servo_config::opts; use servo_config::prefs::PREFS; use servo_geometry::MaxRect; @@ -121,8 +127,8 @@ use std::collections::HashMap; use std::mem as std_mem; use std::ops::{Deref, DerefMut}; use std::process; -use std::sync::{Arc, Mutex, MutexGuard}; use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex, MutexGuard}; use std::thread; use style::animation::Animation; use style::context::{QuirksMode, RegisteredSpeculativePainter, RegisteredSpeculativePainters}; @@ -137,7 +143,9 @@ use style::properties::PropertyId; use style::selector_parser::SnapshotMap; use style::servo::restyle_damage::ServoRestyleDamage; use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards}; -use style::stylesheets::{Origin, Stylesheet, DocumentStyleSheet, StylesheetInDocument, UserAgentStylesheets}; +use style::stylesheets::{ + DocumentStyleSheet, Origin, Stylesheet, StylesheetInDocument, UserAgentStylesheets, +}; use style::stylist::Stylist; use style::thread_state::{self, ThreadState}; use style::timer::Timer; diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 646706e77179..9fb431c8e2ec 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -27,8 +27,8 @@ use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; use net_traits::image_cache::ImageCache; use profile_traits::{mem, time}; -use script_traits::{ConstellationControlMsg, LayoutControlMsg}; use script_traits::LayoutMsg as ConstellationMsg; +use script_traits::{ConstellationControlMsg, LayoutControlMsg}; use servo_channel::{Receiver, Sender}; use servo_url::ServoUrl; use std::sync::Arc; diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index 540ff8bffd5d..69dc48ce30d3 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -82,8 +82,8 @@ extern crate xml5ever; use serde_bytes::ByteBuf; use std::hash::{BuildHasher, Hash}; use std::mem::size_of; -use std::ops::{Deref, DerefMut}; use std::ops::Range; +use std::ops::{Deref, DerefMut}; use std::os::raw::c_void; use void::Void; diff --git a/components/metrics/lib.rs b/components/metrics/lib.rs index f0411cb76273..f83a80b9302c 100644 --- a/components/metrics/lib.rs +++ b/components/metrics/lib.rs @@ -16,11 +16,11 @@ extern crate servo_config; extern crate servo_url; extern crate time; -use gfx_traits::{Epoch, DisplayList}; +use gfx_traits::{DisplayList, Epoch}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use profile_traits::time::{ProfilerChan, ProfilerCategory, send_profile_data}; use profile_traits::time::TimerMetadata; +use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan}; use script_traits::{ConstellationControlMsg, LayoutMsg, ProgressiveWebMetricType}; use servo_config::opts; use servo_url::ServoUrl; diff --git a/components/net/blob_loader.rs b/components/net/blob_loader.rs index 94e35ee47828..2afed16ad7f3 100644 --- a/components/net/blob_loader.rs +++ b/components/net/blob_loader.rs @@ -5,13 +5,13 @@ use crate::filemanager_thread::FileManager; use headers_core::HeaderMapExt; use headers_ext::{ContentLength, ContentType}; -use http::HeaderMap; use http::header::{self, HeaderValue}; +use http::HeaderMap; use ipc_channel::ipc; use mime::{self, Mime}; -use net_traits::{http_percent_encode, NetworkError}; use net_traits::blob_url_store::parse_blob_url; use net_traits::filemanager_thread::ReadFileProgress; +use net_traits::{http_percent_encode, NetworkError}; use servo_url::ServoUrl; // TODO: Check on GET diff --git a/components/net/connector.rs b/components/net/connector.rs index e347862d2c98..38693e70e24b 100644 --- a/components/net/connector.rs +++ b/components/net/connector.rs @@ -5,17 +5,17 @@ use crate::hosts::replace_host; use crate::http_loader::Decoder; use flate2::read::GzDecoder; -use hyper::{Body, Client}; use hyper::body::Payload; -use hyper::client::HttpConnector as HyperHttpConnector; use hyper::client::connect::{Connect, Destination}; +use hyper::client::HttpConnector as HyperHttpConnector; use hyper::rt::Future; +use hyper::{Body, Client}; use hyper_openssl::HttpsConnector; use openssl::ssl::{SslConnector, SslConnectorBuilder, SslMethod, SslOptions}; use openssl::x509; use std::io::{Cursor, Read}; -use tokio::prelude::{Async, Stream}; use tokio::prelude::future::Executor; +use tokio::prelude::{Async, Stream}; pub const BUF_SIZE: usize = 32768; diff --git a/components/net/cookie.rs b/components/net/cookie.rs index d7d68196d4a1..5b9089cc1d36 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -7,12 +7,12 @@ use crate::cookie_rs; use hyper_serde::{self, Serde}; -use net_traits::CookieSource; use net_traits::pub_domains::is_pub_domain; +use net_traits::CookieSource; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::net::{Ipv4Addr, Ipv6Addr}; -use time::{Tm, now, at, Duration}; +use time::{at, now, Duration, Tm}; /// A stored cookie that wraps the definition in cookie-rs. This is used to implement /// various behaviours defined in the spec that rely on an associated request URL, diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs index 274af9068a58..7eefb164439f 100644 --- a/components/net/cookie_storage.rs +++ b/components/net/cookie_storage.rs @@ -7,8 +7,8 @@ use crate::cookie::Cookie; use crate::cookie_rs; -use net_traits::CookieSource; use net_traits::pub_domains::reg_suffix; +use net_traits::CookieSource; use servo_url::ServoUrl; use std::cmp::Ordering; use std::collections::HashMap; diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 3cd282bb1ed6..9f0e1627ea3f 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -5,8 +5,8 @@ use base64; use mime::Mime; use servo_url::ServoUrl; -use url::Position; use url::percent_encoding::percent_decode; +use url::Position; pub enum DecodeError { InvalidDataUri, diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index a0ca76ff8027..0ad92f527eff 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -6,7 +6,7 @@ use crate::blob_loader::load_blob_sync; use crate::data_loader::decode; use crate::fetch::cors_cache::CorsCache; use crate::filemanager_thread::FileManager; -use crate::http_loader::{HttpState, determine_request_referrer, http_fetch}; +use crate::http_loader::{determine_request_referrer, http_fetch, HttpState}; use crate::http_loader::{set_default_accept, set_default_accept_language}; use crate::subresource_integrity::is_response_integrity_valid; use devtools_traits::DevtoolsControlMsg; @@ -18,20 +18,20 @@ use hyper::StatusCode; use ipc_channel::ipc::IpcReceiver; use mime::{self, Mime}; use mime_guess::guess_mime_type; -use net_traits::{FetchTaskTarget, NetworkError, ReferrerPolicy}; use net_traits::request::{CredentialsMode, Destination, Referrer, Request, RequestMode}; -use net_traits::request::{ResponseTainting, Origin, Window}; +use net_traits::request::{Origin, ResponseTainting, Window}; use net_traits::response::{Response, ResponseBody, ResponseType}; -use servo_channel::{channel, Sender, Receiver}; +use net_traits::{FetchTaskTarget, NetworkError, ReferrerPolicy}; +use servo_channel::{channel, Receiver, Sender}; use servo_url::ServoUrl; use std::borrow::Cow; use std::fs::File; -use std::io::{BufReader, BufRead, Seek, SeekFrom}; +use std::io::{BufRead, BufReader, Seek, SeekFrom}; use std::mem; use std::ops::Bound; use std::str; -use std::sync::{Arc, Mutex}; use std::sync::atomic::Ordering; +use std::sync::{Arc, Mutex}; use std::thread; lazy_static! { diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs index f1e3b3e61dfd..966f8a21bcb8 100644 --- a/components/net/filemanager_thread.rs +++ b/components/net/filemanager_thread.rs @@ -7,15 +7,17 @@ use ipc_channel::ipc::{self, IpcSender}; use mime_guess::guess_mime_type_opt; use net_traits::blob_url_store::{BlobBuf, BlobURLStoreError}; use net_traits::filemanager_thread::{FileManagerResult, FileManagerThreadMsg, FileOrigin}; -use net_traits::filemanager_thread::{FileManagerThreadError, ReadFileProgress, RelativePos, SelectedFile}; +use net_traits::filemanager_thread::{ + FileManagerThreadError, ReadFileProgress, RelativePos, SelectedFile, +}; use servo_config::prefs::PREFS; use std::collections::HashMap; use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use std::ops::Index; use std::path::{Path, PathBuf}; -use std::sync::{Arc, RwLock}; use std::sync::atomic::{self, AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, RwLock}; use std::thread; use url::Url; use uuid::Uuid; diff --git a/components/net/hsts.rs b/components/net/hsts.rs index bcf6ee02747c..693869af0db2 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use embedder_traits::resources::{self, Resource}; -use net_traits::IncludeSubdomains; use net_traits::pub_domains::reg_suffix; +use net_traits::IncludeSubdomains; use serde_json; use servo_url::ServoUrl; use std::collections::HashMap; diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs index b234389d69bb..ab7f99f1e0e0 100644 --- a/components/net/http_cache.rs +++ b/components/net/http_cache.rs @@ -10,22 +10,24 @@ use crate::fetch::methods::{Data, DoneChannel}; use headers_core::HeaderMapExt; use headers_ext::{CacheControl, ContentRange, Expires, LastModified, Pragma, Range, Vary}; -use http::{header, HeaderMap}; use http::header::HeaderValue; +use http::{header, HeaderMap}; use hyper::{Method, StatusCode}; -use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalSizeOf, MallocUnconditionalShallowSizeOf}; use malloc_size_of::Measurable; -use net_traits::{Metadata, FetchMetadata}; +use malloc_size_of::{ + MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf, MallocUnconditionalSizeOf, +}; use net_traits::request::Request; use net_traits::response::{HttpsState, Response, ResponseBody}; +use net_traits::{FetchMetadata, Metadata}; use servo_arc::Arc; -use servo_channel::{Sender, channel}; +use servo_channel::{channel, Sender}; use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::collections::HashMap; use std::ops::Bound; -use std::sync::Mutex; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Mutex; use std::time::SystemTime; use time; use time::{Duration, Timespec, Tm}; diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 2ca55d4ffa09..8898fdf19241 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -4,38 +4,47 @@ use brotli::Decompressor; use bytes::Bytes; -use crate::connector::{BUF_SIZE, Connector, create_http_client, WrappedBody}; +use crate::connector::{create_http_client, Connector, WrappedBody, BUF_SIZE}; use crate::cookie; use crate::cookie_storage::CookieStorage; use crate::fetch::cors_cache::CorsCache; +use crate::fetch::methods::{ + is_cors_safelisted_method, is_cors_safelisted_request_header, main_fetch, +}; use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target}; -use crate::fetch::methods::{is_cors_safelisted_request_header, is_cors_safelisted_method, main_fetch}; use crate::hsts::HstsList; use crate::http_cache::HttpCache; use crate::resource_thread::AuthCache; -use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest}; +use devtools_traits::{ + ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest, +}; use devtools_traits::{HttpResponse as DevtoolsHttpResponse, NetworkEvent}; use flate2::read::{DeflateDecoder, GzDecoder}; use headers_core::HeaderMapExt; use headers_ext::{AccessControlAllowCredentials, AccessControlAllowHeaders}; -use headers_ext::{AccessControlAllowMethods, AccessControlRequestHeaders, AccessControlRequestMethod, Authorization}; +use headers_ext::{ + AccessControlAllowMethods, AccessControlRequestHeaders, AccessControlRequestMethod, + Authorization, +}; use headers_ext::{AccessControlAllowOrigin, AccessControlMaxAge, Basic}; use headers_ext::{CacheControl, ContentEncoding, ContentLength}; -use headers_ext::{Host, IfModifiedSince, LastModified, Origin as HyperOrigin, Pragma, Referer, UserAgent}; -use http::{HeaderMap, Request as HyperRequest}; +use headers_ext::{ + Host, IfModifiedSince, LastModified, Origin as HyperOrigin, Pragma, Referer, UserAgent, +}; use http::header::{self, HeaderName, HeaderValue}; use http::uri::Authority; -use hyper::{Body, Client, Method, StatusCode, Response as HyperResponse}; +use http::{HeaderMap, Request as HyperRequest}; +use hyper::{Body, Client, Method, Response as HyperResponse, StatusCode}; use hyper_serde::Serde; use log; use mime; use msg::constellation_msg::{HistoryStateId, PipelineId}; -use net_traits::{CookieSource, FetchMetadata, NetworkError, ReferrerPolicy}; use net_traits::quality::{quality_to_value, Quality, QualityItem}; use net_traits::request::{CacheMode, CredentialsMode, Destination, Origin}; use net_traits::request::{RedirectMode, Referrer, Request, RequestMode}; use net_traits::request::{ResponseTainting, ServiceWorkersMode}; use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType}; +use net_traits::{CookieSource, FetchMetadata, NetworkError, ReferrerPolicy}; use openssl::ssl::SslConnectorBuilder; use servo_channel::{channel, Sender}; use servo_url::{ImmutableOrigin, ServoUrl}; @@ -50,7 +59,7 @@ use std::sync::Mutex; use std::sync::RwLock; use std::time::{Duration, SystemTime}; use time::{self, Tm}; -use tokio::prelude::{Future, future, Stream}; +use tokio::prelude::{future, Future, Stream}; use tokio::runtime::Runtime; use uuid; diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs index 4272bdcb6a33..8dc194a10d18 100644 --- a/components/net/image_cache.rs +++ b/components/net/image_cache.rs @@ -4,15 +4,15 @@ use embedder_traits::resources::{self, Resource}; use immeta::load_from_buf; -use net_traits::{FetchMetadata, FetchResponseMsg, NetworkError}; -use net_traits::image::base::{Image, ImageMetadata, PixelFormat, load_from_memory}; +use net_traits::image::base::{load_from_memory, Image, ImageMetadata, PixelFormat}; use net_traits::image_cache::{CanRequestImages, ImageCache, ImageResponder}; use net_traits::image_cache::{ImageOrMetadataAvailable, ImageResponse, ImageState}; use net_traits::image_cache::{PendingImageId, UsePlaceholder}; +use net_traits::{FetchMetadata, FetchResponseMsg, NetworkError}; use pixels; use servo_url::ServoUrl; -use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::collections::HashMap; use std::io; use std::mem; use std::sync::{Arc, Mutex}; diff --git a/components/net/lib.rs b/components/net/lib.rs index 9fbb9415ab6b..e4373edee33c 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -76,6 +76,6 @@ pub mod fetch { /// A module for re-exports of items used in unit tests. pub mod test { + pub use crate::hosts::{parse_hostsfile, replace_host_table}; pub use crate::http_loader::HttpState; - pub use crate::hosts::{replace_host_table, parse_hostsfile}; } diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 6c4cc78479ac..9793fcb862da 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -8,28 +8,28 @@ use crate::cookie; use crate::cookie_rs; use crate::cookie_storage::CookieStorage; use crate::fetch::cors_cache::CorsCache; -use crate::fetch::methods::{CancellationListener, FetchContext, fetch}; +use crate::fetch::methods::{fetch, CancellationListener, FetchContext}; use crate::filemanager_thread::FileManager; use crate::hsts::HstsList; use crate::http_cache::HttpCache; -use crate::http_loader::{HANDLE, HttpState, http_redirect_fetch}; +use crate::http_loader::{http_redirect_fetch, HttpState, HANDLE}; use crate::storage_thread::StorageThreadFactory; use crate::websocket_loader; use devtools_traits::DevtoolsControlMsg; -use embedder_traits::EmbedderProxy; use embedder_traits::resources::{self, Resource}; +use embedder_traits::EmbedderProxy; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcReceiver, IpcReceiverSet, IpcSender}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -use net_traits::{CookieSource, CoreResourceThread}; -use net_traits::{CoreResourceMsg, CustomResponseMediator, FetchChannels}; -use net_traits::{FetchResponseMsg, ResourceThreads, WebSocketDomAction}; -use net_traits::WebSocketNetworkEvent; use net_traits::request::{Request, RequestInit}; use net_traits::response::{Response, ResponseInit}; use net_traits::storage_thread::StorageThreadMsg; -use profile_traits::mem::{Report, ReportsChan, ReportKind}; +use net_traits::WebSocketNetworkEvent; +use net_traits::{CookieSource, CoreResourceThread}; +use net_traits::{CoreResourceMsg, CustomResponseMediator, FetchChannels}; +use net_traits::{FetchResponseMsg, ResourceThreads, WebSocketDomAction}; use profile_traits::mem::ProfilerChan as MemProfilerChan; +use profile_traits::mem::{Report, ReportKind, ReportsChan}; use profile_traits::time::ProfilerChan; use serde::{Deserialize, Serialize}; use serde_json; diff --git a/components/net/subresource_integrity.rs b/components/net/subresource_integrity.rs index 6abeb39149c1..de90fea93389 100644 --- a/components/net/subresource_integrity.rs +++ b/components/net/subresource_integrity.rs @@ -4,7 +4,7 @@ use base64; use net_traits::response::{Response, ResponseBody, ResponseType}; -use openssl::hash::{MessageDigest, hash}; +use openssl::hash::{hash, MessageDigest}; use std::iter::Filter; use std::str::Split; use std::sync::MutexGuard; diff --git a/components/net/tests/data_loader.rs b/components/net/tests/data_loader.rs index 5ab5c68943f1..9996aed73e61 100644 --- a/components/net/tests/data_loader.rs +++ b/components/net/tests/data_loader.rs @@ -7,9 +7,9 @@ use headers_core::HeaderMapExt; use headers_ext::ContentType; use hyper_serde::Serde; use mime::{self, Mime}; -use net_traits::{FetchMetadata, FilteredMetadata, NetworkError}; use net_traits::request::{Origin, Request}; use net_traits::response::ResponseBody; +use net_traits::{FetchMetadata, FilteredMetadata, NetworkError}; use servo_url::ServoUrl; use std::ops::Deref; diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs index a11d068e9cea..2414bb153e9c 100644 --- a/components/net/tests/fetch.rs +++ b/components/net/tests/fetch.rs @@ -2,21 +2,28 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::{DEFAULT_USER_AGENT, new_fetch_context, create_embedder_proxy, fetch, make_server, make_ssl_server}; use crate::fetch_with_context; use crate::fetch_with_cors_cache; use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response}; +use crate::{ + create_embedder_proxy, fetch, make_server, make_ssl_server, new_fetch_context, + DEFAULT_USER_AGENT, +}; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; use headers_core::HeaderMapExt; -use headers_ext::{AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowOrigin}; +use headers_ext::{ + AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowOrigin, +}; use headers_ext::{AccessControlAllowMethods, AccessControlMaxAge}; -use headers_ext::{CacheControl, ContentLength, ContentType, Expires, Host, LastModified, Pragma, UserAgent}; -use http::{Method, StatusCode}; +use headers_ext::{ + CacheControl, ContentLength, ContentType, Expires, Host, LastModified, Pragma, UserAgent, +}; use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::uri::Authority; -use hyper::{Request as HyperRequest, Response as HyperResponse}; +use http::{Method, StatusCode}; use hyper::body::Body; +use hyper::{Request as HyperRequest, Response as HyperResponse}; use mime::{self, Mime}; use msg::constellation_msg::TEST_PIPELINE_ID; use net::connector::create_ssl_connector_builder; @@ -25,20 +32,20 @@ use net::fetch::methods::{CancellationListener, FetchContext}; use net::filemanager_thread::FileManager; use net::hsts::HstsEntry; use net::test::HttpState; +use net_traits::request::{Destination, Origin, RedirectMode, Referrer, Request, RequestMode}; +use net_traits::response::{CacheState, Response, ResponseBody, ResponseType}; use net_traits::IncludeSubdomains; use net_traits::NetworkError; use net_traits::ReferrerPolicy; -use net_traits::request::{Destination, Origin, RedirectMode, Referrer, Request, RequestMode}; -use net_traits::response::{CacheState, Response, ResponseBody, ResponseType}; use servo_channel::{channel, Sender}; use servo_url::{ImmutableOrigin, ServoUrl}; use std::fs::File; use std::io::Read; use std::iter::FromIterator; use std::path::Path; -use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicUsize, Ordering}; -use std::time::{SystemTime, Duration}; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, SystemTime}; // TODO write a struct that impls Handler for storing test values diff --git a/components/net/tests/filemanager_thread.rs b/components/net/tests/filemanager_thread.rs index 35634cad8159..501413267225 100644 --- a/components/net/tests/filemanager_thread.rs +++ b/components/net/tests/filemanager_thread.rs @@ -7,7 +7,9 @@ use embedder_traits::FilterPattern; use ipc_channel::ipc; use net::filemanager_thread::FileManager; use net_traits::blob_url_store::BlobURLStoreError; -use net_traits::filemanager_thread::{FileManagerThreadMsg, FileManagerThreadError, ReadFileProgress}; +use net_traits::filemanager_thread::{ + FileManagerThreadError, FileManagerThreadMsg, ReadFileProgress, +}; use servo_config::prefs::{PrefValue, PREFS}; use std::fs::File; use std::io::Read; diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index ee2c12b99816..bc5112f1f589 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -7,35 +7,37 @@ use crate::fetch; use crate::fetch_with_context; use crate::make_server; use crate::new_fetch_context; -use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent}; use devtools_traits::HttpRequest as DevtoolsHttpRequest; use devtools_traits::HttpResponse as DevtoolsHttpResponse; -use flate2::Compression; +use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, NetworkEvent}; use flate2::write::{DeflateEncoder, GzEncoder}; +use flate2::Compression; use futures::{self, Future, Stream}; use headers_core::HeaderMapExt; -use headers_ext::{Authorization, Basic, AccessControlAllowOrigin, ContentLength, Date, Host, Origin}; +use headers_ext::{ + AccessControlAllowOrigin, Authorization, Basic, ContentLength, Date, Host, Origin, +}; use headers_ext::{StrictTransportSecurity, UserAgent}; -use http::{Method, StatusCode}; use http::header::{self, HeaderMap, HeaderValue}; use http::uri::Authority; -use hyper::{Request as HyperRequest, Response as HyperResponse}; +use http::{Method, StatusCode}; use hyper::body::Body; +use hyper::{Request as HyperRequest, Response as HyperResponse}; use msg::constellation_msg::TEST_PIPELINE_ID; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; use net::resource_thread::AuthCacheEntry; use net::test::replace_host_table; -use net_traits::{CookieSource, NetworkError}; -use net_traits::request::{Request, RequestInit, RequestMode, CredentialsMode, Destination}; +use net_traits::request::{CredentialsMode, Destination, Request, RequestInit, RequestMode}; use net_traits::response::ResponseBody; +use net_traits::{CookieSource, NetworkError}; use servo_channel::{channel, Receiver}; -use servo_url::{ServoUrl, ImmutableOrigin}; +use servo_url::{ImmutableOrigin, ServoUrl}; use std::collections::HashMap; use std::io::Write; use std::str; -use std::sync::{Arc, Mutex, RwLock}; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Mutex, RwLock}; use std::time::Duration; fn mock_origin() -> ImmutableOrigin { diff --git a/components/net/tests/main.rs b/components/net/tests/main.rs index c20c846bf7d1..aa7a6aa9cf64 100644 --- a/components/net/tests/main.rs +++ b/components/net/tests/main.rs @@ -44,21 +44,21 @@ mod resource_thread; mod subresource_integrity; use devtools_traits::DevtoolsControlMsg; -use embedder_traits::{EmbedderProxy, EventLoopWaker}; use embedder_traits::resources::{self, Resource}; +use embedder_traits::{EmbedderProxy, EventLoopWaker}; use futures::{Future, Stream}; -use hyper::{Body, Request as HyperRequest, Response as HyperResponse}; -use hyper::server::Server as HyperServer; use hyper::server::conn::Http; +use hyper::server::Server as HyperServer; use hyper::service::service_fn_ok; +use hyper::{Body, Request as HyperRequest, Response as HyperResponse}; use net::connector::create_ssl_connector_builder; use net::fetch::cors_cache::CorsCache; use net::fetch::methods::{self, CancellationListener, FetchContext}; use net::filemanager_thread::FileManager; use net::test::HttpState; -use net_traits::FetchTaskTarget; use net_traits::request::Request; use net_traits::response::Response; +use net_traits::FetchTaskTarget; use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; use servo_channel::{channel, Sender}; use servo_url::ServoUrl; diff --git a/components/net/tests/subresource_integrity.rs b/components/net/tests/subresource_integrity.rs index 7607fc378b74..3cd5ac2b017c 100644 --- a/components/net/tests/subresource_integrity.rs +++ b/components/net/tests/subresource_integrity.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use net::subresource_integrity::{SriEntry, get_prioritized_hash_function, get_strongest_metadata}; +use net::subresource_integrity::{get_prioritized_hash_function, get_strongest_metadata, SriEntry}; use net::subresource_integrity::{is_response_integrity_valid, parsed_metadata}; use net_traits::response::{Response, ResponseBody}; use servo_url::ServoUrl; diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs index c37555afcb5c..85149c60ec07 100644 --- a/components/net/websocket_loader.rs +++ b/components/net/websocket_loader.rs @@ -12,20 +12,23 @@ use headers_ext::Host; use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::uri::Authority; use ipc_channel::ipc::{IpcReceiver, IpcSender}; +use net_traits::request::{RequestInit, RequestMode}; use net_traits::{CookieSource, MessageData}; use net_traits::{WebSocketDomAction, WebSocketNetworkEvent}; -use net_traits::request::{RequestInit, RequestMode}; use openssl::ssl::SslStream; use servo_config::opts; use servo_url::ServoUrl; use std::fs; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; use std::thread; use url::Url; -use ws::{CloseCode, Factory, Handler, Handshake, Message, Request, Response as WsResponse, Sender, WebSocket}; -use ws::{Error as WebSocketError, ErrorKind as WebSocketErrorKind, Result as WebSocketResult}; use ws::util::TcpStream; +use ws::{ + CloseCode, Factory, Handler, Handshake, Message, Request, Response as WsResponse, Sender, + WebSocket, +}; +use ws::{Error as WebSocketError, ErrorKind as WebSocketErrorKind, Result as WebSocketResult}; /// A client for connecting to a websocket server #[derive(Clone)] diff --git a/components/net_traits/image_cache.rs b/components/net_traits/image_cache.rs index 6cc70ba245a5..6f035187a818 100644 --- a/components/net_traits/image_cache.rs +++ b/components/net_traits/image_cache.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::FetchResponseMsg; use crate::image::base::{Image, ImageMetadata}; +use crate::FetchResponseMsg; use ipc_channel::ipc::IpcSender; use servo_url::ServoUrl; use std::sync::Arc; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index e766bee302c1..9acfe5dfccad 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -45,9 +45,9 @@ use http::{Error as HttpError, HeaderMap}; use hyper::Error as HyperError; use hyper::StatusCode; use hyper_serde::Serde; -use ipc_channel::Error as IpcError; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; +use ipc_channel::Error as IpcError; use mime::Mime; use msg::constellation_msg::HistoryStateId; use servo_url::ServoUrl; diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs index f8d454854ce0..33eebc4eb663 100644 --- a/components/net_traits/response.rs +++ b/components/net_traits/response.rs @@ -11,8 +11,8 @@ use http::{HeaderMap, StatusCode}; use hyper_serde::Serde; use servo_arc::Arc; use servo_url::ServoUrl; -use std::sync::Mutex; use std::sync::atomic::AtomicBool; +use std::sync::Mutex; /// [Response type](https://fetch.spec.whatwg.org/#concept-response-type) #[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)] diff --git a/components/profile/heartbeats.rs b/components/profile/heartbeats.rs index ef95c853fce9..4bdd5fd7527f 100644 --- a/components/profile/heartbeats.rs +++ b/components/profile/heartbeats.rs @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work}; use heartbeats_simple::HeartbeatPow as Heartbeat; use profile_traits::time::ProfilerCategory; -use self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work}; use servo_config::opts; use std::collections::HashMap; use std::env::var_os; @@ -139,12 +139,12 @@ fn log_heartbeat_records(hb: &mut Heartbeat) { } mod synchronized_heartbeat { + use super::log_heartbeat_records; use heartbeats_simple::HeartbeatPow as Heartbeat; use heartbeats_simple::HeartbeatPowContext as HeartbeatContext; use profile_traits::time::ProfilerCategory; use std::collections::HashMap; - use std::sync::atomic::{ATOMIC_BOOL_INIT, AtomicBool, Ordering}; - use super::log_heartbeat_records; + use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT}; static mut HBS: Option<*mut HashMap> = None; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index 14c996540865..8e6a86c59cd8 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -7,8 +7,8 @@ use crate::time::duration_from_seconds; use ipc_channel::ipc::{self, IpcReceiver}; use ipc_channel::router::ROUTER; -use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest}; use profile_traits::mem::ReportsChan; +use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest}; use std::borrow::ToOwned; use std::cmp::Ordering; use std::collections::HashMap; @@ -386,10 +386,11 @@ impl ReportsForest { //--------------------------------------------------------------------------- mod system_reporter { - #[cfg(all(feature = "unstable", not(target_os = "windows")))] - use libc::{c_void, size_t}; + use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR}; #[cfg(target_os = "linux")] use libc::c_int; + #[cfg(all(feature = "unstable", not(target_os = "windows")))] + use libc::{c_void, size_t}; use profile_traits::mem::{Report, ReportKind, ReporterRequest}; #[cfg(all(feature = "unstable", not(target_os = "windows")))] use std::ffi::CString; @@ -397,9 +398,8 @@ mod system_reporter { use std::mem::size_of; #[cfg(all(feature = "unstable", not(target_os = "windows")))] use std::ptr::null_mut; - use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR}; #[cfg(target_os = "macos")] - use task_info::task_basic_info::{virtual_size, resident_size}; + use task_info::task_basic_info::{resident_size, virtual_size}; /// Collects global measurements from the OS and heap allocators. pub fn collect_reports(request: ReporterRequest) { @@ -601,10 +601,10 @@ mod system_reporter { #[cfg(target_os = "linux")] fn resident_segments() -> Vec<(String, usize)> { use regex::Regex; - use std::collections::HashMap; use std::collections::hash_map::Entry; + use std::collections::HashMap; use std::fs::File; - use std::io::{BufReader, BufRead}; + use std::io::{BufRead, BufReader}; // The first line of an entry in /proc//smaps looks just like an entry // in /proc//maps: diff --git a/components/profile/time.rs b/components/profile/time.rs index 75ce0f85fbaa..7cfdbcee14d2 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -12,10 +12,11 @@ use influent::create_client; use influent::measurement::{Measurement, Value}; use ipc_channel::ipc::{self, IpcReceiver}; use profile_traits::energy::{energy_interval_ms, read_energy_uj}; -use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, ProfilerData, TimerMetadata}; +use profile_traits::time::{ + ProfilerCategory, ProfilerChan, ProfilerData, ProfilerMsg, TimerMetadata, +}; use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; use servo_config::opts::OutputOptions; -use std::{f64, thread, u32, u64}; use std::borrow::ToOwned; use std::cmp::Ordering; use std::collections::BTreeMap; @@ -24,6 +25,7 @@ use std::fs::File; use std::io::{self, Write}; use std::path::Path; use std::time::Duration; +use std::{f64, thread, u32, u64}; use tokio; use tokio::prelude::Future; diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs index ec3e5520b3dd..010bb0096827 100644 --- a/components/profile_traits/time.rs +++ b/components/profile_traits/time.rs @@ -4,9 +4,9 @@ extern crate time as std_time; +use self::std_time::precise_time_ns; use crate::energy::read_energy_uj; use ipc_channel::ipc::IpcSender; -use self::std_time::precise_time_ns; use servo_config::opts; use signpost; diff --git a/components/rand/lib.rs b/components/rand/lib.rs index 5a10bf9e3c1e..56c20522b765 100644 --- a/components/rand/lib.rs +++ b/components/rand/lib.rs @@ -19,13 +19,13 @@ extern crate log; extern crate rand; extern crate uuid; -pub use rand::{Rand, Rng, SeedableRng}; #[cfg(target_pointer_width = "64")] use rand::isaac::Isaac64Rng as IsaacWordRng; #[cfg(target_pointer_width = "32")] use rand::isaac::IsaacRng as IsaacWordRng; use rand::os::OsRng; -use rand::reseeding::{ReseedingRng, Reseeder}; +use rand::reseeding::{Reseeder, ReseedingRng}; +pub use rand::{Rand, Rng, SeedableRng}; use std::cell::RefCell; use std::mem; use std::rc::Rc; diff --git a/components/remutex/lib.rs b/components/remutex/lib.rs index 6f8f11ac498d..d47237d0ef6f 100644 --- a/components/remutex/lib.rs +++ b/components/remutex/lib.rs @@ -18,8 +18,8 @@ extern crate log; use std::cell::{Cell, UnsafeCell}; use std::num::NonZeroUsize; use std::ops::Deref; -use std::sync::{LockResult, Mutex, MutexGuard, PoisonError, TryLockError, TryLockResult}; use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{LockResult, Mutex, MutexGuard, PoisonError, TryLockError, TryLockResult}; /// A type for thread ids. diff --git a/components/script/clipboard_provider.rs b/components/script/clipboard_provider.rs index 8b9ce13b582f..9ae2bdaa6ea0 100644 --- a/components/script/clipboard_provider.rs +++ b/components/script/clipboard_provider.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use ipc_channel::ipc::channel; -use script_traits::{ScriptToConstellationChan, ScriptMsg}; +use script_traits::{ScriptMsg, ScriptToConstellationChan}; use std::borrow::ToOwned; pub trait ClipboardProvider { diff --git a/components/script/devtools.rs b/components/script/devtools.rs index feb90a1982f3..ddc5528ecc4f 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; +use crate::dom::bindings::conversions::{jsstring_to_str, ConversionResult, FromJSValConvertible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; @@ -15,13 +15,13 @@ use crate::dom::bindings::str::DOMString; use crate::dom::document::AnimationFrameCallback; use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::window::Window; use crate::script_thread::Documents; +use devtools_traits::TimelineMarkerType; use devtools_traits::{AutoMargins, CachedConsoleMessage, CachedConsoleMessageTypes}; use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError}; use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker}; -use devtools_traits::TimelineMarkerType; use ipc_channel::ipc::IpcSender; use js::jsapi::JSAutoCompartment; use js::jsval::UndefinedValue; diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index efde3f33a3f9..433641961d42 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -10,9 +10,9 @@ use crate::dom::bindings::root::Dom; use crate::dom::document::Document; use crate::fetch::FetchCanceller; use ipc_channel::ipc::IpcSender; -use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseMsg}; -use net_traits::{ResourceThreads, IpcSend}; use net_traits::request::RequestInit; +use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseMsg}; +use net_traits::{IpcSend, ResourceThreads}; use servo_url::ServoUrl; use std::thread; diff --git a/components/script/dom/abstractworkerglobalscope.rs b/components/script/dom/abstractworkerglobalscope.rs index 1ca0fdcacfdb..ab919bd87c4c 100644 --- a/components/script/dom/abstractworkerglobalscope.rs +++ b/components/script/dom/abstractworkerglobalscope.rs @@ -9,7 +9,7 @@ use crate::dom::dedicatedworkerglobalscope::{AutoWorkerReset, DedicatedWorkerScr use crate::dom::globalscope::GlobalScope; use crate::dom::worker::TrustedWorkerAddress; use crate::dom::workerglobalscope::WorkerGlobalScope; -use crate::script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort}; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; use crate::task_queue::{QueuedTaskConversion, TaskQueue}; use devtools_traits::DevtoolScriptControlMsg; use servo_channel::{Receiver, Sender}; diff --git a/components/script/dom/analysernode.rs b/components/script/dom/analysernode.rs index b4c172f98650..cf04bd44fcac 100644 --- a/components/script/dom/analysernode.rs +++ b/components/script/dom/analysernode.rs @@ -5,8 +5,12 @@ use crate::dom::audionode::AudioNode; use crate::dom::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::{self, AnalyserNodeMethods, AnalyserOptions}; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::{ + self, AnalyserNodeMethods, AnalyserOptions, +}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index b90fe33e3470..955b05ebdd95 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::customelementregistry::CallbackReaction; @@ -17,7 +17,7 @@ use crate::dom::window::Window; use crate::script_thread::ScriptThread; use devtools_traits::AttrInfo; use dom_struct::dom_struct; -use html5ever::{Prefix, LocalName, Namespace}; +use html5ever::{LocalName, Namespace, Prefix}; use servo_atoms::Atom; use std::borrow::ToOwned; use std::cell::Ref; diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 92c53da3e9d6..8aa05a35e112 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -4,17 +4,19 @@ use crate::dom::audionode::MAX_CHANNEL_COUNT; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{self, AudioBufferMethods, AudioBufferOptions}; +use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{ + self, AudioBufferMethods, AudioBufferOptions, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use dom_struct::dom_struct; -use js::jsapi::{Heap, JSAutoCompartment, JSContext, JSObject}; use js::jsapi::JS_GetArrayBufferViewBuffer; -use js::rust::CustomAutoRooterGuard; +use js::jsapi::{Heap, JSAutoCompartment, JSContext, JSObject}; use js::rust::wrappers::JS_DetachArrayBuffer; +use js::rust::CustomAutoRooterGuard; use js::typedarray::{CreateWith, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; use std::cell::Ref; diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 7dbe2550b622..09f6e7dadc6e 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -20,7 +20,7 @@ use crate::dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit}; +use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage}; use servo_media::audio::param::ParamType; use std::cell::Cell; use std::f32; diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index af7e63aa83d9..03cdb5161390 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -4,15 +4,19 @@ use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; use crate::dom::bindings::codegen::Bindings::AudioContextBinding; -use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioContextMethods}; -use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextOptions, AudioTimestamp}; +use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{ + AudioContextLatencyCategory, AudioContextMethods, +}; +use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{ + AudioContextOptions, AudioTimestamp, +}; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::promise::Promise; use crate::dom::window::Window; diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs index e2e8905774b3..42336b862aaa 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audiodestinationnode.rs @@ -4,9 +4,13 @@ use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::{self, AudioDestinationNodeMethods}; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::{ + self, AudioDestinationNodeMethods, +}; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/audiolistener.rs b/components/script/dom/audiolistener.rs index ef2be88799d4..f9ad0ff35d01 100644 --- a/components/script/dom/audiolistener.rs +++ b/components/script/dom/audiolistener.rs @@ -6,11 +6,11 @@ use crate::dom::audioparam::AudioParam; use crate::dom::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::{self, AudioListenerMethods}; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::param::{ParamType, ParamDir}; +use servo_media::audio::param::{ParamDir, ParamType}; use std::f32; #[dom_struct] diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index b96dde64a4cf..17aabade2e78 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -4,8 +4,12 @@ use crate::dom::audioparam::AudioParam; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + AudioNodeMethods, AudioNodeOptions, +}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::codegen::InheritTypes::{AudioNodeTypeId, EventTargetTypeId}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; @@ -13,9 +17,9 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::eventtarget::EventTarget; use dom_struct::dom_struct; use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit, ChannelInfo}; use servo_media::audio::node::ChannelCountMode as ServoMediaChannelCountMode; use servo_media::audio::node::ChannelInterpretation as ServoMediaChannelInterpretation; +use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, ChannelInfo}; use std::cell::Cell; // 32 is the minimum required by the spec for createBuffer() and the deprecated diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index d35bac52c44e..659b4dde76dc 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -4,9 +4,11 @@ use crate::dom::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioParamBinding; -use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{AudioParamMethods, AutomationRate}; +use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ + AudioParamMethods, AutomationRate, +}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs index fa094555c1e3..31527fda3de5 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audioscheduledsourcenode.rs @@ -12,8 +12,8 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomObject; use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeInit, AudioScheduledSourceNodeMessage}; use servo_media::audio::node::OnEndedCallback; +use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage}; use std::cell::Cell; #[dom_struct] diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 5958eb14b143..3b9a0a6b1057 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -12,8 +12,10 @@ use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::AnalyserOptions; use crate::dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeErrorCallback; @@ -42,11 +44,11 @@ use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBuffer; -use servo_media::{Backend, ServoMedia}; use servo_media::audio::context::{AudioContext, AudioContextOptions, ProcessingState}; use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions}; use servo_media::audio::decoder::AudioDecoderCallbacks; use servo_media::audio::graph::NodeId; +use servo_media::{Backend, ServoMedia}; use std::cell::Cell; use std::collections::{HashMap, VecDeque}; use std::mem; diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 4db1fdf22cdb..365817dcff19 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -4,19 +4,19 @@ //! Base classes to work with IDL callbacks. -use crate::dom::bindings::error::{Error, Fallible, report_pending_exception}; +use crate::dom::bindings::error::{report_pending_exception, Error, Fallible}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript}; use crate::dom::bindings::utils::AsCCharPtrPtr; use crate::dom::globalscope::GlobalScope; -use js::jsapi::{IsCallable, JSContext, JSObject, AddRawValueRoot}; -use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment, RemoveRawValueRoot}; use js::jsapi::Heap; use js::jsapi::JSAutoCompartment; -use js::jsval::{JSVal, UndefinedValue, ObjectValue}; +use js::jsapi::{AddRawValueRoot, IsCallable, JSContext, JSObject}; +use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment, RemoveRawValueRoot}; +use js::jsval::{JSVal, ObjectValue, UndefinedValue}; +use js::rust::wrappers::{JS_GetProperty, JS_WrapObject}; use js::rust::{MutableHandleObject, Runtime}; -use js::rust::wrappers::{JS_WrapObject, JS_GetProperty}; use std::default::Default; use std::ffi::CString; use std::mem::drop; diff --git a/components/script/dom/bindings/constant.rs b/components/script/dom/bindings/constant.rs index 0329d106132c..4d88d485ee3a 100644 --- a/components/script/dom/bindings/constant.rs +++ b/components/script/dom/bindings/constant.rs @@ -4,11 +4,11 @@ //! WebIDL constants. -use js::jsapi::{JSContext, JSPROP_ENUMERATE, JSPROP_PERMANENT}; use js::jsapi::JSPROP_READONLY; +use js::jsapi::{JSContext, JSPROP_ENUMERATE, JSPROP_PERMANENT}; use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UInt32Value}; -use js::rust::HandleObject; use js::rust::wrappers::JS_DefineProperty; +use js::rust::HandleObject; use libc; /// Representation of an IDL constant. diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index aecaf0c1a04a..a96371aaf061 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -41,22 +41,24 @@ use crate::dom::bindings::str::{ByteString, DOMString, USVString}; use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox}; use crate::dom::bindings::utils::DOMClass; use js; -pub use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; -pub use js::conversions::ConversionBehavior; use js::conversions::latin1_to_string; +pub use js::conversions::ConversionBehavior; +pub use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; use js::error::throw_type_error; +use js::glue::GetProxyReservedSlot; +use js::glue::JS_GetReservedSlot; use js::glue::{IsWrapper, UnwrapObject}; use js::glue::{RUST_JSID_IS_INT, RUST_JSID_TO_INT}; use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_STRING}; -use js::glue::GetProxyReservedSlot; -use js::glue::JS_GetReservedSlot; use js::jsapi::{Heap, JSContext, JSObject, JSString}; -use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength, JS_IsExceptionPending}; +use js::jsapi::{ + JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength, JS_IsExceptionPending, +}; use js::jsapi::{JS_NewStringCopyN, JS_StringHasLatin1Chars}; use js::jsval::{ObjectValue, StringValue, UndefinedValue}; -use js::rust::{HandleId, HandleObject, HandleValue, MutableHandleValue}; -use js::rust::{get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, ToString}; use js::rust::wrappers::{JS_GetProperty, JS_IsArrayObject}; +use js::rust::{get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, ToString}; +use js::rust::{HandleId, HandleObject, HandleValue, MutableHandleValue}; use libc; use num_traits::Float; use servo_config::opts; diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 061e74fb3cc0..bba99606ae7e 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -10,8 +10,10 @@ use backtrace::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; -use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; use crate::dom::bindings::conversions::root_from_object; +use crate::dom::bindings::conversions::{ + ConversionResult, FromJSValConvertible, ToJSValConvertible, +}; use crate::dom::bindings::str::USVString; use crate::dom::domexception::{DOMErrorName, DOMException}; use crate::dom::globalscope::GlobalScope; @@ -20,11 +22,11 @@ use js::jsapi::JSContext; use js::jsapi::JS_ClearPendingException; use js::jsapi::JS_IsExceptionPending; use js::jsval::UndefinedValue; -use js::rust::HandleObject; -use js::rust::MutableHandleValue; use js::rust::wrappers::JS_ErrorFromException; use js::rust::wrappers::JS_GetPendingException; use js::rust::wrappers::JS_SetPendingException; +use js::rust::HandleObject; +use js::rust::MutableHandleValue; use libc::c_uint; use std::slice::from_raw_parts; diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs index 9923ad8716d0..f0f46aabeecf 100644 --- a/components/script/dom/bindings/htmlconstructor.rs +++ b/components/script/dom/bindings/htmlconstructor.rs @@ -77,8 +77,8 @@ use crate::dom::element::{CustomElementState, Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; use crate::dom::window::Window; use crate::script_thread::ScriptThread; -use html5ever::LocalName; use html5ever::interface::QualName; +use html5ever::LocalName; use js::glue::UnwrapObject; use js::jsapi::{CallArgs, CurrentGlobalOrNull}; use js::jsapi::{JSAutoCompartment, JSContext, JSObject}; diff --git a/components/script/dom/bindings/inheritance.rs b/components/script/dom/bindings/inheritance.rs index 5e535a0a0ba1..888e0525fead 100644 --- a/components/script/dom/bindings/inheritance.rs +++ b/components/script/dom/bindings/inheritance.rs @@ -6,8 +6,8 @@ pub use crate::dom::bindings::codegen::InheritTypes::*; -use crate::dom::bindings::conversions::{DerivedFrom, IDLInterface}; use crate::dom::bindings::conversions::get_dom_class; +use crate::dom::bindings::conversions::{DerivedFrom, IDLInterface}; use crate::dom::bindings::reflector::DomObject; use std::mem; diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index e390eb547426..5389fabd07df 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -9,28 +9,32 @@ use crate::dom::bindings::codegen::PrototypeList; use crate::dom::bindings::constant::{define_constants, ConstantSpec}; use crate::dom::bindings::conversions::{get_dom_class, DOM_OBJECT_SLOT}; use crate::dom::bindings::guard::Guard; -use crate::dom::bindings::utils::{get_proto_or_iface_array, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT}; +use crate::dom::bindings::utils::{ + get_proto_or_iface_array, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT, +}; use js::error::throw_type_error; use js::glue::{UncheckedUnwrapObject, RUST_SYMBOL_TO_JSID}; +use js::jsapi::HandleObject as RawHandleObject; +use js::jsapi::MutableHandleValue as RawMutableHandleValue; use js::jsapi::{Class, ClassOps, CompartmentOptions}; use js::jsapi::{GetGlobalForObjectCrossCompartment, GetWellKnownSymbol}; -use js::jsapi::{JSAutoCompartment, JSClass, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR}; -use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING}; +use js::jsapi::{ + JSAutoCompartment, JSClass, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR, +}; use js::jsapi::{JSPropertySpec, JSString, JSTracer, JS_AtomizeAndPinString}; use js::jsapi::{JS_GetFunctionObject, JS_NewFunction, JS_NewGlobalObject}; use js::jsapi::{JS_NewObject, JS_NewPlainObject}; use js::jsapi::{JS_NewStringCopyN, JS_SetReservedSlot}; use js::jsapi::{ObjectOps, OnNewGlobalHookOption, SymbolCode}; use js::jsapi::{TrueHandleValue, Value}; -use js::jsapi::HandleObject as RawHandleObject; -use js::jsapi::MutableHandleValue as RawMutableHandleValue; +use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING}; use js::jsval::{JSVal, PrivateValue}; -use js::rust::{HandleObject, HandleValue, MutableHandleObject}; -use js::rust::{define_methods, define_properties, get_object_class}; use js::rust::wrappers::{JS_DefineProperty, JS_DefineProperty2}; use js::rust::wrappers::{JS_DefineProperty3, JS_DefineProperty4, JS_DefinePropertyById4}; use js::rust::wrappers::{JS_FireOnNewGlobalObject, JS_GetPrototype}; use js::rust::wrappers::{JS_LinkConstructorAndPrototype, JS_NewObjectWithUniqueType}; +use js::rust::{define_methods, define_properties, get_object_class}; +use js::rust::{HandleObject, HandleValue, MutableHandleObject}; use libc; use std::convert::TryFrom; use std::ptr; diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index c8b6caf5f42f..b75dba9591b9 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndValueResult; use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/bindings/mozmap.rs b/components/script/dom/bindings/mozmap.rs index 5c0451cca710..4d74a6405b04 100644 --- a/components/script/dom/bindings/mozmap.rs +++ b/components/script/dom/bindings/mozmap.rs @@ -9,19 +9,19 @@ use crate::dom::bindings::error::report_pending_exception; use crate::dom::bindings::str::DOMString; use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; use js::jsapi::JSContext; +use js::jsapi::JS_NewPlainObject; use js::jsapi::JSITER_HIDDEN; use js::jsapi::JSITER_OWNONLY; use js::jsapi::JSITER_SYMBOLS; use js::jsapi::JSPROP_ENUMERATE; -use js::jsapi::JS_NewPlainObject; use js::jsval::ObjectValue; use js::jsval::UndefinedValue; -use js::rust::HandleValue; -use js::rust::IdVector; -use js::rust::MutableHandleValue; use js::rust::wrappers::GetPropertyKeys; use js::rust::wrappers::JS_DefineUCProperty2; use js::rust::wrappers::JS_GetPropertyById; +use js::rust::HandleValue; +use js::rust::IdVector; +use js::rust::MutableHandleValue; use std::collections::HashMap; use std::ops::Deref; diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 924696ecb260..a4584f2daa10 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -8,11 +8,9 @@ use crate::dom::bindings::conversions::is_dom_proxy; use crate::dom::bindings::utils::delete_property_by_id; +use js::glue::InvokeGetOwnPropertyDescriptor; use js::glue::{GetProxyHandler, GetProxyHandlerFamily}; use js::glue::{GetProxyPrivate, SetProxyPrivate}; -use js::glue::InvokeGetOwnPropertyDescriptor; -use js::jsapi::{DOMProxyShadowsResult, JSContext, JSObject, PropertyDescriptor}; -use js::jsapi::{JSErrNum, SetDOMProxyInformation}; use js::jsapi::GetObjectProto; use js::jsapi::GetStaticPrototype; use js::jsapi::Handle as RawHandle; @@ -23,11 +21,13 @@ use js::jsapi::JS_GetPropertyDescriptorById; use js::jsapi::MutableHandle as RawMutableHandle; use js::jsapi::MutableHandleObject as RawMutableHandleObject; use js::jsapi::ObjectOpResult; +use js::jsapi::{DOMProxyShadowsResult, JSContext, JSObject, PropertyDescriptor}; +use js::jsapi::{JSErrNum, SetDOMProxyInformation}; use js::jsval::ObjectValue; use js::jsval::UndefinedValue; -use js::rust::{Handle, HandleObject, MutableHandle, MutableHandleObject}; use js::rust::wrappers::JS_AlreadyHasOwnPropertyById; use js::rust::wrappers::JS_NewObjectWithGivenProto; +use js::rust::{Handle, HandleObject, MutableHandle, MutableHandleObject}; use std::ptr; /// Determine if this id shadows any existing properties for this proxy. diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 740cb82b520b..ca6bf0869606 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -42,9 +42,9 @@ use std::sync::{Arc, Weak}; #[allow(missing_docs)] // FIXME mod dummy { // Attributes donโ€™t apply through the macro. + use super::LiveDOMReferences; use std::cell::RefCell; use std::rc::Rc; - use super::LiveDOMReferences; thread_local!(pub static LIVE_REFERENCES: Rc>> = Rc::new(RefCell::new(None))); } diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index a86f502e2354..0d27a5206db1 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; -use js::jsapi::{JSContext, JSObject, Heap}; +use js::jsapi::{Heap, JSContext, JSObject}; use js::rust::HandleObject; use std::default::Default; diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 8c4a528b67a4..25b77e052e68 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -27,10 +27,10 @@ use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::{DomObject, Reflector}; -use crate::dom::bindings::trace::JSTraceable; use crate::dom::bindings::trace::trace_reflector; +use crate::dom::bindings::trace::JSTraceable; use crate::dom::node::Node; -use js::jsapi::{JSObject, JSTracer, Heap}; +use js::jsapi::{Heap, JSObject, JSTracer}; use js::rust::GCMethods; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use mitochondria::OnceCell; diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index e52cf7755a37..9f0380265623 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -4,8 +4,8 @@ //! The `ByteString` struct. +use chrono::prelude::{Utc, Weekday}; use chrono::{Datelike, TimeZone}; -use chrono::prelude::{Weekday, Utc}; use cssparser::CowRcStr; use html5ever::{LocalName, Namespace}; use servo_atoms::Atom; diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index 094749ff8759..d4cc8c1cdae3 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -16,19 +16,19 @@ use js::glue::DeleteJSAutoStructuredCloneBuffer; use js::glue::GetLengthOfJSStructuredCloneData; use js::glue::NewJSAutoStructuredCloneBuffer; use js::glue::WriteBytesToJSStructuredCloneData; -use js::jsapi::{JSAutoCompartment, JSContext}; -use js::jsapi::{JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter}; -use js::jsapi::{JS_ClearPendingException, JSObject}; -use js::jsapi::{JS_ReadBytes, JS_WriteBytes}; -use js::jsapi::{JS_ReadUint32Pair, JS_WriteUint32Pair}; use js::jsapi::CloneDataPolicy; use js::jsapi::HandleObject as RawHandleObject; -use js::jsapi::JS_STRUCTURED_CLONE_VERSION; use js::jsapi::MutableHandleObject as RawMutableHandleObject; use js::jsapi::StructuredCloneScope; use js::jsapi::TransferableOwnership; +use js::jsapi::JS_STRUCTURED_CLONE_VERSION; +use js::jsapi::{JSAutoCompartment, JSContext}; +use js::jsapi::{JSObject, JS_ClearPendingException}; +use js::jsapi::{JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter}; +use js::jsapi::{JS_ReadBytes, JS_WriteBytes}; +use js::jsapi::{JS_ReadUint32Pair, JS_WriteUint32Pair}; +use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone}; use js::rust::{Handle, HandleValue, MutableHandleValue}; -use js::rust::wrappers::{JS_WriteStructuredClone, JS_ReadStructuredClone}; use libc::size_t; use std::os::raw; use std::ptr; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index d067fb1a9f77..d45bbdef1213 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -30,7 +30,9 @@ //! `JSTraceable` to a datatype. use app_units::Au; -use canvas_traits::canvas::{CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle}; +use canvas_traits::canvas::{ + CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle, +}; use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle}; use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLBufferId, WebGLChan}; use canvas_traits::webgl::{WebGLContextShareMode, WebGLError, WebGLFramebufferId, WebGLMsgSender}; @@ -50,11 +52,11 @@ use crate::dom::htmlmediaelement::MediaFrameRenderer; use cssparser::RGBA; use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use encoding_rs::{Decoder, Encoding}; -use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, TypedScale}; use euclid::Length as EuclidLength; -use html5ever::{Prefix, LocalName, Namespace, QualName}; +use euclid::{Point2D, Rect, Transform2D, Transform3D, TypedScale, TypedSize2D, Vector2D}; use html5ever::buffer_queue::BufferQueue; use html5ever::tendril::IncompleteUtf8; +use html5ever::{LocalName, Namespace, Prefix, QualName}; use http::header::HeaderMap; use hyper::Method; use hyper::StatusCode; @@ -67,31 +69,31 @@ use js::typedarray::TypedArray; use js::typedarray::TypedArrayElement; use metrics::{InteractiveMetrics, InteractiveWindow}; use mime::Mime; -use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId}; -use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; +use msg::constellation_msg::{ + BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId, +}; use net_traits::filemanager_thread::RelativePos; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ImageCache, PendingImageId}; use net_traits::request::{Request, RequestInit}; -use net_traits::response::{Response, ResponseBody}; use net_traits::response::HttpsState; +use net_traits::response::{Response, ResponseBody}; use net_traits::storage_thread::StorageType; +use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use offscreen_gl_context::GLLimits; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; -use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; +use script_layout_interface::OpaqueStyleAndLayoutData; +use script_traits::DrawAPaintImageResult; use script_traits::{DocumentActivity, ScriptToConstellationChan, TimerEventId, TimerSource}; use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType}; -use script_traits::DrawAPaintImageResult; use selectors::matching::ElementSelectorFlags; use serde::{Deserialize, Serialize}; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_channel::{Receiver, Sender}; -use servo_media::Backend; -use servo_media::Error as ServoMediaError; use servo_media::audio::analyser_node::AnalysisEngine; use servo_media::audio::buffer_source_node::AudioBuffer; use servo_media::audio::context::AudioContext; @@ -99,6 +101,8 @@ use servo_media::audio::graph::NodeId; use servo_media::audio::panner_node::{DistanceModel, PanningModel}; use servo_media::audio::param::ParamType; use servo_media::player::Player; +use servo_media::Backend; +use servo_media::Error as ServoMediaError; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use smallvec::SmallVec; use std::cell::{Cell, RefCell, UnsafeCell}; @@ -107,20 +111,20 @@ use std::hash::{BuildHasher, Hash}; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::rc::Rc; -use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicBool, AtomicUsize}; -use std::time::{SystemTime, Instant}; +use std::sync::{Arc, Mutex}; +use std::time::{Instant, SystemTime}; use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto}; use style::context::QuirksMode; use style::element_state::*; use style::media_queries::MediaList; use style::properties::PropertyDeclarationBlock; use style::selector_parser::{PseudoElement, Snapshot}; -use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; +use style::shared_lock::{Locked as StyleLocked, SharedRwLock as StyleSharedRwLock}; use style::stylesheet_set::DocumentStylesheetSet; -use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule, Stylesheet}; -use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule, ViewportRule}; use style::stylesheets::keyframes_rule::Keyframe; +use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule, Stylesheet}; +use style::stylesheets::{ImportRule, NamespaceRule, StyleRule, SupportsRule, ViewportRule}; use style::values::specified::Length; use time::Duration; use uuid::Uuid; diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 7a48349e5945..177239537ba6 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -14,23 +14,20 @@ use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::trace_object; use crate::dom::windowproxy; use js; -use js::JS_CALLEE; use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper}; use js::glue::{GetCrossCompartmentWrapper, JS_GetReservedSlot, WrapperNew}; +use js::glue::{UnwrapObject, RUST_JSID_TO_INT, RUST_JSID_TO_STRING}; use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO, RUST_JSID_IS_INT, RUST_JSID_IS_STRING}; -use js::glue::{RUST_JSID_TO_INT, RUST_JSID_TO_STRING, UnwrapObject}; +use js::jsapi::HandleId as RawHandleId; +use js::jsapi::HandleObject as RawHandleObject; +use js::jsapi::MutableHandleObject as RawMutableHandleObject; use js::jsapi::{CallArgs, DOMCallbacks, GetGlobalForObjectCrossCompartment}; use js::jsapi::{Heap, JSAutoCompartment, JSContext}; use js::jsapi::{JSJitInfo, JSObject, JSTracer, JSWrapObjectCallbacks}; use js::jsapi::{JS_EnumerateStandardClasses, JS_GetLatin1StringCharsAndLength}; use js::jsapi::{JS_IsExceptionPending, JS_IsGlobalObject}; use js::jsapi::{JS_ResolveStandardClass, JS_StringHasLatin1Chars, ObjectOpResult}; -use js::jsapi::HandleId as RawHandleId; -use js::jsapi::HandleObject as RawHandleObject; -use js::jsapi::MutableHandleObject as RawMutableHandleObject; use js::jsval::{JSVal, UndefinedValue}; -use js::rust::{GCMethods, ToString, ToWindowProxyIfWindow, get_object_class, is_dom_class}; -use js::rust::{Handle, HandleId, HandleObject, HandleValue, MutableHandleValue}; use js::rust::wrappers::JS_DeletePropertyById; use js::rust::wrappers::JS_ForwardGetPropertyTo; use js::rust::wrappers::JS_GetProperty; @@ -38,6 +35,9 @@ use js::rust::wrappers::JS_GetPrototype; use js::rust::wrappers::JS_HasProperty; use js::rust::wrappers::JS_HasPropertyById; use js::rust::wrappers::JS_SetProperty; +use js::rust::{get_object_class, is_dom_class, GCMethods, ToString, ToWindowProxyIfWindow}; +use js::rust::{Handle, HandleId, HandleObject, HandleValue, MutableHandleValue}; +use js::JS_CALLEE; use libc; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use std::ffi::CString; diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs index d547355e423b..028b23bb9874 100644 --- a/components/script/dom/bindings/xmlname.rs +++ b/components/script/dom/bindings/xmlname.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::str::DOMString; -use html5ever::{Prefix, LocalName, Namespace}; +use html5ever::{LocalName, Namespace, Prefix}; /// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details. pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult { diff --git a/components/script/dom/biquadfilternode.rs b/components/script/dom/biquadfilternode.rs index 079c2c973954..15f5f09e07a0 100644 --- a/components/script/dom/biquadfilternode.rs +++ b/components/script/dom/biquadfilternode.rs @@ -5,18 +5,22 @@ use crate::dom::audionode::AudioNode; use crate::dom::audioparam::AudioParam; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::{self, BiquadFilterNodeMethods}; use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterOptions; use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterType; +use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::{ + self, BiquadFilterNodeMethods, +}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::biquad_filter_node::{BiquadFilterNodeOptions, FilterType}; use servo_media::audio::biquad_filter_node::BiquadFilterNodeMessage; +use servo_media::audio::biquad_filter_node::{BiquadFilterNodeOptions, FilterType}; use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage}; use servo_media::audio::param::ParamType; use std::cell::Cell; diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 41a2971b55d3..4842f6b29fa6 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -7,14 +7,14 @@ use crate::dom::bindings::codegen::Bindings::BlobBinding; use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use net_traits::{CoreResourceMsg, IpcSend}; -use net_traits::blob_url_store::{BlobBuf, get_blob_origin}; +use net_traits::blob_url_store::{get_blob_origin, BlobBuf}; use net_traits::filemanager_thread::{FileManagerThreadMsg, ReadFileProgress, RelativePos}; +use net_traits::{CoreResourceMsg, IpcSend}; use profile_traits::ipc; use std::mem; use std::ops::Index; diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs index f32837ee89cf..0ed93ce4ae85 100644 --- a/components/script/dom/bluetoothadvertisingevent.rs +++ b/components/script/dom/bluetoothadvertisingevent.rs @@ -2,8 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::{self, BluetoothAdvertisingEventInit}; use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::BluetoothAdvertisingEventMethods; +use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::{ + self, BluetoothAdvertisingEventInit, +}; use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs index 73b279c09040..05aee3196139 100644 --- a/components/script/dom/bluetoothcharacteristicproperties.rs +++ b/components/script/dom/bluetoothcharacteristicproperties.rs @@ -3,9 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding; -use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: -BluetoothCharacteristicPropertiesMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index 0cd5320ef087..0810dff64132 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -11,10 +11,10 @@ use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::B use crate::dom::bindings::error::Error; use crate::dom::bindings::error::ErrorResult; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; -use crate::dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; +use crate::dom::bluetooth::{response_async, AsyncBluetoothListener, Bluetooth}; use crate::dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use crate::dom::bluetoothremotegattcharacteristic::BluetoothRemoteGATTCharacteristic; use crate::dom::bluetoothremotegattdescriptor::BluetoothRemoteGATTDescriptor; diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs index 048f6e636b95..3aa9d9a19b85 100644 --- a/components/script/dom/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetoothpermissionresult.rs @@ -4,16 +4,20 @@ use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{self, BluetoothPermissionResultMethods}; +use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{ + self, BluetoothPermissionResultMethods, +}; use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods; -use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, PermissionState}; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusBinding::PermissionStatusMethods; +use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{ + PermissionName, PermissionState, +}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; -use crate::dom::bluetooth::{AsyncBluetoothListener, Bluetooth, AllowedBluetoothDevice}; +use crate::dom::bluetooth::{AllowedBluetoothDevice, AsyncBluetoothListener, Bluetooth}; use crate::dom::bluetoothdevice::BluetoothDevice; use crate::dom::globalscope::GlobalScope; use crate::dom::permissionstatus::PermissionStatus; diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 847ad88fe7f7..41732f120f9b 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -2,23 +2,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType}; -use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: -BluetoothCharacteristicPropertiesMethods; +use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding; -use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: -BluetoothRemoteGATTCharacteristicMethods; +use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; -use crate::dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; +use crate::dom::bindings::error::Error::{ + self, InvalidModification, Network, NotSupported, Security, +}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{ByteString, DOMString}; -use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; +use crate::dom::bluetooth::{get_gatt_children, response_async, AsyncBluetoothListener}; use crate::dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use crate::dom::bluetoothremotegattservice::BluetoothRemoteGATTService; use crate::dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID}; diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index 7ed43e9f3365..76a113c96e37 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -2,22 +2,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; -use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: -BluetoothRemoteGATTCharacteristicMethods; +use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::BluetoothRemoteGATTDescriptorMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; use crate::dom::bindings::error::Error::{self, InvalidModification, Network, Security}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{ByteString, DOMString}; -use crate::dom::bluetooth::{AsyncBluetoothListener, response_async}; -use crate::dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; +use crate::dom::bluetooth::{response_async, AsyncBluetoothListener}; +use crate::dom::bluetoothremotegattcharacteristic::{ + BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH, +}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use dom_struct::dom_struct; diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 29ed938937b5..dff68c60eca3 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -8,9 +8,9 @@ use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding; use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use crate::dom::bindings::error::Error; use crate::dom::bindings::error::ErrorResult; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; -use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; +use crate::dom::bluetooth::{get_gatt_children, response_async, AsyncBluetoothListener}; use crate::dom::bluetoothdevice::BluetoothDevice; use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index c4f032dd356a..1aeaf6216915 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::error::Error; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; -use crate::dom::bluetooth::{AsyncBluetoothListener, get_gatt_children}; +use crate::dom::bluetooth::{get_gatt_children, AsyncBluetoothListener}; use crate::dom::bluetoothdevice::BluetoothDevice; use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUID, BluetoothUUID}; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index c3a8dfa7c4b5..1ff600937eb9 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -2,18 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::canvas::{CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle}; +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; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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 cssparser::{Parser, ParserInput, RGBA}; use cssparser::Color as CSSColor; +use cssparser::{Parser, ParserInput, RGBA}; use dom_struct::dom_struct; // https://html.spec.whatwg.org/multipage/#canvasgradient diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index fe8de52dc751..d5d18e4fa8b5 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -4,7 +4,7 @@ use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use crate::dom::bindings::codegen::Bindings::CanvasPatternBinding; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 5ebc2eb98e1f..1bf2a09b50fa 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::canvas::{Canvas2dMsg, CanvasMsg, CanvasId}; +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}; @@ -18,7 +18,7 @@ use crate::dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPat use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom}; use crate::dom::bindings::str::DOMString; use crate::dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; @@ -27,12 +27,12 @@ use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement}; use crate::dom::imagedata::ImageData; -use crate::dom::node::{Node, NodeDamage, window_from_node}; +use crate::dom::node::{window_from_node, Node, NodeDamage}; use crate::unpremultiplytable::UNPREMULTIPLY_TABLE; -use cssparser::{Parser, ParserInput, RGBA}; use cssparser::Color as CSSColor; +use cssparser::{Parser, ParserInput, RGBA}; use dom_struct::dom_struct; -use euclid::{Transform2D, Point2D, Rect, Size2D, vec2}; +use euclid::{vec2, Point2D, Rect, Size2D, Transform2D}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::image::base::PixelFormat; use net_traits::image_cache::CanRequestImages; @@ -45,10 +45,10 @@ use pixels; use profile_traits::ipc as profiled_ipc; use script_traits::ScriptMsg; use servo_url::ServoUrl; -use std::{fmt, mem}; use std::cell::Cell; use std::str::FromStr; use std::sync::Arc; +use std::{fmt, mem}; #[must_root] #[derive(Clone, JSTraceable, MallocSizeOf)] diff --git a/components/script/dom/channelmergernode.rs b/components/script/dom/channelmergernode.rs index 3602b5a7139c..88fa3fceaee0 100644 --- a/components/script/dom/channelmergernode.rs +++ b/components/script/dom/channelmergernode.rs @@ -4,8 +4,12 @@ use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use crate::dom::bindings::codegen::Bindings::ChannelMergerNodeBinding::{self, ChannelMergerOptions}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; +use crate::dom::bindings::codegen::Bindings::ChannelMergerNodeBinding::{ + self, ChannelMergerOptions, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs index ec20e59258c8..042976e60ac7 100644 --- a/components/script/dom/client.rs +++ b/components/script/dom/client.rs @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; use crate::dom::bindings::codegen::Bindings::ClientBinding::FrameType; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::serviceworker::ServiceWorker; diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs index 7763ec416005..1ba8a1bf40a4 100644 --- a/components/script/dom/compositionevent.rs +++ b/components/script/dom/compositionevent.rs @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{self, CompositionEventMethods}; +use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{ + self, CompositionEventMethods, +}; use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index a9a8efe2b4a8..a1c3f590e3c3 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -6,15 +6,15 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CryptoBinding; use crate::dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use js::jsapi::{JSContext, JSObject}; use js::jsapi::Type; +use js::jsapi::{JSContext, JSObject}; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBufferView; -use servo_rand::{ServoRng, Rng}; +use servo_rand::{Rng, ServoRng}; use std::ptr::NonNull; unsafe_no_jsmanaged_fields!(ServoRng); diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs index a4539c17f763..10f0bf9ae6dd 100644 --- a/components/script/dom/css.rs +++ b/components/script/dom/css.rs @@ -9,12 +9,12 @@ use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; use crate::dom::worklet::Worklet; -use cssparser::{Parser, ParserInput, serialize_identifier}; +use cssparser::{serialize_identifier, Parser, ParserInput}; use dom_struct::dom_struct; use style::context::QuirksMode; use style::parser::ParserContext; +use style::stylesheets::supports_rule::{parse_condition_or_declaration, Declaration}; use style::stylesheets::CssRuleType; -use style::stylesheets::supports_rule::{Declaration, parse_condition_or_declaration}; use style_traits::ParsingMode; #[dom_struct] diff --git a/components/script/dom/cssconditionrule.rs b/components/script/dom/cssconditionrule.rs index 6b839b6ef4a9..812a23cf2fcf 100644 --- a/components/script/dom/cssconditionrule.rs +++ b/components/script/dom/cssconditionrule.rs @@ -11,7 +11,7 @@ use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::csssupportsrule::CSSSupportsRule; use dom_struct::dom_struct; use servo_arc::Arc; -use style::shared_lock::{SharedRwLock, Locked}; +use style::shared_lock::{Locked, SharedRwLock}; use style::stylesheets::CssRules as StyleCssRules; #[dom_struct] diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index c7295f46b856..f0010aa0e64a 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -13,7 +13,7 @@ use crate::dom::cssrulelist::{CSSRuleList, RulesSource}; use crate::dom::cssstylesheet::CSSStyleSheet; use dom_struct::dom_struct; use servo_arc::Arc; -use style::shared_lock::{SharedRwLock, Locked}; +use style::shared_lock::{Locked, SharedRwLock}; use style::stylesheets::CssRules as StyleCssRules; #[dom_struct] diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index 948e5938fe3b..4f253ea25721 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -2,9 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{self, CSSKeyframeRuleMethods}; +use crate::dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{ + self, CSSKeyframeRuleMethods, +}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index 27280cc651e2..54b1780e0695 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use crate::dom::bindings::error::ErrorResult; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::csskeyframerule::CSSKeyframeRule; @@ -18,7 +18,7 @@ use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use servo_arc::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; -use style::stylesheets::keyframes_rule::{KeyframesRule, Keyframe, KeyframeSelector}; +use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesRule}; use style::values::KeyframesName; #[dom_struct] diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index fc7608a476f8..3704168dd7b1 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssconditionrule::CSSConditionRule; diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index c5889eb066cf..870a85866e88 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding; use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::csskeyframerule::CSSKeyframeRule; use crate::dom::cssrule::CSSRule; diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 1fc7f5b6961c..bc3fbe0f6554 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -2,23 +2,29 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{self, CSSStyleDeclarationMethods}; +use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{ + self, CSSStyleDeclarationMethods, +}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::CSSRule; use crate::dom::element::Element; -use crate::dom::node::{Node, window_from_node, document_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node}; use crate::dom::window::Window; use dom_struct::dom_struct; use servo_arc::Arc; use servo_url::ServoUrl; use style::attr::AttrValue; -use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId}; -use style::properties::{parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration}; +use style::properties::{ + parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration, +}; +use style::properties::{ + Importance, LonghandId, PropertyDeclarationBlock, PropertyId, ShorthandId, +}; use style::selector_parser::PseudoElement; use style::shared_lock::Locked; use style_traits::ParsingMode; diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 662ea8bb5425..0e9758f25fb8 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -5,22 +5,22 @@ use crate::dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMethods}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::cssrule::{CSSRule, SpecificCSSRule}; use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::window::Window; -use cssparser::{Parser as CssParser, ParserInput as CssParserInput}; use cssparser::ToCss; +use cssparser::{Parser as CssParser, ParserInput as CssParserInput}; use dom_struct::dom_struct; use selectors::parser::SelectorList; use servo_arc::Arc; use std::mem; use style::selector_parser::SelectorParser; use style::shared_lock::{Locked, ToCssWithGuard}; -use style::stylesheets::{StyleRule, Origin}; +use style::stylesheets::{Origin, StyleRule}; #[dom_struct] pub struct CSSStyleRule { diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs index 668c8bbec98e..bb19d351543e 100644 --- a/components/script/dom/cssstylevalue.rs +++ b/components/script/dom/cssstylevalue.rs @@ -4,8 +4,8 @@ use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods; use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::Wrap; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index 4c122595bb5e..b1a1e6b5be42 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::CSSSupportsRuleBinding; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::cssconditionrule::CSSConditionRule; @@ -16,8 +16,8 @@ use dom_struct::dom_struct; use servo_arc::Arc; use style::parser::ParserContext; use style::shared_lock::{Locked, ToCssWithGuard}; -use style::stylesheets::{CssRuleType, SupportsRule}; use style::stylesheets::supports_rule::SupportsCondition; +use style::stylesheets::{CssRuleType, SupportsRule}; use style_traits::{ParsingMode, ToCss}; #[dom_struct] diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 1fdf1cfc4a1f..8de16faf1d69 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -11,10 +11,14 @@ use crate::dom::bindings::codegen::Bindings::CustomElementRegistryBinding::Eleme use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; -use crate::dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception, throw_dom_exception}; +use crate::dom::bindings::conversions::{ + ConversionResult, FromJSValConvertible, StringificationBehavior, +}; +use crate::dom::bindings::error::{ + report_pending_exception, throw_dom_exception, Error, ErrorResult, Fallible, +}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; @@ -22,7 +26,7 @@ use crate::dom::domexception::{DOMErrorName, DOMException}; use crate::dom::element::{CustomElementState, Element}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{document_from_node, Node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node}; use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::microtask::Microtask; @@ -31,11 +35,11 @@ use dom_struct::dom_struct; use html5ever::{LocalName, Namespace, Prefix}; use js::conversions::ToJSValConvertible; use js::glue::UnwrapObject; -use js::jsapi::{Heap, IsCallable, IsConstructor, HandleValueArray}; +use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor}; use js::jsapi::{JSAutoCompartment, JSContext, JSObject}; use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue}; +use js::rust::wrappers::{Construct1, JS_GetProperty, JS_SameValue}; use js::rust::{HandleObject, HandleValue, MutableHandleValue}; -use js::rust::wrappers::{JS_GetProperty, Construct1, JS_SameValue}; use std::cell::Cell; use std::collections::{HashMap, VecDeque}; use std::mem; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index f6fad393fc34..afe0908c5430 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -4,8 +4,8 @@ use crate::devtools; use crate::dom::abstractworker::{SimpleWorkerErrorHandler, WorkerScriptMsg}; +use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods}; use crate::dom::abstractworkerglobalscope::{SendableWorkerScriptChan, WorkerThreadWorkerChan}; -use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding; use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::DedicatedWorkerGlobalScopeMethods; @@ -22,28 +22,28 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::dom::worker::{TrustedWorkerAddress, Worker}; use crate::dom::workerglobalscope::WorkerGlobalScope; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, new_rt_and_cx, Runtime}; use crate::script_runtime::ScriptThreadEventCategory::WorkerEvent; +use crate::script_runtime::{new_rt_and_cx, CommonScriptMsg, Runtime, ScriptChan, ScriptPort}; use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; use crate::task_source::TaskSourceName; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; -use js::jsapi::{JSAutoCompartment, JSContext}; use js::jsapi::JS_AddInterruptCallback; +use js::jsapi::{JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; use js::rust::HandleValue; use msg::constellation_msg::TopLevelBrowsingContextId; -use net_traits::{IpcSend, load_whole_resource}; use net_traits::request::{CredentialsMode, Destination, RequestInit}; +use net_traits::{load_whole_resource, IpcSend}; use script_traits::{TimerEvent, TimerSource, WorkerGlobalScopeInit, WorkerScriptLoadOrigin}; -use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Sender, Receiver}; +use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Receiver, Sender}; use servo_rand::random; use servo_url::ServoUrl; use std::mem::replace; -use std::sync::Arc; use std::sync::atomic::AtomicBool; +use std::sync::Arc; use std::thread; use style::thread_state::{self, ThreadState}; diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index feea9d93b211..e2111008eb3e 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -5,8 +5,8 @@ use crate::dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding; use crate::dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::DissimilarOriginLocationMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::str::USVString; diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index dbbd1d1c89e1..a8df59ca21c1 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -4,32 +4,38 @@ use crate::cookie_rs; use crate::document_loader::{DocumentLoader, LoadType}; -use crate::dom::activation::{ActivationSource, synthetic_click_activation}; +use crate::dom::activation::{synthetic_click_activation, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::beforeunloadevent::BeforeUnloadEvent; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding; -use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use crate::dom::bindings::codegen::Bindings::DocumentBinding::ElementCreationOptions; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{ + DocumentMethods, DocumentReadyState, +}; use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilter; use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceMethods; use crate::dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; -use crate::dom::bindings::codegen::Bindings::WindowBinding::{FrameRequestCallback, ScrollBehavior, WindowMethods}; +use crate::dom::bindings::codegen::Bindings::WindowBinding::{ + FrameRequestCallback, ScrollBehavior, WindowMethods, +}; use crate::dom::bindings::codegen::UnionTypes::NodeOrString; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::{DOMString, USVString}; -use crate::dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use crate::dom::bindings::xmlname::XMLName::InvalidXMLName; +use crate::dom::bindings::xmlname::{ + namespace_from_domstring, validate_and_extract, xml_name_type, +}; use crate::dom::closeevent::CloseEvent; use crate::dom::comment::Comment; use crate::dom::cssstylesheet::CSSStyleSheet; @@ -38,8 +44,10 @@ use crate::dom::customevent::CustomEvent; use crate::dom::documentfragment::DocumentFragment; use crate::dom::documenttype::DocumentType; use crate::dom::domimplementation::DOMImplementation; -use crate::dom::element::{Element, ElementCreator, ElementPerformFullscreenEnter, ElementPerformFullscreenExit}; use crate::dom::element::CustomElementCreationMode; +use crate::dom::element::{ + Element, ElementCreator, ElementPerformFullscreenEnter, ElementPerformFullscreenExit, +}; use crate::dom::errorevent::ErrorEvent; use crate::dom::event::{Event, EventBubbles, EventCancelable, EventDefault, EventStatus}; use crate::dom::eventtarget::EventTarget; @@ -65,9 +73,9 @@ use crate::dom::keyboardevent::KeyboardEvent; use crate::dom::location::Location; use crate::dom::messageevent::MessageEvent; use crate::dom::mouseevent::MouseEvent; -use crate::dom::node::{self, CloneChildrenFlag, document_from_node, window_from_node}; -use crate::dom::node::{Node, NodeDamage, NodeFlags, LayoutNodeHelpers}; use crate::dom::node::VecPreOrderInsertionHelper; +use crate::dom::node::{self, document_from_node, window_from_node, CloneChildrenFlag}; +use crate::dom::node::{LayoutNodeHelpers, Node, NodeDamage, NodeFlags}; use crate::dom::nodeiterator::NodeIterator; use crate::dom::nodelist::NodeList; use crate::dom::pagetransitionevent::PageTransitionEvent; @@ -102,18 +110,21 @@ use euclid::Point2D; use html5ever::{LocalName, Namespace, QualName}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; -use js::jsapi::{JSContext, JSObject, JSRuntime}; use js::jsapi::JS_GetRuntime; +use js::jsapi::{JSContext, JSObject, JSRuntime}; use keyboard_types::{Key, KeyState, Modifiers}; -use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory, ProgressiveWebMetric}; +use metrics::{ + InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory, + ProgressiveWebMetric, +}; use mime::{self, Mime}; use msg::constellation_msg::BrowsingContextId; -use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy}; -use net_traits::CookieSource::NonHTTP; -use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::pub_domains::is_pub_domain; use net_traits::request::RequestInit; use net_traits::response::HttpsState; +use net_traits::CookieSource::NonHTTP; +use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; +use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy}; use num_traits::ToPrimitive; use profile_traits::ipc as profile_ipc; use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType}; @@ -127,8 +138,8 @@ use servo_config::prefs::PREFS; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use std::borrow::ToOwned; use std::cell::{Cell, Ref, RefMut}; -use std::collections::{HashMap, HashSet, VecDeque}; use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; use std::fmt; use std::mem; @@ -143,10 +154,10 @@ use style::selector_parser::{RestyleDamage, Snapshot}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::str::{split_html_space_chars, str_join}; use style::stylesheet_set::DocumentStylesheetSet; -use style::stylesheets::{CssRule, Stylesheet, Origin, OriginSet}; +use style::stylesheets::{CssRule, Origin, OriginSet, Stylesheet}; use time; -use url::Host; use url::percent_encoding::percent_decode; +use url::Host; /// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before /// falling back to fake ones. diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index 43b7a8d4c5a5..b347380e972f 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -13,7 +13,7 @@ use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::htmlcollection::HTMLCollection; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::nodelist::NodeList; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 623a5b3adf2b..e61f76caf96b 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding; use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants; use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index 6ebc5b6fe085..29a3e5957931 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -5,16 +5,18 @@ use crate::document_loader::DocumentLoader; use crate::dom::bindings::codegen::Bindings::DOMImplementationBinding; use crate::dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementationMethods; -use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, ElementCreationOptions}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{ + DocumentMethods, ElementCreationOptions, +}; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name}; -use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::document::DocumentSource; +use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::documenttype::DocumentType; use crate::dom::htmlbodyelement::HTMLBodyElement; use crate::dom::htmlheadelement::HTMLHeadElement; diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index 12fcdc5781d9..4e4cf650f9ef 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -2,13 +2,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{Wrap, DOMMatrixMethods, DOMMatrixInit}; +use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{ + DOMMatrixInit, DOMMatrixMethods, Wrap, +}; use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnlyMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; -use crate::dom::dommatrixreadonly::{dommatrixinit_to_matrix, DOMMatrixReadOnly, entries_to_matrix}; +use crate::dom::dommatrixreadonly::{ + dommatrixinit_to_matrix, entries_to_matrix, DOMMatrixReadOnly, +}; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use euclid::Transform3D; diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index 65278b1f7d19..8edd62224804 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -4,7 +4,9 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{DOMMatrixInit, DOMMatrixMethods}; -use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::{DOMMatrixReadOnlyMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::{ + DOMMatrixReadOnlyMethods, Wrap, +}; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::error; use crate::dom::bindings::error::Fallible; @@ -14,11 +16,11 @@ use crate::dom::dommatrix::DOMMatrix; use crate::dom::dompoint::DOMPoint; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use euclid::{Transform3D, Angle}; -use js::jsapi::{JSObject, JSContext}; +use euclid::{Angle, Transform3D}; +use js::jsapi::{JSContext, JSObject}; use js::rust::CustomAutoRooterGuard; -use js::typedarray::{Float32Array, Float64Array}; use js::typedarray::CreateWith; +use js::typedarray::{Float32Array, Float64Array}; use std::cell::{Cell, Ref}; use std::f64; use std::ptr; diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index 334137499e7f..8ded7107698f 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -12,11 +12,11 @@ use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Te use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; -use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::document::DocumentSource; +use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::servoparser::ServoParser; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs index 456153b65046..c0d89f8420de 100644 --- a/components/script/dom/dompoint.rs +++ b/components/script/dom/dompoint.rs @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{ + DOMPointInit, DOMPointMethods, Wrap, +}; use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index ea6414aa1869..ecda5c4e0b4d 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -2,9 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::{DOMPointReadOnlyMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::{ + DOMPointReadOnlyMethods, Wrap, +}; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index 3d0cb09b7330..f65088dde8da 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOM use crate::dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods, Wrap}; use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::dompoint::DOMPoint; use crate::dom::domrect::DOMRect; diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs index e1bb8252b8da..96170f6a4896 100644 --- a/components/script/dom/domrectreadonly.rs +++ b/components/script/dom/domrectreadonly.rs @@ -2,9 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{DOMRectReadOnlyMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{ + DOMRectReadOnlyMethods, Wrap, +}; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index d62b4fd49f94..10da1af92991 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding; use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use crate::dom::bindings::error::ErrorResult; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::htmlelement::HTMLElement; diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 4c74b69d3a80..902197795ff1 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -6,7 +6,7 @@ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding; use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 33654ea51493..8f65f49b7dff 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -15,8 +15,8 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; -use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; +use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; use crate::dom::bindings::codegen::UnionTypes::NodeOrString; use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; @@ -25,11 +25,15 @@ use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; -use crate::dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use crate::dom::bindings::xmlname::XMLName::InvalidXMLName; +use crate::dom::bindings::xmlname::{ + namespace_from_domstring, validate_and_extract, xml_name_type, +}; use crate::dom::characterdata::CharacterData; use crate::dom::create::create_element; -use crate::dom::customelementregistry::{CallbackReaction, CustomElementDefinition, CustomElementReaction}; +use crate::dom::customelementregistry::{ + CallbackReaction, CustomElementDefinition, CustomElementReaction, +}; use crate::dom::document::{Document, LayoutDocumentHelpers}; use crate::dom::documentfragment::DocumentFragment; use crate::dom::domrect::DOMRect; @@ -59,41 +63,43 @@ use crate::dom::htmlstyleelement::HTMLStyleElement; use crate::dom::htmltablecellelement::{HTMLTableCellElement, HTMLTableCellElementLayoutHelpers}; use crate::dom::htmltableelement::{HTMLTableElement, HTMLTableElementLayoutHelpers}; use crate::dom::htmltablerowelement::{HTMLTableRowElement, HTMLTableRowElementLayoutHelpers}; -use crate::dom::htmltablesectionelement::{HTMLTableSectionElement, HTMLTableSectionElementLayoutHelpers}; +use crate::dom::htmltablesectionelement::{ + HTMLTableSectionElement, HTMLTableSectionElementLayoutHelpers, +}; use crate::dom::htmltemplateelement::HTMLTemplateElement; use crate::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers}; use crate::dom::mutationobserver::{Mutation, MutationObserver}; use crate::dom::namednodemap::NamedNodeMap; +use crate::dom::node::{document_from_node, window_from_node}; use crate::dom::node::{ChildrenMutation, LayoutNodeHelpers, Node}; use crate::dom::node::{NodeDamage, NodeFlags, UnbindContext}; -use crate::dom::node::{document_from_node, window_from_node}; use crate::dom::nodelist::NodeList; use crate::dom::promise::Promise; use crate::dom::servoparser::ServoParser; use crate::dom::text::Text; use crate::dom::validation::Validatable; -use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; +use crate::dom::virtualmethods::{vtable_for, VirtualMethods}; use crate::dom::window::ReflowReason; use crate::script_thread::ScriptThread; use crate::stylesheet_loader::StylesheetOwner; use crate::task::TaskOnce; use devtools_traits::AttrInfo; use dom_struct::dom_struct; -use html5ever::{Prefix, LocalName, Namespace, QualName}; use html5ever::serialize; use html5ever::serialize::SerializeOpts; use html5ever::serialize::TraversalScope; use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; +use html5ever::{LocalName, Namespace, Prefix, QualName}; use js::jsapi::Heap; use js::jsval::JSVal; use msg::constellation_msg::InputMethodType; use net_traits::request::CorsSettings; use ref_filter_map::ref_filter_map; use script_layout_interface::message::ReflowGoal; -use selectors::Element as SelectorsElement; -use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity}; +use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::sink::Push; +use selectors::Element as SelectorsElement; use servo_arc::Arc; use servo_atoms::Atom; use std::borrow::Cow; @@ -103,24 +109,28 @@ use std::fmt; use std::mem; use std::rc::Rc; use std::str::FromStr; -use style::CaseSensitivityExt; use style::applicable_declarations::ApplicableDeclarationBlock; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::context::QuirksMode; use style::dom_apis; use style::element_state::ElementState; use style::invalidation::element::restyle_hints::RestyleHint; -use style::properties::{ComputedValues, Importance, PropertyDeclaration}; -use style::properties::{PropertyDeclarationBlock, parse_style_attribute}; -use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size}; +use style::properties::longhands::{ + self, background_image, border_spacing, font_family, font_size, +}; use style::properties::longhands::{overflow_x, overflow_y}; +use style::properties::{parse_style_attribute, PropertyDeclarationBlock}; +use style::properties::{ComputedValues, Importance, PropertyDeclaration}; use style::rule_tree::CascadeLevel; -use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser}; use style::selector_parser::extended_filtering; -use style::shared_lock::{SharedRwLock, Locked}; +use style::selector_parser::{ + NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser, +}; +use style::shared_lock::{Locked, SharedRwLock}; use style::thread_state; +use style::values::{computed, specified}; use style::values::{CSSFloat, Either}; -use style::values::{specified, computed}; +use style::CaseSensitivityExt; use xml5ever::serialize as xmlSerialize; use xml5ever::serialize::SerializeOpts as XmlSerializeOpts; use xml5ever::serialize::TraversalScope as XmlTraversalScope; diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index d7151dbdcc11..2cf3b0b2bc89 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::{EventConstants, Even use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index a34042263ce7..b77cb5c34b2f 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -3,11 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::EventSourceBinding::{EventSourceInit, EventSourceMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::EventSourceBinding::{ + EventSourceInit, EventSourceMethods, Wrap, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; @@ -28,10 +30,10 @@ use js::conversions::ToJSValConvertible; use js::jsapi::JSAutoCompartment; use js::jsval::UndefinedValue; use mime::{self, Mime}; -use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata}; -use net_traits::{FetchResponseMsg, FetchResponseListener, NetworkError}; use net_traits::request::{CacheMode, CorsSettings, CredentialsMode}; use net_traits::request::{RequestInit, RequestMode}; +use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata}; +use net_traits::{FetchResponseListener, FetchResponseMsg, NetworkError}; use servo_atoms::Atom; use servo_url::ServoUrl; use std::cell::Cell; diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 81e8a350490b..3c1a1dd3381c 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::beforeunloadevent::BeforeUnloadEvent; -use crate::dom::bindings::callback::{CallbackContainer, ExceptionHandling, CallbackFunction}; +use crate::dom::bindings::callback::{CallbackContainer, CallbackFunction, ExceptionHandling}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use crate::dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; @@ -20,9 +20,9 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::UnionTypes::AddEventListenerOptionsOrBoolean; use crate::dom::bindings::codegen::UnionTypes::EventListenerOptionsOrBoolean; use crate::dom::bindings::codegen::UnionTypes::EventOrString; -use crate::dom::bindings::error::{Error, Fallible, report_pending_exception}; +use crate::dom::bindings::error::{report_pending_exception, Error, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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::element::Element; @@ -34,14 +34,14 @@ use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; use dom_struct::dom_struct; use fnv::FnvHasher; -use js::jsapi::{JS_GetFunctionObject, JSAutoCompartment, JSFunction}; -use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper}; +use js::jsapi::{JSAutoCompartment, JSFunction, JS_GetFunctionObject}; use js::rust::wrappers::CompileFunction; +use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper}; use libc::{c_char, size_t}; use servo_atoms::Atom; use servo_url::ServoUrl; -use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::collections::HashMap; use std::default::Default; use std::ffi::CString; use std::hash::BuildHasherDefault; diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 3046e1224172..978460855c14 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; -use crate::dom::blob::{Blob, BlobImpl, blob_parts_to_bytes}; +use crate::dom::blob::{blob_parts_to_bytes, Blob, BlobImpl}; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index 0049f8fca4ac..241305c71a4a 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::FileListBinding; use crate::dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::file::File; use crate::dom::window::Window; diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 000616d5cedb..c10f7688b404 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -5,12 +5,14 @@ use base64; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; -use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConstants, FileReaderMethods}; +use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{ + self, FileReaderConstants, FileReaderMethods, +}; use crate::dom::bindings::codegen::UnionTypes::StringOrObject; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::RootedTraceableBox; @@ -21,8 +23,8 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::progressevent::ProgressEvent; use crate::task::TaskCanceller; -use crate::task_source::{TaskSource, TaskSourceName}; use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource}; +use crate::task_source::{TaskSource, TaskSourceName}; 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 3b9608863ce0..9738cfed73b8 100644 --- a/components/script/dom/filereadersync.rs +++ b/components/script/dom/filereadersync.rs @@ -3,9 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; -use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::{FileReaderSyncBinding, FileReaderSyncMethods}; +use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::{ + FileReaderSyncBinding, FileReaderSyncMethods, +}; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::blob::Blob; diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index ca3f83cbb91f..3109b9c67d93 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -9,17 +9,17 @@ use crate::dom::bindings::codegen::UnionTypes::FileOrUSVString; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::{Blob, BlobImpl}; use crate::dom::file::File; use crate::dom::globalscope::GlobalScope; -use crate::dom::htmlformelement::{HTMLFormElement, FormDatumValue, FormDatum}; +use crate::dom::htmlformelement::{FormDatum, FormDatumValue, HTMLFormElement}; use dom_struct::dom_struct; use html5ever::LocalName; -use std::collections::BTreeMap; use std::collections::btree_map::Entry::{Occupied, Vacant}; +use std::collections::BTreeMap; use std::iter; #[dom_struct] diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index c3e39e5bcfe6..40754b7baf5f 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -5,9 +5,13 @@ use crate::dom::audionode::AudioNode; use crate::dom::audioparam::AudioParam; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use crate::dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions}; +use crate::dom::bindings::codegen::Bindings::GainNodeBinding::{ + self, GainNodeMethods, GainOptions, +}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index 24177b70bfc6..6994e16c4c45 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadBinding; use crate::dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; @@ -17,7 +17,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::vrpose::VRPose; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; -use js::typedarray::{Float64Array, CreateWith}; +use js::typedarray::{CreateWith, Float64Array}; use std::cell::Cell; use std::ptr; use std::ptr::NonNull; diff --git a/components/script/dom/gamepadbutton.rs b/components/script/dom/gamepadbutton.rs index 8162aefc8459..57d50994c75a 100644 --- a/components/script/dom/gamepadbutton.rs +++ b/components/script/dom/gamepadbutton.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadButtonBinding; use crate::dom::bindings::codegen::Bindings::GamepadButtonBinding::GamepadButtonMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index 87608789fed6..175b7c7aeeff 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadButtonListBinding; use crate::dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, RootedReference}; use crate::dom::gamepadbutton::GamepadButton; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index e25b1de67314..c96c3e021bd2 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadEventBinding; use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs index f207f8316a09..b158cc3891cf 100644 --- a/components/script/dom/gamepadlist.rs +++ b/components/script/dom/gamepadlist.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::GamepadListBinding; use crate::dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::gamepad::Gamepad; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 4c40d11a0449..96d4131f5814 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -7,11 +7,11 @@ use crate::dom::bindings::codegen::Bindings::EventSourceBinding::EventSourceBind use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use crate::dom::bindings::conversions::root_from_object; -use crate::dom::bindings::error::{ErrorInfo, report_pending_exception}; +use crate::dom::bindings::error::{report_pending_exception, ErrorInfo}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; -use crate::dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global}; +use crate::dom::bindings::settings_stack::{entry_global, incumbent_global, AutoEntryScript}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::weakref::DOMTracker; use crate::dom::crypto::Crypto; @@ -28,43 +28,43 @@ use crate::microtask::{Microtask, MicrotaskQueue}; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; use crate::script_thread::{MainThreadScriptChan, ScriptThread}; use crate::task::TaskCanceller; -use crate::task_source::TaskSourceName; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use crate::task_source::file_reading::FileReadingTaskSource; use crate::task_source::networking::NetworkingTaskSource; use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; use crate::task_source::remote_event::RemoteEventTaskSource; use crate::task_source::websocket::WebsocketTaskSource; +use crate::task_source::TaskSourceName; use crate::timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle}; use crate::timers::{OneshotTimers, TimerCallback}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; -use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; use js::glue::{IsWrapper, UnwrapObject}; +use js::jsapi::JSObject; use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment}; -use js::jsapi::{Heap, HandleObject}; +use js::jsapi::{HandleObject, Heap}; use js::jsapi::{JSAutoCompartment, JSContext}; -use js::jsapi::JSObject; use js::panic::maybe_resume_unwind; -use js::rust::{CompileOptionsWrapper, Runtime, get_object_class}; -use js::rust::{HandleValue, MutableHandleValue}; use js::rust::wrappers::Evaluate2; +use js::rust::{get_object_class, CompileOptionsWrapper, Runtime}; +use js::rust::{HandleValue, MutableHandleValue}; +use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; use libc; use msg::constellation_msg::PipelineId; -use net_traits::{CoreResourceThread, ResourceThreads, IpcSend}; +use net_traits::{CoreResourceThread, IpcSend, ResourceThreads}; use profile_traits::{mem as profile_mem, time as profile_time}; use script_traits::{MsDuration, ScriptToConstellationChan, TimerEvent}; use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource}; use servo_url::{MutableOrigin, ServoUrl}; use std::cell::Cell; -use std::collections::HashMap; use std::collections::hash_map::Entry; +use std::collections::HashMap; use std::ffi::CString; use std::rc::Rc; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use time::{Timespec, get_time}; +use std::sync::Arc; +use time::{get_time, Timespec}; #[derive(JSTraceable)] pub struct AutoCloseWorker(Arc); diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index cebc78ba0e0a..c7c71fb7dde9 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -3,12 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods, HeadersWrap}; +use crate::dom::bindings::codegen::Bindings::HeadersBinding::{ + HeadersInit, HeadersMethods, HeadersWrap, +}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::str::{ByteString, is_token}; +use crate::dom::bindings::str::{is_token, ByteString}; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use http::header::{self, HeaderMap as HyperHeaders, HeaderName, HeaderValue}; diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index b23b4a2d3301..da0e1c325b81 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::LocationBinding::LocationBinding::L use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::structuredclone::StructuredCloneData; diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index b6c45b33cfda..73f16a8340a0 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -21,7 +21,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlimageelement::HTMLImageElement; use crate::dom::mouseevent::MouseEvent; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use crate::dom::urlhelper::UrlHelper; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 686740ef818e..1a167bd3b944 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -16,7 +16,7 @@ use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlanchorelement::follow_hyperlink; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use euclid::Point2D; diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 141d74f3223b..33ba9886b487 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element}; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, UnbindContext, document_from_node}; +use crate::dom::node::{document_from_node, Node, UnbindContext}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index a72906e13376..b3bf5e6a76e6 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -3,16 +3,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::attr::Attr; -use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; +use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{ + self, HTMLBodyElementMethods, +}; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::root::{LayoutDom, DomRoot}; +use crate::dom::bindings::root::{DomRoot, LayoutDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use cssparser::RGBA; use dom_struct::dom_struct; diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index e75da65e6183..b954c4a7d34d 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::activation::{Activatable, ActivationSource, synthetic_click_activation}; +use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; @@ -15,13 +15,13 @@ use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlfieldsetelement::HTMLFieldSetElement; +use crate::dom::htmlformelement::HTMLFormElement; use crate::dom::htmlformelement::{FormControl, FormDatum, FormDatumValue}; use crate::dom::htmlformelement::{FormSubmitter, ResetFrom, SubmittedFrom}; -use crate::dom::htmlformelement::HTMLFormElement; -use crate::dom::node::{Node, UnbindContext, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node, UnbindContext}; use crate::dom::nodelist::NodeList; use crate::dom::validation::Validatable; -use crate::dom::validitystate::{ValidityState, ValidationFlags}; +use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index db9b5e8eda5c..0661f5717f08 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -3,12 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use base64; -use canvas_traits::canvas::{CanvasMsg, CanvasId, FromScriptMsg}; +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; -use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{HTMLCanvasElementMethods, RenderingContext}; +use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{ + HTMLCanvasElementMethods, RenderingContext, +}; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes; use crate::dom::bindings::conversions::ConversionResult; use crate::dom::bindings::error::{Error, Fallible}; @@ -16,20 +18,24 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom}; use crate::dom::bindings::str::{DOMString, USVString}; -use crate::dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; +use crate::dom::canvasrenderingcontext2d::{ + CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers, +}; use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::webgl2renderingcontext::WebGL2RenderingContext; -use crate::dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext}; +use crate::dom::webglrenderingcontext::{ + LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext, +}; use dom_struct::dom_struct; use euclid::{Rect, Size2D}; use html5ever::{LocalName, Prefix}; -use image::ColorType; use image::png::PNGEncoder; +use image::ColorType; use js::error::throw_type_error; use js::jsapi::JSContext; use js::rust::HandleValue; @@ -440,8 +446,8 @@ impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes { pub mod utils { use crate::dom::window::Window; - use net_traits::image_cache::{ImageResponse, UsePlaceholder, ImageOrMetadataAvailable}; use net_traits::image_cache::CanRequestImages; + use net_traits::image_cache::{ImageOrMetadataAvailable, ImageResponse, UsePlaceholder}; use servo_url::ServoUrl; pub fn request_image_from_cache(window: &Window, url: ServoUrl) -> ImageResponse { diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index cb2853e13077..99d3c4775b8e 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -5,13 +5,13 @@ use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding; use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::JSTraceable; use crate::dom::bindings::xmlname::namespace_from_domstring; use crate::dom::element::Element; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use crate::dom::window::Window; use dom_struct::dom_struct; use html5ever::{LocalName, QualName}; diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index de7230a441d6..9c58b94695a1 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -11,7 +11,7 @@ use crate::dom::element::Element; use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmloptionelement::HTMLOptionElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index b3c8fadbc43f..80d4c1caa984 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -12,7 +12,7 @@ use crate::dom::document::Document; use crate::dom::element::AttributeMutation; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use crate::task_source::TaskSource; use dom_struct::dom_struct; diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index e54ef512ac6b..36edbefa9cbf 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -12,7 +12,7 @@ use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 73fb7feab794..c3702a0357a2 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::activation::{ActivationSource, synthetic_click_activation}; +use crate::dom::activation::{synthetic_click_activation, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; @@ -11,8 +11,8 @@ use crate::dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMeth use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult}; -use crate::dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use crate::dom::bindings::inheritance::Castable; +use crate::dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -27,8 +27,8 @@ use crate::dom::htmlframesetelement::HTMLFrameSetElement; use crate::dom::htmlhtmlelement::HTMLHtmlElement; use crate::dom::htmlinputelement::{HTMLInputElement, InputType}; use crate::dom::htmllabelelement::HTMLLabelElement; -use crate::dom::node::{Node, NodeFlags}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::dom::node::{Node, NodeFlags}; use crate::dom::nodelist::NodeList; use crate::dom::text::Text; use crate::dom::virtualmethods::VirtualMethods; diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 2f5ffa9a0423..2026e7bd5e03 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -13,7 +13,7 @@ use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlformelement::{FormControl, HTMLFormElement}; use crate::dom::htmllegendelement::HTMLLegendElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::validitystate::ValidityState; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index 371e55ea65a7..0794e4ca432d 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -18,7 +18,7 @@ use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use servo_atoms::Atom; use style::attr::AttrValue; -use style::str::{HTML_SPACE_CHARACTERS, read_numbers}; +use style::str::{read_numbers, HTML_SPACE_CHARACTERS}; #[dom_struct] pub struct HTMLFontElement { diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index bf23f85bdcec..57261fe26aa6 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollecti use crate::dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding; use crate::dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods; use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::element::Element; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index d5331cfc3566..ba322aa20e94 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -37,8 +37,8 @@ use crate::dom::htmlobjectelement::HTMLObjectElement; use crate::dom::htmloutputelement::HTMLOutputElement; use crate::dom::htmlselectelement::HTMLSelectElement; use crate::dom::htmltextareaelement::HTMLTextAreaElement; -use crate::dom::node::{Node, NodeFlags, UnbindContext, VecPreOrderInsertionHelper}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::dom::node::{Node, NodeFlags, UnbindContext, VecPreOrderInsertionHelper}; use crate::dom::validitystate::ValidationFlags; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; @@ -58,8 +58,8 @@ use std::borrow::ToOwned; use std::cell::Cell; use style::attr::AttrValue; use style::str::split_html_space_chars; -use url::UrlQuery; use url::form_urlencoded::Serializer; +use url::UrlQuery; #[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)] pub struct GenerationId(u32); diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index 686b908f8a58..4bf5d1002f0f 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::root::DomRoot; use crate::dom::document::Document; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index 2b5d9e5a69f7..c3aa6812062b 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -6,11 +6,11 @@ use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::codegen::Bindings::HTMLHeadElementBinding; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{DomRoot, RootedReference}; -use crate::dom::document::{Document, determine_policy_for_token}; +use crate::dom::document::{determine_policy_for_token, Document}; use crate::dom::element::Element; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlmetaelement::HTMLMetaElement; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use crate::dom::userscripts::load_script; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 5e835f1122ce..83499448cdc6 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::Windo use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomObject; -use crate::dom::bindings::root::{LayoutDom, DomRoot, MutNullableDom}; +use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; use crate::dom::domtokenlist::DOMTokenList; @@ -19,7 +19,7 @@ use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, NodeDamage, UnbindContext, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage, UnbindContext}; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::ReflowReason; use crate::dom::windowproxy::WindowProxy; @@ -31,9 +31,11 @@ use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use profile_traits::ipc as ProfiledIpc; use script_layout_interface::message::ReflowGoal; -use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason}; -use script_traits::{NewLayoutInfo, ScriptMsg}; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; +use script_traits::{ + IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason, +}; +use script_traits::{NewLayoutInfo, ScriptMsg}; use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::cell::Cell; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 8234983b936c..05d1d2804e14 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::{Au, AU_PER_PX}; -use crate::document_loader::{LoadType, LoadBlocker}; +use crate::document_loader::{LoadBlocker, LoadType}; use crate::dom::activation::Activatable; use crate::dom::attr::Attr; use crate::dom::bindings::cell::DomRefCell; @@ -21,8 +21,8 @@ use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; -use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use crate::dom::element::{reflect_cross_origin_attribute, set_cross_origin_attribute}; +use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlareaelement::HTMLAreaElement; @@ -32,7 +32,7 @@ use crate::dom::htmlmapelement::HTMLMapElement; use crate::dom::htmlpictureelement::HTMLPictureElement; use crate::dom::htmlsourceelement::HTMLSourceElement; use crate::dom::mouseevent::MouseEvent; -use crate::dom::node::{Node, NodeDamage, document_from_node, window_from_node, UnbindContext}; +use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage, UnbindContext}; use crate::dom::progressevent::ProgressEvent; use crate::dom::values::UNSIGNED_LONG_MAX; use crate::dom::virtualmethods::VirtualMethods; @@ -48,15 +48,15 @@ use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use mime::{self, Mime}; -use net_traits::{FetchResponseListener, FetchMetadata, NetworkError, FetchResponseMsg}; use net_traits::image::base::{Image, ImageMetadata}; +use net_traits::image_cache::UsePlaceholder; use net_traits::image_cache::{CanRequestImages, ImageCache, ImageOrMetadataAvailable}; use net_traits::image_cache::{ImageResponder, ImageResponse, ImageState, PendingImageId}; -use net_traits::image_cache::UsePlaceholder; use net_traits::request::RequestInit; +use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError}; use num_traits::ToPrimitive; -use servo_url::ServoUrl; use servo_url::origin::MutableOrigin; +use servo_url::ServoUrl; use std::cell::{Cell, RefMut}; use std::char; use std::collections::HashSet; @@ -64,14 +64,16 @@ use std::default::Default; use std::i32; use std::mem; use std::sync::{Arc, Mutex}; -use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_double, parse_length, parse_unsigned_integer}; +use style::attr::{ + parse_double, parse_length, parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto, +}; use style::context::QuirksMode; use style::media_queries::MediaList; use style::parser::ParserContext; use style::str::is_ascii_digit; use style::stylesheets::{CssRuleType, Origin}; -use style::values::specified::{AbsoluteLength, source_size_list::SourceSizeList}; use style::values::specified::length::{Length, NoCalcLength}; +use style::values::specified::{source_size_list::SourceSizeList, AbsoluteLength}; use style_traits::ParsingMode; enum ParseState { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index ae575120df67..e0f50575a440 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use caseless::compatibility_caseless_match_str; -use crate::dom::activation::{Activatable, ActivationSource, synthetic_click_activation}; +use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -18,7 +18,9 @@ use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; -use crate::dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; +use crate::dom::element::{ + AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers, +}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::file::File; @@ -26,28 +28,32 @@ use crate::dom::filelist::FileList; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlfieldsetelement::HTMLFieldSetElement; -use crate::dom::htmlformelement::{FormControl, FormDatum, FormDatumValue, FormSubmitter, HTMLFormElement}; +use crate::dom::htmlformelement::{ + FormControl, FormDatum, FormDatumValue, FormSubmitter, HTMLFormElement, +}; use crate::dom::htmlformelement::{ResetFrom, SubmittedFrom}; use crate::dom::keyboardevent::KeyboardEvent; use crate::dom::mouseevent::MouseEvent; -use crate::dom::node::{Node, NodeDamage, UnbindContext}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::dom::node::{Node, NodeDamage, UnbindContext}; use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; use crate::dom::validation::Validatable; use crate::dom::validitystate::ValidationFlags; use crate::dom::virtualmethods::VirtualMethods; -use crate::textinput::{Direction, SelectionDirection, TextInput}; -use crate::textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction}; +use crate::textinput::KeyReaction::{ + DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction, +}; use crate::textinput::Lines::Single; +use crate::textinput::{Direction, SelectionDirection, TextInput}; use dom_struct::dom_struct; use embedder_traits::FilterPattern; use html5ever::{LocalName, Prefix}; use mime_guess; use msg::constellation_msg::InputMethodType; -use net_traits::{CoreResourceMsg, IpcSend}; use net_traits::blob_url_store::get_blob_origin; use net_traits::filemanager_thread::FileManagerThreadMsg; +use net_traits::{CoreResourceMsg, IpcSend}; use profile_traits::ipc; use script_layout_interface::rpc::TextIndexResponse; use script_traits::ScriptToConstellationChan; diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index 7294c2059371..badc60b52439 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::activation::{Activatable, ActivationSource, synthetic_click_activation}; +use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLLabelElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods; diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index f69f2ff63625..562c4675a58b 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -11,7 +11,7 @@ use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlfieldsetelement::HTMLFieldSetElement; -use crate::dom::htmlformelement::{HTMLFormElement, FormControl}; +use crate::dom::htmlformelement::{FormControl, HTMLFormElement}; use crate::dom::node::{Node, UnbindContext}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index dd32b053885e..74d8e301cff3 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -13,13 +13,15 @@ use crate::dom::bindings::str::DOMString; use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::document::Document; use crate::dom::domtokenlist::DOMTokenList; +use crate::dom::element::{ + cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute, +}; use crate::dom::element::{AttributeMutation, Element, ElementCreator}; -use crate::dom::element::{cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute}; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{Node, UnbindContext, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node, UnbindContext}; use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; -use crate::stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; +use crate::stylesheet_loader::{StylesheetContextSource, StylesheetLoader, StylesheetOwner}; use cssparser::{Parser as CssParser, ParserInput}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index eb8de36e8ab8..da3722996d37 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -23,7 +23,7 @@ use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::blob::Blob; use crate::dom::document::Document; -use crate::dom::element::{Element, AttributeMutation}; +use crate::dom::element::{AttributeMutation, Element}; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlsourceelement::HTMLSourceElement; @@ -45,14 +45,14 @@ use http::header::{self, HeaderMap, HeaderValue}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use mime::{self, Mime}; -use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseListener, FetchMetadata, Metadata}; -use net_traits::NetworkError; use net_traits::request::{CredentialsMode, Destination, RequestInit}; +use net_traits::NetworkError; +use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata}; use script_layout_interface::HTMLMediaData; +use servo_media::player::frame::{Frame, FrameRenderer}; +use servo_media::player::{PlaybackState, Player, PlayerEvent, StreamType}; use servo_media::Error as ServoMediaError; use servo_media::ServoMedia; -use servo_media::player::{PlaybackState, Player, PlayerEvent, StreamType}; -use servo_media::player::frame::{Frame, FrameRenderer}; use servo_url::ServoUrl; use std::cell::Cell; use std::collections::VecDeque; @@ -60,7 +60,7 @@ use std::f64; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use time::{self, Timespec, Duration}; +use time::{self, Duration, Timespec}; use webrender_api::{ImageData, ImageDescriptor, ImageFormat, ImageKey, RenderApi}; use webrender_api::{RenderApiSender, Transaction}; diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index c73ff578c4ca..7e975c440c96 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -15,7 +15,7 @@ use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlheadelement::HTMLHeadElement; -use crate::dom::node::{Node, UnbindContext, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node, UnbindContext}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; @@ -26,7 +26,7 @@ use std::sync::atomic::AtomicBool; use style::attr::AttrValue; use style::media_queries::MediaList; use style::str::HTML_SPACE_CHARACTERS; -use style::stylesheets::{Stylesheet, StylesheetContents, CssRule, CssRules, Origin, ViewportRule}; +use style::stylesheets::{CssRule, CssRules, Origin, Stylesheet, StylesheetContents, ViewportRule}; #[dom_struct] pub struct HTMLMetaElement { diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index 002bb435f382..5709d569b65e 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::HTMLMeterElementBinding::{self, HTMLMeterElementMethods}; +use crate::dom::bindings::codegen::Bindings::HTMLMeterElementBinding::{ + self, HTMLMeterElementMethods, +}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::document::Document; diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 7fd39a7d2588..896c5eb90d1e 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -13,9 +13,9 @@ use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlformelement::{FormControl, HTMLFormElement}; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::validation::Validatable; -use crate::dom::validitystate::{ValidityState, ValidationFlags}; +use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs index 46cb34f248fb..9ad4e7363d02 100644 --- a/components/script/dom/htmloptionscollection.rs +++ b/components/script/dom/htmloptionscollection.rs @@ -8,7 +8,9 @@ use crate::dom::bindings::codegen::Bindings::HTMLOptionsCollectionBinding; use crate::dom::bindings::codegen::Bindings::HTMLOptionsCollectionBinding::HTMLOptionsCollectionMethods; use crate::dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; -use crate::dom::bindings::codegen::UnionTypes::{HTMLOptionElementOrHTMLOptGroupElement, HTMLElementOrLong}; +use crate::dom::bindings::codegen::UnionTypes::{ + HTMLElementOrLong, HTMLOptionElementOrHTMLOptGroupElement, +}; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index 0e9f4bad6b67..1ca4cabba25a 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -11,7 +11,7 @@ use crate::dom::document::Document; use crate::dom::element::{AttributeMutation, Element}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlformelement::{FormControl, HTMLFormElement}; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::nodelist::NodeList; use crate::dom::validitystate::ValidityState; use crate::dom::virtualmethods::VirtualMethods; diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index 752589fcea79..4bbb84cf53c7 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::HTMLProgressElementBinding::{self, HTMLProgressElementMethods}; +use crate::dom::bindings::codegen::Bindings::HTMLProgressElementBinding::{ + self, HTMLProgressElementMethods, +}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::document::Document; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index dca27b6b7cdf..1cc662218485 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -14,13 +14,15 @@ use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; +use crate::dom::element::{ + cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute, +}; use crate::dom::element::{AttributeMutation, Element, ElementCreator}; -use crate::dom::element::{cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute}; use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{ChildrenMutation, CloneChildrenFlag, Node}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::dom::node::{ChildrenMutation, CloneChildrenFlag, Node}; use crate::dom::virtualmethods::VirtualMethods; use crate::network_listener::{NetworkListener, PreInvoke}; use crate::task_source::TaskSourceName; @@ -30,8 +32,8 @@ use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsval::UndefinedValue; -use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError}; use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestInit, RequestMode}; +use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError}; use servo_atoms::Atom; use servo_config::opts; use servo_url::ServoUrl; @@ -41,7 +43,7 @@ use std::io::{Read, Write}; use std::path::PathBuf; use std::process::{Command, Stdio}; use std::sync::{Arc, Mutex}; -use style::str::{HTML_SPACE_CHARACTERS, StaticStringVec}; +use style::str::{StaticStringVec, HTML_SPACE_CHARACTERS}; use uuid::Uuid; #[dom_struct] diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 31a1a150d81f..aa8abc4feb28 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -21,14 +21,14 @@ use crate::dom::element::{AttributeMutation, Element}; use crate::dom::htmlcollection::CollectionFilter; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlfieldsetelement::HTMLFieldSetElement; -use crate::dom::htmlformelement::{FormDatumValue, FormControl, FormDatum, HTMLFormElement}; +use crate::dom::htmlformelement::{FormControl, FormDatum, FormDatumValue, HTMLFormElement}; use crate::dom::htmloptgroupelement::HTMLOptGroupElement; use crate::dom::htmloptionelement::HTMLOptionElement; use crate::dom::htmloptionscollection::HTMLOptionsCollection; -use crate::dom::node::{Node, UnbindContext, window_from_node}; +use crate::dom::node::{window_from_node, Node, UnbindContext}; use crate::dom::nodelist::NodeList; use crate::dom::validation::Validatable; -use crate::dom::validitystate::{ValidityState, ValidationFlags}; +use crate::dom::validitystate::{ValidationFlags, ValidityState}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index d2c27d181427..4cdbba9f620f 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -7,8 +7,8 @@ use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::root::{Dom, Root}; use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::root::{Dom, Root}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; use crate::dom::element::AttributeMutation; diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index f9a45cc23149..ede2cb743a8d 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -12,7 +12,9 @@ use crate::dom::cssstylesheet::CSSStyleSheet; use crate::dom::document::Document; use crate::dom::element::{Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{ChildrenMutation, Node, UnbindContext, document_from_node, window_from_node}; +use crate::dom::node::{ + document_from_node, window_from_node, ChildrenMutation, Node, UnbindContext, +}; use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner}; @@ -24,7 +26,7 @@ use servo_arc::Arc; use std::cell::Cell; use style::media_queries::MediaList; use style::parser::ParserContext as CssParserContext; -use style::stylesheets::{CssRuleType, Stylesheet, Origin}; +use style::stylesheets::{CssRuleType, Origin, Stylesheet}; use style_traits::ParsingMode; #[dom_struct] diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 044938d31291..d921855ae669 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -19,13 +19,13 @@ use crate::dom::htmltablecaptionelement::HTMLTableCaptionElement; use crate::dom::htmltablecolelement::HTMLTableColElement; use crate::dom::htmltablerowelement::HTMLTableRowElement; use crate::dom::htmltablesectionelement::HTMLTableSectionElement; -use crate::dom::node::{Node, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use cssparser::RGBA; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use std::cell::Cell; -use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_unsigned_integer}; +use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto}; #[dom_struct] pub struct HTMLTableElement { diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index a5d2c978c532..5255fdc0b0cd 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods; -use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{self, HTMLTableRowElementMethods}; +use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{ + self, HTMLTableRowElementMethods, +}; use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::error::{ErrorResult, Fallible}; @@ -17,7 +19,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::htmltablecellelement::HTMLTableCellElement; use crate::dom::htmltableelement::HTMLTableElement; use crate::dom::htmltablesectionelement::HTMLTableSectionElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use cssparser::RGBA; use dom_struct::dom_struct; diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index c45c24500640..f1422589c272 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods}; +use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{ + self, HTMLTableSectionElementMethods, +}; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::error::{ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; @@ -13,7 +15,7 @@ use crate::dom::element::{Element, RawLayoutElementHelpers}; use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmltablerowelement::HTMLTableRowElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::virtualmethods::VirtualMethods; use cssparser::RGBA; use dom_struct::dom_struct; diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index f9d8783d975e..a080373af2cd 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -11,7 +11,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::document::Document; use crate::dom::documentfragment::DocumentFragment; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{CloneChildrenFlag, Node, document_from_node}; +use crate::dom::node::{document_from_node, CloneChildrenFlag, Node}; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index e919d10a1bd3..05023ab683b5 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -14,16 +14,16 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::document::Document; -use crate::dom::element::{AttributeMutation, Element}; use crate::dom::element::RawLayoutElementHelpers; +use crate::dom::element::{AttributeMutation, Element}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlfieldsetelement::HTMLFieldSetElement; use crate::dom::htmlformelement::{FormControl, HTMLFormElement}; use crate::dom::keyboardevent::KeyboardEvent; -use crate::dom::node::{CloneChildrenFlag, ChildrenMutation, Node, NodeDamage, UnbindContext}; use crate::dom::node::{document_from_node, window_from_node}; +use crate::dom::node::{ChildrenMutation, CloneChildrenFlag, Node, NodeDamage, UnbindContext}; use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; use crate::dom::validation::Validatable; diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 82f914a3b866..5aa14ca47afc 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -4,15 +4,15 @@ use crate::dom::bindings::codegen::Bindings::ImageDataBinding; use crate::dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; -use crate::dom::bindings::error::{Fallible, Error}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::error::{Error, Fallible}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use euclid::{Rect, Size2D}; use js::jsapi::{Heap, JSContext, JSObject}; use js::rust::Runtime; -use js::typedarray::{Uint8ClampedArray, CreateWith}; +use js::typedarray::{CreateWith, Uint8ClampedArray}; use pixels; use std::borrow::Cow; use std::default::Default; diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 284b25ee4672..3a63482dd322 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::LocationBinding; use crate::dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/mediaerror.rs b/components/script/dom/mediaerror.rs index 6da1cceb1018..cd379e59678f 100644 --- a/components/script/dom/mediaerror.rs +++ b/components/script/dom/mediaerror.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::MediaErrorBinding::{self, MediaErrorMethods}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index 5293947354bd..29b2bbfab750 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::MediaListBinding; use crate::dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylesheet::CSSStyleSheet; @@ -16,7 +16,7 @@ use servo_arc::Arc; use style::media_queries::MediaList as StyleMediaList; use style::media_queries::MediaQuery; use style::parser::ParserContext; -use style::shared_lock::{SharedRwLock, Locked}; +use style::shared_lock::{Locked, SharedRwLock}; use style::stylesheets::CssRuleType; use style_traits::{ParsingMode, ToCss}; diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs index dd1e78ff9abd..97f6fcccdd06 100644 --- a/components/script/dom/mimetypearray.rs +++ b/components/script/dom/mimetypearray.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::MimeTypeArrayBinding; use crate::dom::bindings::codegen::Bindings::MimeTypeArrayBinding::MimeTypeArrayMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 362c05b81975..89664282764a 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCa use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods; use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object, DomObject}; +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::mutationrecord::MutationRecord; @@ -18,7 +18,7 @@ use crate::dom::window::Window; use crate::microtask::Microtask; use crate::script_thread::ScriptThread; use dom_struct::dom_struct; -use html5ever::{Namespace, LocalName}; +use html5ever::{LocalName, Namespace}; use std::rc::Rc; #[dom_struct] diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index 7cf337f5207a..cf47e8e0d368 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -4,10 +4,10 @@ use crate::dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding; use crate::dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::dom::nodelist::NodeList; use dom_struct::dom_struct; use html5ever::{LocalName, Namespace}; diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 0303234f7837..2cd2737f9b84 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use crate::dom::bindings::codegen::Bindings::NamedNodeMapBinding; use crate::dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::xmlname::namespace_from_domstring; diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 44b0fcf632d5..7e7d51ebabd0 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::NavigatorBinding; use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use crate::dom::bindings::codegen::Bindings::VRBinding::VRBinding::VRMethods; -use crate::dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bluetooth::Bluetooth; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 4b2f3211ae02..2c637f78a989 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -21,13 +21,13 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use crate::dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use crate::dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::xmlname::namespace_from_domstring; use crate::dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; use crate::dom::cssstylesheet::CSSStyleSheet; -use crate::dom::customelementregistry::{CallbackReaction, try_upgrade_element}; +use crate::dom::customelementregistry::{try_upgrade_element, CallbackReaction}; use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use crate::dom::documentfragment::DocumentFragment; use crate::dom::documenttype::DocumentType; @@ -50,24 +50,24 @@ use crate::dom::mutationobserver::{Mutation, MutationObserver, RegisteredObserve use crate::dom::nodelist::NodeList; use crate::dom::processinginstruction::ProcessingInstruction; use crate::dom::range::WeakRangeVec; -use crate::dom::svgsvgelement::{SVGSVGElement, LayoutSVGSVGElementHelpers}; +use crate::dom::svgsvgelement::{LayoutSVGSVGElementHelpers, SVGSVGElement}; use crate::dom::text::Text; -use crate::dom::virtualmethods::{VirtualMethods, vtable_for}; +use crate::dom::virtualmethods::{vtable_for, VirtualMethods}; use crate::dom::window::Window; use crate::script_thread::ScriptThread; use devtools_traits::NodeInfo; use dom_struct::dom_struct; -use euclid::{Point2D, Vector2D, Rect, Size2D}; -use html5ever::{Prefix, Namespace, QualName}; +use euclid::{Point2D, Rect, Size2D, Vector2D}; +use html5ever::{Namespace, Prefix, QualName}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use libc::{self, c_void, uintptr_t}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use ref_slice::ref_slice; +use script_layout_interface::message::Msg; use script_layout_interface::{HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType}; use script_layout_interface::{OpaqueStyleAndLayoutData, SVGSVGData, TrustedNodeAddress}; -use script_layout_interface::message::Msg; use script_traits::DocumentActivity; use script_traits::UntrustedNodeAddress; use selectors::matching::{matches_selector_list, MatchingContext, MatchingMode}; @@ -76,7 +76,7 @@ use servo_arc::Arc; use servo_url::ServoUrl; use smallvec::SmallVec; use std::borrow::ToOwned; -use std::cell::{Cell, UnsafeCell, RefMut}; +use std::cell::{Cell, RefMut, UnsafeCell}; use std::cmp; use std::default::Default; use std::iter; diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 965bbf1a83f5..83d96cc7294e 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConsta use crate::dom::bindings::codegen::Bindings::NodeIteratorBinding; use crate::dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutDom}; use crate::dom::document::Document; use crate::dom::node::Node; diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index ddf78a350eda..5f557cd713d5 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeListBinding; use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use crate::dom::node::{ChildrenMutation, Node}; use crate::dom::window::Window; diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index 8d2d0d6663b4..f98f3b447504 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::offlineaudiocompletionevent::OfflineAudioCompletionEvent; @@ -25,8 +25,8 @@ use dom_struct::dom_struct; use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions; use std::cell::Cell; use std::rc::Rc; -use std::sync::{Arc, Mutex}; use std::sync::mpsc; +use std::sync::{Arc, Mutex}; use std::thread::Builder; #[dom_struct] diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 0263be2d161e..2a3e429d181e 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -5,10 +5,14 @@ use crate::dom::audioparam::AudioParam; use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; -use crate::dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType}; use crate::dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods; +use crate::dom::bindings::codegen::Bindings::OscillatorNodeBinding::{ + self, OscillatorOptions, OscillatorType, +}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs index cbf46a9ddbec..9ec09e84fa9c 100644 --- a/components/script/dom/paintsize.rs +++ b/components/script/dom/paintsize.rs @@ -5,8 +5,8 @@ use crate::dom::bindings::codegen::Bindings::PaintSizeBinding; use crate::dom::bindings::codegen::Bindings::PaintSizeBinding::PaintSizeMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::DomRoot; use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index b6d693a1f224..91ceedaa576c 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -38,24 +38,24 @@ use js::jsapi::JS_NewArrayObject; use js::jsval::JSVal; use js::jsval::ObjectValue; use js::jsval::UndefinedValue; -use js::rust::HandleValue; -use js::rust::Runtime; use js::rust::wrappers::Call; use js::rust::wrappers::Construct1; +use js::rust::HandleValue; +use js::rust::Runtime; use msg::constellation_msg::PipelineId; use net_traits::image::base::PixelFormat; use net_traits::image_cache::ImageCache; use profile_traits::ipc; -use script_traits::{DrawAPaintImageResult, PaintWorkletError}; use script_traits::Painter; +use script_traits::{DrawAPaintImageResult, PaintWorkletError}; use servo_atoms::Atom; -use servo_channel::{channel, Sender}; use servo_channel::base_channel; +use servo_channel::{channel, Sender}; use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::cell::Cell; -use std::collections::HashMap; use std::collections::hash_map::Entry; +use std::collections::HashMap; use std::ptr::null_mut; use std::rc::Rc; use std::sync::Arc; diff --git a/components/script/dom/pannernode.rs b/components/script/dom/pannernode.rs index b63ab59957f4..a483934d8dae 100644 --- a/components/script/dom/pannernode.rs +++ b/components/script/dom/pannernode.rs @@ -5,10 +5,18 @@ use crate::dom::audionode::AudioNode; use crate::dom::audioparam::AudioParam; use crate::dom::baseaudiocontext::BaseAudioContext; -use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; -use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{AudioParamMethods, AutomationRate}; -use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{self, PannerNodeMethods, PannerOptions}; -use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{DistanceModelType, PanningModelType}; +use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ + ChannelCountMode, ChannelInterpretation, +}; +use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ + AudioParamMethods, AutomationRate, +}; +use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{ + self, PannerNodeMethods, PannerOptions, +}; +use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{ + DistanceModelType, PanningModelType, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; @@ -17,8 +25,8 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage}; -use servo_media::audio::panner_node::{DistanceModel, PannerNodeOptions, PanningModel}; use servo_media::audio::panner_node::PannerNodeMessage; +use servo_media::audio::panner_node::{DistanceModel, PannerNodeOptions, PanningModel}; use servo_media::audio::param::{ParamDir, ParamType}; use std::cell::Cell; use std::f32; diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index b47703f51e2e..191e4b29fad9 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -4,12 +4,14 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::PerformanceBinding; -use crate::dom::bindings::codegen::Bindings::PerformanceBinding::{DOMHighResTimeStamp, PerformanceMethods}; use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList; +use crate::dom::bindings::codegen::Bindings::PerformanceBinding::{ + DOMHighResTimeStamp, PerformanceMethods, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/performanceentry.rs b/components/script/dom/performanceentry.rs index f00c654dce01..6d416506eac3 100644 --- a/components/script/dom/performanceentry.rs +++ b/components/script/dom/performanceentry.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceEntryBinding; use crate::dom::bindings::codegen::Bindings::PerformanceEntryBinding::PerformanceEntryMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index 2cc68f79e74c..4f790c82de56 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::Perform use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverInit; use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs index 0fcac36848c0..929e41a6e883 100644 --- a/components/script/dom/performanceobserverentrylist.rs +++ b/components/script/dom/performanceobserverentrylist.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding; use crate::dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index 7e2dd68c2d17..930738c184f8 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::PerformanceTimingBinding; use crate::dom::bindings::codegen::Bindings::PerformanceTimingBinding::PerformanceTimingMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::document::Document; use crate::dom::window::Window; diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 2c0e8e952695..615d1815384a 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -2,12 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, PermissionState}; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionDescriptor; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; +use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{ + PermissionName, PermissionState, +}; use crate::dom::bindings::codegen::Bindings::PermissionsBinding::{self, PermissionsMethods}; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bluetooth::Bluetooth; use crate::dom::bluetoothpermissionresult::BluetoothPermissionResult; diff --git a/components/script/dom/permissionstatus.rs b/components/script/dom/permissionstatus.rs index 1782eef53517..6efb7c506982 100644 --- a/components/script/dom/permissionstatus.rs +++ b/components/script/dom/permissionstatus.rs @@ -2,9 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{self, PermissionDescriptor, PermissionName}; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; +use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{ + self, PermissionDescriptor, PermissionName, +}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs index c151d5c617f2..e4e26547e726 100644 --- a/components/script/dom/pluginarray.rs +++ b/components/script/dom/pluginarray.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::PluginArrayBinding; use crate::dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index f348bd1b8c51..1e22f269d343 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -24,11 +24,13 @@ use js::jsapi::{Heap, JS_ClearPendingException}; use js::jsapi::{JSAutoCompartment, JSContext, JSObject, JS_GetFunctionObject}; use js::jsapi::{JS_NewFunction, NewFunctionWithReserved, PromiseState}; use js::jsapi::{RemoveRawValueRoot, SetFunctionNativeReserved}; -use js::jsval::{JSVal, UndefinedValue, ObjectValue, Int32Value}; -use js::rust::{HandleObject, HandleValue, MutableHandleObject, Runtime}; -use js::rust::wrappers::{AddPromiseReactions, CallOriginalPromiseResolve, CallOriginalPromiseReject}; +use js::jsval::{Int32Value, JSVal, ObjectValue, UndefinedValue}; +use js::rust::wrappers::{ + AddPromiseReactions, CallOriginalPromiseReject, CallOriginalPromiseResolve, +}; use js::rust::wrappers::{GetPromiseState, IsPromiseObject}; -use js::rust::wrappers::{NewPromiseObject, ResolvePromise, RejectPromise}; +use js::rust::wrappers::{NewPromiseObject, RejectPromise, ResolvePromise}; +use js::rust::{HandleObject, HandleValue, MutableHandleObject, Runtime}; use std::ptr; use std::rc::Rc; diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs index 3ebb8c58b795..8358de2f49e4 100644 --- a/components/script/dom/promisenativehandler.rs +++ b/components/script/dom/promisenativehandler.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::PromiseNativeHandlerBinding; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::trace::JSTraceable; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 3f8d54409173..c75989580ff9 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -6,14 +6,14 @@ use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterData use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeConstants; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; -use crate::dom::bindings::codegen::Bindings::RangeBinding::{self, RangeConstants}; use crate::dom::bindings::codegen::Bindings::RangeBinding::RangeMethods; +use crate::dom::bindings::codegen::Bindings::RangeBinding::{self, RangeConstants}; use crate::dom::bindings::codegen::Bindings::TextBinding::TextMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutDom, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::JSTraceable; diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 139931375f79..d07e393e8dae 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::body::{BodyOperations, BodyType, consume_body}; +use crate::body::{consume_body, BodyOperations, BodyType}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; use crate::dom::bindings::codegen::Bindings::RequestBinding; @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestMethods; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestMode; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{ByteString, DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; @@ -25,10 +25,8 @@ use crate::dom::headers::{Guard, Headers}; use crate::dom::promise::Promise; use crate::dom::xmlhttprequest::Extractable; use dom_struct::dom_struct; -use http::Method as HttpMethod; use http::method::InvalidMethod; -use net_traits::ReferrerPolicy as MsgReferrerPolicy; -use net_traits::request::{Origin, Window}; +use http::Method as HttpMethod; use net_traits::request::CacheMode as NetTraitsRequestCache; use net_traits::request::CredentialsMode as NetTraitsRequestCredentials; use net_traits::request::Destination as NetTraitsRequestDestination; @@ -36,6 +34,8 @@ use net_traits::request::RedirectMode as NetTraitsRequestRedirect; use net_traits::request::Referrer as NetTraitsRequestReferrer; use net_traits::request::Request as NetTraitsRequest; use net_traits::request::RequestMode as NetTraitsRequestMode; +use net_traits::request::{Origin, Window}; +use net_traits::ReferrerPolicy as MsgReferrerPolicy; use servo_url::ServoUrl; use std::cell::{Cell, Ref}; use std::rc::Rc; diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 174b6782b1ce..83afaf6b34b6 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -2,26 +2,28 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::body::{BodyOperations, BodyType, consume_body, consume_body_with_promise}; +use crate::body::{consume_body, consume_body_with_promise, BodyOperations, BodyType}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; use crate::dom::bindings::codegen::Bindings::ResponseBinding; -use crate::dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType}; +use crate::dom::bindings::codegen::Bindings::ResponseBinding::{ + ResponseMethods, ResponseType as DOMResponseType, +}; use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{ByteString, USVString}; use crate::dom::globalscope::GlobalScope; -use crate::dom::headers::{Headers, Guard}; -use crate::dom::headers::{is_vchar, is_obs_text}; +use crate::dom::headers::{is_obs_text, is_vchar}; +use crate::dom::headers::{Guard, Headers}; use crate::dom::promise::Promise; use crate::dom::xmlhttprequest::Extractable; use dom_struct::dom_struct; use http::header::HeaderMap as HyperHeaders; use hyper::StatusCode; use hyper_serde::Serde; -use net_traits::response::{ResponseBody as NetTraitsResponseBody}; +use net_traits::response::ResponseBody as NetTraitsResponseBody; use servo_url::ServoUrl; use std::cell::{Cell, Ref}; use std::mem; diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index 0e8b853ad79d..0d7cff7ffca1 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -6,8 +6,8 @@ use crate::dom::bindings::codegen::Bindings::ScreenBinding; use crate::dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; use crate::dom::bindings::reflector::DomObject; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index 0d87aa7eac92..db5937f85d39 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -4,11 +4,13 @@ use crate::dom::abstractworker::SimpleWorkerErrorHandler; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::ServiceWorkerBinding::{ServiceWorkerMethods, ServiceWorkerState, Wrap}; -use crate::dom::bindings::error::{ErrorResult, Error}; +use crate::dom::bindings::codegen::Bindings::ServiceWorkerBinding::{ + ServiceWorkerMethods, ServiceWorkerState, Wrap, +}; +use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::USVString; use crate::dom::bindings::structuredclone::StructuredCloneData; @@ -18,7 +20,7 @@ use crate::task::TaskOnce; use dom_struct::dom_struct; use js::jsapi::JSContext; use js::rust::HandleValue; -use script_traits::{ScriptMsg, DOMMessage}; +use script_traits::{DOMMessage, ScriptMsg}; use servo_url::ServoUrl; use std::cell::Cell; diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index e650002b3487..dd977484895c 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -2,10 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWorkerContainerMethods, Wrap}; use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; +use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ + ServiceWorkerContainerMethods, Wrap, +}; use crate::dom::bindings::error::Error; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::USVString; use crate::dom::client::Client; diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 650308438a5e..06f11adaad8c 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -4,7 +4,7 @@ use crate::devtools; use crate::dom::abstractworker::WorkerScriptMsg; -use crate::dom::abstractworkerglobalscope::{WorkerEventLoopMethods, run_worker_event_loop}; +use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods}; use crate::dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; use crate::dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use crate::dom::bindings::inheritance::Castable; @@ -19,17 +19,19 @@ use crate::dom::extendablemessageevent::ExtendableMessageEvent; use crate::dom::globalscope::GlobalScope; use crate::dom::worker::TrustedWorkerAddress; use crate::dom::workerglobalscope::WorkerGlobalScope; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, new_rt_and_cx, Runtime}; +use crate::script_runtime::{new_rt_and_cx, CommonScriptMsg, Runtime, ScriptChan}; use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; use crate::task_source::TaskSourceName; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; -use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; +use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use js::jsapi::{JSAutoCompartment, JSContext, JS_AddInterruptCallback}; use js::jsval::UndefinedValue; -use net_traits::{load_whole_resource, IpcSend, CustomResponseMediator}; use net_traits::request::{CredentialsMode, Destination, RequestInit}; -use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin}; +use net_traits::{load_whole_resource, CustomResponseMediator, IpcSend}; +use script_traits::{ + ScopeThings, ServiceWorkerMsg, TimerEvent, WorkerGlobalScopeInit, WorkerScriptLoadOrigin, +}; use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Receiver, Sender}; use servo_config::prefs::PREFS; use servo_rand::random; diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 9d10ed574a78..3b1ca4fdab08 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState; -use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap}; +use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ + ServiceWorkerRegistrationMethods, Wrap, +}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; @@ -12,7 +14,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::serviceworker::ServiceWorker; use crate::dom::workerglobalscope::prepare_workerscope_init; use dom_struct::dom_struct; -use script_traits::{WorkerScriptLoadOrigin, ScopeThings}; +use script_traits::{ScopeThings, WorkerScriptLoadOrigin}; use servo_url::ServoUrl; use std::cell::Cell; diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 8b1c00aeb026..d982c75e9753 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -18,21 +18,23 @@ use crate::dom::htmlscriptelement::HTMLScriptElement; use crate::dom::htmltemplateelement::HTMLTemplateElement; use crate::dom::node::Node; use crate::dom::processinginstruction::ProcessingInstruction; -use crate::dom::servoparser::{ElementAttribute, create_element_for_token, ParsingAlgorithm}; +use crate::dom::servoparser::{create_element_for_token, ElementAttribute, ParsingAlgorithm}; use crate::dom::virtualmethods::vtable_for; -use html5ever::{Attribute as HtmlAttribute, ExpandedName, QualName}; use html5ever::buffer_queue::BufferQueue; -use html5ever::tendril::{SendTendril, StrTendril, Tendril}; use html5ever::tendril::fmt::UTF8; +use html5ever::tendril::{SendTendril, StrTendril, Tendril}; use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult}; -use html5ever::tree_builder::{ElementFlags, NodeOrText as HtmlNodeOrText, NextParserState, QuirksMode, TreeSink}; +use html5ever::tree_builder::{ + ElementFlags, NextParserState, NodeOrText as HtmlNodeOrText, QuirksMode, TreeSink, +}; use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts}; +use html5ever::{Attribute as HtmlAttribute, ExpandedName, QualName}; use servo_channel::{channel, Receiver, Sender}; use servo_url::ServoUrl; use std::borrow::Cow; use std::cell::Cell; -use std::collections::HashMap; use std::collections::vec_deque::VecDeque; +use std::collections::HashMap; use std::thread; use style::context::QuirksMode as ServoQuirksMode; diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index cbdf74789a82..707a12f17eb4 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -17,13 +17,13 @@ use crate::dom::htmltemplateelement::HTMLTemplateElement; use crate::dom::node::Node; use crate::dom::processinginstruction::ProcessingInstruction; use crate::dom::servoparser::{ParsingAlgorithm, Sink}; -use html5ever::QualName; use html5ever::buffer_queue::BufferQueue; -use html5ever::serialize::{AttrRef, Serialize, Serializer}; use html5ever::serialize::TraversalScope; use html5ever::serialize::TraversalScope::IncludeNode; +use html5ever::serialize::{AttrRef, Serialize, Serializer}; use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult}; use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts}; +use html5ever::QualName; use js::jsapi::JSTracer; use servo_url::ServoUrl; use std::io; diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 10326a4eb82e..e1da04c724f5 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -4,14 +4,16 @@ use crate::document_loader::{DocumentLoader, LoadType}; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{ + DocumentMethods, DocumentReadyState, +}; use crate::dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods; use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::ServoParserBinding; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use crate::dom::bindings::settings_stack::is_execution_stack_empty; use crate::dom::bindings::str::DOMString; @@ -19,7 +21,7 @@ use crate::dom::characterdata::CharacterData; use crate::dom::comment::Comment; use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use crate::dom::documenttype::DocumentType; -use crate::dom::element::{Element, ElementCreator, CustomElementCreationMode}; +use crate::dom::element::{CustomElementCreationMode, Element, ElementCreator}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlformelement::{FormControlElementHelpers, HTMLFormElement}; use crate::dom::htmlimageelement::HTMLImageElement; @@ -33,16 +35,16 @@ use crate::network_listener::PreInvoke; use crate::script_thread::ScriptThread; use dom_struct::dom_struct; use embedder_traits::resources::{self, Resource}; -use html5ever::{Attribute, ExpandedName, LocalName, QualName}; use html5ever::buffer_queue::BufferQueue; -use html5ever::tendril::{StrTendril, ByteTendril, IncompleteUtf8}; -use html5ever::tree_builder::{NodeOrText, TreeSink, NextParserState, QuirksMode, ElementFlags}; +use html5ever::tendril::{ByteTendril, IncompleteUtf8, StrTendril}; +use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksMode, TreeSink}; +use html5ever::{Attribute, ExpandedName, LocalName, QualName}; use hyper_serde::Serde; use mime::{self, Mime}; use msg::constellation_msg::PipelineId; use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError}; +use profile_traits::time::{profile, ProfilerCategory, TimerMetadataReflowType}; use profile_traits::time::{TimerMetadata, TimerMetadataFrameType}; -use profile_traits::time::{TimerMetadataReflowType, ProfilerCategory, profile}; use script_traits::DocumentActivity; use servo_config::prefs::PREFS; use servo_url::ServoUrl; diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 16d0cf6e973b..ed6ed999fa24 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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::event::{Event, EventBubbles, EventCancelable}; @@ -16,8 +16,8 @@ use crate::dom::window::Window; use crate::task_source::TaskSource; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; -use net_traits::IpcSend; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; +use net_traits::IpcSend; use profile_traits::ipc; use script_traits::ScriptMsg; use servo_url::ServoUrl; diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index c6b78cc9f7ab..e0af2a2b2952 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -4,8 +4,8 @@ use crate::dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use crate::dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::Wrap; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylevalue::CSSStyleValue; diff --git a/components/script/dom/stylesheet.rs b/components/script/dom/stylesheet.rs index daeb028e31ae..f7486a9a532b 100644 --- a/components/script/dom/stylesheet.rs +++ b/components/script/dom/stylesheet.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::StyleSheetBinding; use crate::dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs index fa295c1adc42..68274dfa8ef4 100644 --- a/components/script/dom/stylesheetlist.rs +++ b/components/script/dom/stylesheetlist.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::StyleSheetListBinding; use crate::dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::document::Document; use crate::dom::stylesheet::StyleSheet; diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 436829b18762..e0f9af46b3b9 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -8,23 +8,37 @@ use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::codegen::Bindings::EventListenerBinding::EventListener; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{self, SimpleCallback}; -use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{TestBindingMethods, TestDictionary}; -use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{TestDictionaryDefaults, TestEnum}; +use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{ + TestBindingMethods, TestDictionary, +}; +use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{ + TestDictionaryDefaults, TestEnum, +}; use crate::dom::bindings::codegen::UnionTypes; -use crate::dom::bindings::codegen::UnionTypes::{BlobOrBoolean, BlobOrBlobSequence, LongOrLongSequenceSequence}; +use crate::dom::bindings::codegen::UnionTypes::{ + BlobOrBlobSequence, BlobOrBoolean, LongOrLongSequenceSequence, +}; use crate::dom::bindings::codegen::UnionTypes::{BlobOrString, BlobOrUnsignedLong, EventOrString}; -use crate::dom::bindings::codegen::UnionTypes::{ByteStringOrLong, ByteStringSequenceOrLongOrString}; +use crate::dom::bindings::codegen::UnionTypes::{ + ByteStringOrLong, ByteStringSequenceOrLongOrString, +}; use crate::dom::bindings::codegen::UnionTypes::{ByteStringSequenceOrLong, DocumentOrTestTypedef}; -use crate::dom::bindings::codegen::UnionTypes::{EventOrUSVString, HTMLElementOrLong, LongSequenceOrTestTypedef}; -use crate::dom::bindings::codegen::UnionTypes::{HTMLElementOrUnsignedLongOrStringOrBoolean, LongSequenceOrBoolean}; +use crate::dom::bindings::codegen::UnionTypes::{ + EventOrUSVString, HTMLElementOrLong, LongSequenceOrTestTypedef, +}; +use crate::dom::bindings::codegen::UnionTypes::{ + HTMLElementOrUnsignedLongOrStringOrBoolean, LongSequenceOrBoolean, +}; use crate::dom::bindings::codegen::UnionTypes::{StringOrBoolean, UnsignedLongOrBoolean}; use crate::dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence}; -use crate::dom::bindings::codegen::UnionTypes::{StringSequenceOrUnsignedLong, StringOrUnsignedLong}; +use crate::dom::bindings::codegen::UnionTypes::{ + StringOrUnsignedLong, StringSequenceOrUnsignedLong, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::mozmap::MozMap; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{ByteString, DOMString, USVString}; use crate::dom::bindings::trace::RootedTraceableBox; @@ -32,15 +46,15 @@ use crate::dom::bindings::weakref::MutableWeakRef; use crate::dom::blob::{Blob, BlobImpl}; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; -use crate::dom::promisenativehandler::{PromiseNativeHandler, Callback}; +use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler}; use crate::dom::url::URL; use crate::timers::OneshotTimerCallback; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray}; use js::jsval::{JSVal, NullValue}; -use js::rust::{HandleObject, HandleValue}; use js::rust::CustomAutoRooterGuard; +use js::rust::{HandleObject, HandleValue}; use js::typedarray; use script_traits::MsDuration; use servo_config::prefs::PREFS; diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index 90079a8355a9..232bf911943a 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -5,9 +5,11 @@ // check-tidy: no specs after this line use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::TestBindingIterableBinding::{self, TestBindingIterableMethods}; +use crate::dom::bindings::codegen::Bindings::TestBindingIterableBinding::{ + self, TestBindingIterableMethods, +}; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index 6ba99a720aac..2cdaa0c6be39 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::TestBindingPairIterableBinding; use crate::dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindingPairIterableMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs index b25ed715f7ab..eb1c34f8750b 100644 --- a/components/script/dom/testrunner.rs +++ b/components/script/dom/testrunner.rs @@ -6,7 +6,7 @@ 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}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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; diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index ea25de058d15..5634e491eed2 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -9,8 +9,8 @@ use crate::dom::bindings::codegen::Bindings::TestWorkletBinding::Wrap; use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletBinding::WorkletMethods; use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::str::USVString; diff --git a/components/script/dom/textcontrol.rs b/components/script/dom/textcontrol.rs index 2b862c2c6cfa..3ed20a2901a1 100644 --- a/components/script/dom/textcontrol.rs +++ b/components/script/dom/textcontrol.rs @@ -14,7 +14,7 @@ use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::str::DOMString; use crate::dom::event::{EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; -use crate::dom::node::{Node, NodeDamage, window_from_node}; +use crate::dom::node::{window_from_node, Node, NodeDamage}; use crate::textinput::{SelectionDirection, SelectionState, TextInput}; use script_traits::ScriptToConstellationChan; diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index ef66a88132f8..892a7aaf0a32 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -3,10 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::TextDecoderBinding; -use crate::dom::bindings::codegen::Bindings::TextDecoderBinding::{TextDecoderMethods, TextDecodeOptions}; +use crate::dom::bindings::codegen::Bindings::TextDecoderBinding::{ + TextDecodeOptions, TextDecoderMethods, +}; use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index f1ebd4cb6b11..d71f60241691 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -5,13 +5,13 @@ use crate::dom::bindings::codegen::Bindings::TextEncoderBinding; use crate::dom::bindings::codegen::Bindings::TextEncoderBinding::TextEncoderMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{JSContext, JSObject}; -use js::typedarray::{Uint8Array, CreateWith}; +use js::typedarray::{CreateWith, Uint8Array}; use std::ptr; use std::ptr::NonNull; diff --git a/components/script/dom/timeranges.rs b/components/script/dom/timeranges.rs index 4aec4cac7ef7..f03a50f70edb 100644 --- a/components/script/dom/timeranges.rs +++ b/components/script/dom/timeranges.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::TimeRangesBinding; use crate::dom::bindings::codegen::Bindings::TimeRangesBinding::TimeRangesMethods; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs index e89310cb2317..4fb66c77b4e3 100644 --- a/components/script/dom/touch.rs +++ b/components/script/dom/touch.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::TouchBinding; use crate::dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{DomRoot, MutDom}; use crate::dom::eventtarget::EventTarget; use crate::dom::window::Window; diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs index 5f760daba87c..163896438063 100644 --- a/components/script/dom/touchlist.rs +++ b/components/script/dom/touchlist.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::TouchListBinding; use crate::dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::touch::Touch; use crate::dom::window::Window; diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs index a855fbc1f146..e5640766f0e0 100644 --- a/components/script/dom/transitionevent.rs +++ b/components/script/dom/transitionevent.rs @@ -4,7 +4,9 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::TransitionEventBinding; -use crate::dom::bindings::codegen::Bindings::TransitionEventBinding::{TransitionEventInit, TransitionEventMethods}; +use crate::dom::bindings::codegen::Bindings::TransitionEventBinding::{ + TransitionEventInit, TransitionEventMethods, +}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 11b462becf38..2b3743d6f5ac 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConsta use crate::dom::bindings::codegen::Bindings::TreeWalkerBinding; use crate::dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, MutDom}; use crate::dom::document::Document; use crate::dom::node::Node; diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 22f5f9a0fdcf..fbca478868e8 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::blob::Blob; @@ -13,9 +13,9 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::urlhelper::UrlHelper; use crate::dom::urlsearchparams::URLSearchParams; use dom_struct::dom_struct; -use net_traits::{CoreResourceMsg, IpcSend}; use net_traits::blob_url_store::{get_blob_origin, parse_blob_url}; use net_traits::filemanager_thread::FileManagerThreadMsg; +use net_traits::{CoreResourceMsg, IpcSend}; use profile_traits::ipc; use servo_url::ServoUrl; use std::default::Default; diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 5a417b73bd92..d609c773a3e8 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchPa use crate::dom::bindings::codegen::UnionTypes::USVStringOrURLSearchParams; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::iterable::Iterable; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::bindings::weakref::MutableWeakRef; diff --git a/components/script/dom/userscripts.rs b/components/script/dom/userscripts.rs index bbd0e2f45a8c..3ca0813953d6 100644 --- a/components/script/dom/userscripts.rs +++ b/components/script/dom/userscripts.rs @@ -8,7 +8,7 @@ use crate::dom::htmlheadelement::HTMLHeadElement; use crate::dom::node::Node; use js::jsval::UndefinedValue; use servo_config::opts; -use std::fs::{File, read_dir}; +use std::fs::{read_dir, File}; use std::io::Read; use std::path::PathBuf; diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index 0ef35ea455f0..f10a1deeb382 100755 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::ValidityStateBinding; use crate::dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::element::Element; use crate::dom::window::Window; diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index eb6fc7cd88f7..6cf6bed104bf 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::VRBinding::VRMethods; use crate::dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index 1d2a2370b1e6..1cf43df45530 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::Windo use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{DomRoot, MutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/vrdisplaycapabilities.rs b/components/script/dom/vrdisplaycapabilities.rs index a4e7025432ae..6c178a152687 100644 --- a/components/script/dom/vrdisplaycapabilities.rs +++ b/components/script/dom/vrdisplaycapabilities.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding; use crate::dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding::VRDisplayCapabilitiesMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index abfb9075e521..03155c14b5d0 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEve use crate::dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEventReason; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::event::Event; diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index aaf6f3d517a6..a37ad7ffe876 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -5,13 +5,13 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VREyeParametersBinding; use crate::dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::vrfieldofview::VRFieldOfView; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; -use js::typedarray::{Float32Array, CreateWith}; +use js::typedarray::{CreateWith, Float32Array}; use std::default::Default; use std::ptr; use std::ptr::NonNull; diff --git a/components/script/dom/vrfieldofview.rs b/components/script/dom/vrfieldofview.rs index fa9d69d40862..81fe31ba5c42 100644 --- a/components/script/dom/vrfieldofview.rs +++ b/components/script/dom/vrfieldofview.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VRFieldOfViewBinding; use crate::dom::bindings::codegen::Bindings::VRFieldOfViewBinding::VRFieldOfViewMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index 054e5b973ab6..d7817a6dd183 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -6,14 +6,14 @@ use crate::dom::bindings::codegen::Bindings::VRFrameDataBinding; use crate::dom::bindings::codegen::Bindings::VRFrameDataBinding::VRFrameDataMethods; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::vrpose::VRPose; use crate::dom::window::Window; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; -use js::typedarray::{Float32Array, CreateWith}; +use js::typedarray::{CreateWith, Float32Array}; use std::cell::Cell; use std::ptr; use std::ptr::NonNull; diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs index c325828ccd4e..11cd7e59855f 100644 --- a/components/script/dom/vrpose.rs +++ b/components/script/dom/vrpose.rs @@ -4,12 +4,12 @@ use crate::dom::bindings::codegen::Bindings::VRPoseBinding; use crate::dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; -use js::typedarray::{Float32Array, CreateWith}; +use js::typedarray::{CreateWith, Float32Array}; use std::ptr; use std::ptr::NonNull; use webvr_traits::webvr; diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs index f7dddfc3ec22..5d768af222bf 100644 --- a/components/script/dom/vrstageparameters.rs +++ b/components/script/dom/vrstageparameters.rs @@ -6,12 +6,12 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VRStageParametersBinding; use crate::dom::bindings::codegen::Bindings::VRStageParametersBinding::VRStageParametersMethods; use crate::dom::bindings::num::Finite; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; -use js::typedarray::{Float32Array, CreateWith}; +use js::typedarray::{CreateWith, Float32Array}; use std::ptr; use std::ptr::NonNull; use webvr_traits::WebVRStageParameters; diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index c63c105a01ea..275612bc69e4 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -23,7 +23,9 @@ use crate::dom::webglbuffer::WebGLBuffer; use crate::dom::webglframebuffer::WebGLFramebuffer; use crate::dom::webglprogram::WebGLProgram; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; -use crate::dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext}; +use crate::dom::webglrenderingcontext::{ + LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext, +}; use crate::dom::webglshader::WebGLShader; use crate::dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat; use crate::dom::webgltexture::WebGLTexture; diff --git a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs index 74d779a94a32..21712a6a90c7 100644 --- a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs +++ b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs @@ -2,15 +2,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +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::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct ANGLEInstancedArrays { diff --git a/components/script/dom/webgl_extensions/ext/extblendminmax.rs b/components/script/dom/webgl_extensions/ext/extblendminmax.rs index 060595f5c516..19aa0e06a974 100644 --- a/components/script/dom/webgl_extensions/ext/extblendminmax.rs +++ b/components/script/dom/webgl_extensions/ext/extblendminmax.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use canvas_traits::webgl::WebGLVersion; use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct EXTBlendMinmax { diff --git a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs index d1500aa2c9e5..aa1d25f024b3 100644 --- a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use canvas_traits::webgl::WebGLVersion; use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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 dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct EXTColorBufferHalfFloat { diff --git a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs index 4faf199bfde6..219904b13b78 100644 --- a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs +++ b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::webgl::{WebGLVersion, is_gles}; +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; +use canvas_traits::webgl::{is_gles, WebGLVersion}; use crate::dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct EXTShaderTextureLod { diff --git a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs index 9b491c685bf1..f487ab4775e1 100644 --- a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs +++ b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use 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::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct EXTTextureFilterAnisotropic { diff --git a/components/script/dom/webgl_extensions/ext/mod.rs b/components/script/dom/webgl_extensions/ext/mod.rs index 54290ceb9ebf..174653e33326 100644 --- a/components/script/dom/webgl_extensions/ext/mod.rs +++ b/components/script/dom/webgl_extensions/ext/mod.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{ext_constants, WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use super::{ext_constants, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; pub mod angleinstancedarrays; pub mod extblendminmax; diff --git a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs index 65e6829831f9..2a06fbe35f21 100644 --- a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs +++ b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::webgl::{WebGLVersion, is_gles}; +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; +use canvas_traits::webgl::{is_gles, WebGLVersion}; use crate::dom::bindings::codegen::Bindings::OESElementIndexUintBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESElementIndexUint { diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs index 6afef692953a..6a2c76aedb14 100644 --- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs +++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::webgl::{WebGLVersion, is_gles}; +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::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESStandardDerivatives { diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs index 0c468cf1fa27..6db9c6473d12 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs @@ -2,13 +2,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +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::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESTextureFloat { diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs index 57d7a594c221..31fb196efa2c 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESTextureFloatLinearBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{constants as webgl, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESTextureFloatLinear { diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs index 695d77ee67b3..1ab369b8304c 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs @@ -2,13 +2,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use 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::{DomObject, Reflector, reflect_dom_object}; +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 dom_struct::dom_struct; -use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESTextureHalfFloat { diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs index dd44caca9cab..07109f6576ec 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatLinearBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESTextureHalfFloatLinear { diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index ba1256538d49..5238a4c287c9 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -2,15 +2,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use canvas_traits::webgl::WebGLVersion; -use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods}; use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{ + self, OESVertexArrayObjectMethods, +}; +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 dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct OESVertexArrayObject { diff --git a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs index aceaf0267280..263d21fe8825 100644 --- a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs +++ b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use canvas_traits::webgl::WebGLVersion; use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +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 dom_struct::dom_struct; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; #[dom_struct] pub struct WEBGLColorBufferFloat { diff --git a/components/script/dom/webgl_extensions/extension.rs b/components/script/dom/webgl_extensions/extension.rs index 6256eb4b6083..53e3e8b21a7e 100644 --- a/components/script/dom/webgl_extensions/extension.rs +++ b/components/script/dom/webgl_extensions/extension.rs @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use 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 super::WebGLExtensions; /// 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 52f4bf4d47fe..76c995068dca 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +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; @@ -23,8 +25,6 @@ use malloc_size_of::MallocSizeOf; use std::collections::HashMap; use std::iter::FromIterator; use std::ptr::NonNull; -use super::{ext, WebGLExtension, WebGLExtensionSpec}; -use super::wrapper::{WebGLExtensionWrapper, TypedWebGLExtensionWrapper}; // Data types that are implemented for texImage2D and texSubImage2D in a WebGL 1.0 context // but must trigger a InvalidValue error until the related WebGL Extensions are enabled. diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs index 6b39fc0e2bc4..9918952dc73a 100644 --- a/components/script/dom/webgl_extensions/wrapper.rs +++ b/components/script/dom/webgl_extensions/wrapper.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::MutNullableDom; use crate::dom::bindings::trace::JSTraceable; @@ -10,7 +11,6 @@ use js::jsapi::JSObject; use malloc_size_of::MallocSizeOf; use std::any::Any; use std::ptr::NonNull; -use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; /// Trait used internally by WebGLExtensions to store and /// handle the different WebGL extensions in a common list. diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index b60189f93820..125ff4918a89 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use super::types::{TexDataType, TexFormat, TexImageTarget}; +use super::WebGLValidator; use canvas_traits::webgl::WebGLError::*; use crate::dom::bindings::root::DomRoot; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webgltexture::WebGLTexture; use std::{self, fmt}; -use super::WebGLValidator; -use super::types::{TexImageTarget, TexDataType, TexFormat}; /// The errors that the texImage* family of functions can generate. #[derive(Debug)] diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs index 2f6d9ee54f07..fed724c25a13 100644 --- a/components/script/dom/webglactiveinfo.rs +++ b/components/script/dom/webglactiveinfo.rs @@ -5,7 +5,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings::WebGLActiveInfoBinding; use crate::dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::window::Window; diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 28f0f7f1aa60..39b2080da39c 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -3,12 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl -use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult}; 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; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +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; diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index a5a130efea6b..ff241f8d78e5 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -3,13 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult}; use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId}; -use canvas_traits::webgl::{WebGLResult, WebGLError, webgl_channel}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 1a835da8c8d7..75dd2bd89ac6 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -3,13 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult}; use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLCommand, WebGLError}; -use canvas_traits::webgl::{WebGLProgramId, WebGLResult, webgl_channel}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGLProgramBinding; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::webglactiveinfo::WebGLActiveInfo; diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs index 616bfc353e3c..4e29172c070e 100644 --- a/components/script/dom/webglrenderbuffer.rs +++ b/components/script/dom/webglrenderbuffer.rs @@ -3,14 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl -use canvas_traits::webgl::{WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult, is_gles, webgl_channel}; +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; use crate::dom::bindings::codegen::Bindings::WebGLRenderbufferBinding; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +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; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 31d2ea67c880..2d431b934129 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -5,12 +5,12 @@ #[cfg(feature = "webgl_backtrace")] use backtrace::Backtrace; use byteorder::{ByteOrder, NativeEndian, WriteBytesExt}; +use canvas_traits::webgl::WebGLError::*; +use canvas_traits::webgl::{webgl_channel, WebGLVersion, WebVRCommand}; use canvas_traits::webgl::{DOMToTextureCommand, Parameter, WebGLCommandBacktrace}; use canvas_traits::webgl::{TexParameter, WebGLCommand, WebGLContextShareMode, WebGLError}; use canvas_traits::webgl::{WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender}; use canvas_traits::webgl::{WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSender}; -use canvas_traits::webgl::{WebGLVersion, WebVRCommand, webgl_channel}; -use canvas_traits::webgl::WebGLError::*; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants; use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding::EXTBlendMinmaxConstants; use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; @@ -25,23 +25,27 @@ use crate::dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence; use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; -use crate::dom::htmlcanvaselement::HTMLCanvasElement; use crate::dom::htmlcanvaselement::utils as canvas_utils; +use crate::dom::htmlcanvaselement::HTMLCanvasElement; use crate::dom::htmliframeelement::HTMLIFrameElement; -use crate::dom::node::{Node, NodeDamage, document_from_node, window_from_node}; +use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage}; use crate::dom::webgl_extensions::WebGLExtensions; -use crate::dom::webgl_validations::WebGLValidator; -use crate::dom::webgl_validations::tex_image_2d::{CommonTexImage2DValidator, CommonTexImage2DValidatorResult}; +use crate::dom::webgl_validations::tex_image_2d::{ + CommonTexImage2DValidator, CommonTexImage2DValidatorResult, +}; use crate::dom::webgl_validations::tex_image_2d::{TexImage2DValidator, TexImage2DValidatorResult}; use crate::dom::webgl_validations::types::{TexDataType, TexFormat, TexImageTarget}; +use crate::dom::webgl_validations::WebGLValidator; use crate::dom::webglactiveinfo::WebGLActiveInfo; use crate::dom::webglbuffer::WebGLBuffer; use crate::dom::webglcontextevent::WebGLContextEvent; -use crate::dom::webglframebuffer::{WebGLFramebuffer, WebGLFramebufferAttachmentRoot, CompleteForRendering}; +use crate::dom::webglframebuffer::{ + CompleteForRendering, WebGLFramebuffer, WebGLFramebufferAttachmentRoot, +}; use crate::dom::webglobject::WebGLObject; use crate::dom::webglprogram::WebGLProgram; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; @@ -56,10 +60,12 @@ use euclid::{Point2D, Rect, Size2D}; use half::f16; use ipc_channel::ipc; use js::jsapi::{JSContext, JSObject, Type}; -use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value, JSVal}; -use js::jsval::{ObjectValue, NullValue, UndefinedValue}; +use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, UInt32Value}; +use js::jsval::{NullValue, ObjectValue, UndefinedValue}; use js::rust::CustomAutoRooterGuard; -use js::typedarray::{ArrayBufferView, CreateWith, Float32, Float32Array, Int32, Int32Array, Uint32Array}; +use js::typedarray::{ + ArrayBufferView, CreateWith, Float32, Float32Array, Int32, Int32Array, Uint32Array, +}; use js::typedarray::{TypedArray, TypedArrayElementCreator}; use net_traits::image::base::PixelFormat; use net_traits::image_cache::ImageResponse; diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index 9add3e686b53..395bb9a9234a 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -3,18 +3,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use canvas_traits::webgl::{webgl_channel, WebGLVersion}; use canvas_traits::webgl::{WebGLCommand, WebGLError}; use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId}; -use canvas_traits::webgl::{WebGLVersion, webgl_channel}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGLShaderBinding; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; -use crate::dom::webgl_extensions::WebGLExtensions; use crate::dom::webgl_extensions::ext::extshadertexturelod::EXTShaderTextureLod; use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDerivatives; +use crate::dom::webgl_extensions::WebGLExtensions; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; @@ -22,7 +22,7 @@ use mozangle::shaders::{BuiltInResources, Output, ShaderValidator}; use offscreen_gl_context::GLLimits; use std::cell::Cell; use std::os::raw::c_int; -use std::sync::{ONCE_INIT, Once}; +use std::sync::{Once, ONCE_INIT}; #[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)] pub enum ShaderCompilationStatus { diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs index d0551554a969..b8d8da299d54 100644 --- a/components/script/dom/webglshaderprecisionformat.rs +++ b/components/script/dom/webglshaderprecisionformat.rs @@ -7,7 +7,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use crate::dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding; use crate::dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 443c5d031a17..2cc42a91f420 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -4,16 +4,16 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use canvas_traits::webgl::{webgl_channel, WebGLResult, WebGLTextureId}; use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError}; -use canvas_traits::webgl::{WebGLResult, WebGLTextureId, webgl_channel}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::codegen::Bindings::WebGLTextureBinding; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; -use crate::dom::webgl_validations::types::{TexImageTarget, TexFormat, TexDataType}; +use crate::dom::webgl_validations::types::{TexDataType, TexFormat, TexImageTarget}; use crate::dom::webglobject::WebGLObject; use crate::dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs index 58e51048f54d..4b8250ab9022 100644 --- a/components/script/dom/webgluniformlocation.rs +++ b/components/script/dom/webgluniformlocation.rs @@ -5,7 +5,7 @@ // 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::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs index 101e68679c6c..38c86b7cdc41 100644 --- a/components/script/dom/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webglvertexarrayobjectoes.rs @@ -2,12 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::webgl::{ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVertexArrayId}; +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; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::webglbuffer::WebGLBuffer; use crate::dom::webglobject::WebGLObject; diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index d7a90eca8fb5..b6c0de922770 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -11,9 +11,9 @@ use crate::dom::bindings::conversions::ToJSValConvertible; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::str::{DOMString, USVString, is_token}; +use crate::dom::bindings::str::{is_token, DOMString, USVString}; use crate::dom::blob::{Blob, BlobImpl}; use crate::dom::closeevent::CloseEvent; use crate::dom::event::{Event, EventBubbles, EventCancelable}; @@ -22,19 +22,19 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::script_runtime::CommonScriptMsg; use crate::script_runtime::ScriptThreadEventCategory::WebSocketEvent; -use crate::task::{TaskOnce, TaskCanceller}; -use crate::task_source::TaskSource; +use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::websocket::WebsocketTaskSource; +use crate::task_source::TaskSource; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use js::jsapi::{JSAutoCompartment, JSObject}; use js::jsval::UndefinedValue; use js::rust::CustomAutoRooterGuard; use js::typedarray::{ArrayBuffer, ArrayBufferView, CreateWith}; +use net_traits::request::{RequestInit, RequestMode}; +use net_traits::MessageData; use net_traits::{CoreResourceMsg, FetchChannels}; use net_traits::{WebSocketDomAction, WebSocketNetworkEvent}; -use net_traits::MessageData; -use net_traits::request::{RequestInit, RequestMode}; use profile_traits::ipc as ProfiledIpc; use servo_url::{ImmutableOrigin, ServoUrl}; use std::borrow::ToOwned; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 110c2cfb1370..c9ec7317a3c0 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -7,13 +7,17 @@ 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}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{ + DocumentMethods, DocumentReadyState, +}; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryBinding::HistoryMethods; use crate::dom::bindings::codegen::Bindings::MediaQueryListBinding::MediaQueryListBinding::MediaQueryListMethods; use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; -use crate::dom::bindings::codegen::Bindings::WindowBinding::{self, FrameRequestCallback, WindowMethods}; +use crate::dom::bindings::codegen::Bindings::WindowBinding::{ + self, FrameRequestCallback, WindowMethods, +}; use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; use crate::dom::bindings::codegen::UnionTypes::RequestOrUSVString; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; @@ -43,7 +47,7 @@ use crate::dom::mediaquerylist::{MediaQueryList, MediaQueryListMatchState}; use crate::dom::mediaquerylistevent::MediaQueryListEvent; use crate::dom::messageevent::MessageEvent; use crate::dom::navigator::Navigator; -use crate::dom::node::{Node, NodeDamage, document_from_node, from_untrusted_node_address}; +use crate::dom::node::{document_from_node, from_untrusted_node_address, Node, NodeDamage}; use crate::dom::performance::Performance; use crate::dom::promise::Promise; use crate::dom::screen::Screen; @@ -55,11 +59,12 @@ use crate::dom::workletglobalscope::WorkletGlobalScopeType; use crate::fetch; use crate::layout_image::fetch_image_for_layout; use crate::microtask::MicrotaskQueue; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, Runtime}; +use crate::script_runtime::{ + CommonScriptMsg, Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory, +}; use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg}; use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan}; use crate::task::TaskCanceller; -use crate::task_source::TaskSourceName; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use crate::task_source::file_reading::FileReadingTaskSource; use crate::task_source::history_traversal::HistoryTraversalTaskSource; @@ -69,13 +74,14 @@ use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; use crate::task_source::remote_event::RemoteEventTaskSource; use crate::task_source::user_interaction::UserInteractionTaskSource; use crate::task_source::websocket::WebsocketTaskSource; +use crate::task_source::TaskSourceName; use crate::timers::{IsInterval, TimerCallback}; use crate::webdriver_handlers::jsval_to_webdriver; use cssparser::{Parser, ParserInput}; use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; -use euclid::{Point2D, Vector2D, Rect, Size2D, TypedPoint2D, TypedScale, TypedSize2D}; +use euclid::{Point2D, Rect, Size2D, TypedPoint2D, TypedScale, TypedSize2D, Vector2D}; use ipc_channel::ipc::IpcSender; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoCompartment; @@ -84,45 +90,47 @@ use js::jsapi::JSPROP_ENUMERATE; use js::jsapi::JS_GC; use js::jsval::JSVal; use js::jsval::UndefinedValue; -use js::rust::HandleValue; use js::rust::wrappers::JS_DefineProperty; +use js::rust::HandleValue; use libc; use msg::constellation_msg::PipelineId; -use net_traits::{ResourceThreads, ReferrerPolicy}; use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse}; use net_traits::image_cache::{PendingImageId, PendingImageResponse}; use net_traits::storage_thread::StorageType; +use net_traits::{ReferrerPolicy, ResourceThreads}; use num_traits::ToPrimitive; use profile_traits::ipc as ProfiledIpc; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; -use script_layout_interface::{TrustedNodeAddress, PendingImageState}; -use script_layout_interface::message::{Msg, Reflow, QueryMsg, ReflowGoal, ScriptReflow}; +use script_layout_interface::message::{Msg, QueryMsg, Reflow, ReflowGoal, ScriptReflow}; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; -use script_layout_interface::rpc::{NodeScrollIdResponse, ResolvedStyleResponse, TextIndexResponse}; +use script_layout_interface::rpc::{ + NodeScrollIdResponse, ResolvedStyleResponse, TextIndexResponse, +}; +use script_layout_interface::{PendingImageState, TrustedNodeAddress}; +use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use script_traits::{ConstellationControlMsg, DocumentState, LoadData}; -use script_traits::{ScriptToConstellationChan, ScriptMsg, ScrollState, TimerEvent, TimerEventId}; +use script_traits::{ScriptMsg, ScriptToConstellationChan, ScrollState, TimerEvent, TimerEventId}; use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType}; -use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use selectors::attr::CaseSensitivity; use servo_arc; use servo_channel::{channel, Sender}; use servo_config::opts; use servo_geometry::{f32_rect_to_au_rect, MaxRect}; -use servo_url::{Host, MutableOrigin, ImmutableOrigin, ServoUrl}; +use servo_url::{Host, ImmutableOrigin, MutableOrigin, ServoUrl}; use std::borrow::ToOwned; use std::cell::Cell; -use std::collections::{HashMap, HashSet}; use std::collections::hash_map::Entry; +use std::collections::{HashMap, HashSet}; use std::default::Default; use std::env; use std::fs; -use std::io::{Write, stderr, stdout}; +use std::io::{stderr, stdout, Write}; use std::mem; use std::rc::Rc; -use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Mutex}; use style::error_reporting::ParseErrorReporter; use style::media_queries; use style::parser::ParserContext as CssParserContext; @@ -133,7 +141,9 @@ use style::stylesheets::CssRuleType; use style_traits::{CSSPixel, DevicePixel, ParsingMode}; use time; use url::Position; -use webrender_api::{DeviceIntPoint, DeviceUintSize, DocumentId, ExternalScrollId, RenderApiSender}; +use webrender_api::{ + DeviceIntPoint, DeviceUintSize, DocumentId, ExternalScrollId, RenderApiSender, +}; use webvr_traits::WebVRMsg; /// Current state of the window object diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index bc0fe4a9e09e..4de2eed66f4f 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -3,15 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject}; -use crate::dom::bindings::error::{Error, throw_dom_exception}; +use crate::dom::bindings::conversions::{root_from_handleobject, ToJSValConvertible}; +use crate::dom::bindings::error::{throw_dom_exception, Error}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use crate::dom::bindings::reflector::{DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot, RootedReference}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::trace::JSTraceable; -use crate::dom::bindings::utils::{WindowProxyHandler, get_array_index_from_id, AsVoidPtr}; +use crate::dom::bindings::utils::{get_array_index_from_id, AsVoidPtr, WindowProxyHandler}; use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow; use crate::dom::document::Document; use crate::dom::element::Element; @@ -21,15 +21,8 @@ use crate::script_thread::ScriptThread; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use ipc_channel::ipc; -use js::JSCLASS_IS_GLOBAL; use js::glue::{CreateWrapperProxyHandler, ProxyTraps}; -use js::glue::{GetProxyPrivate, SetProxyReservedSlot, GetProxyReservedSlot}; -use js::jsapi::{JSAutoCompartment, JSContext, JSErrNum, JSFreeOp, JSObject}; -use js::jsapi::{JSPROP_ENUMERATE, JSPROP_READONLY, JSTracer, JS_DefinePropertyById}; -use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo}; -use js::jsapi::{JS_HasPropertyById, JS_HasOwnPropertyById}; -use js::jsapi::{JS_IsExceptionPending, JS_GetOwnPropertyDescriptorById}; -use js::jsapi::{ObjectOpResult, PropertyDescriptor}; +use js::glue::{GetProxyPrivate, GetProxyReservedSlot, SetProxyReservedSlot}; use js::jsapi::Handle as RawHandle; use js::jsapi::HandleId as RawHandleId; use js::jsapi::HandleObject as RawHandleObject; @@ -37,10 +30,17 @@ use js::jsapi::HandleValue as RawHandleValue; use js::jsapi::MutableHandle as RawMutableHandle; use js::jsapi::MutableHandleObject as RawMutableHandleObject; use js::jsapi::MutableHandleValue as RawMutableHandleValue; -use js::jsval::{JSVal, NullValue, UndefinedValue, PrivateValue}; -use js::rust::{Handle, MutableHandle}; +use js::jsapi::{JSAutoCompartment, JSContext, JSErrNum, JSFreeOp, JSObject}; +use js::jsapi::{JSTracer, JS_DefinePropertyById, JSPROP_ENUMERATE, JSPROP_READONLY}; +use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo}; +use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending}; +use js::jsapi::{JS_HasOwnPropertyById, JS_HasPropertyById}; +use js::jsapi::{ObjectOpResult, PropertyDescriptor}; +use js::jsval::{JSVal, NullValue, PrivateValue, UndefinedValue}; use js::rust::get_object_class; -use js::rust::wrappers::{NewWindowProxy, SetWindowProxy, JS_TransplantObject}; +use js::rust::wrappers::{JS_TransplantObject, NewWindowProxy, SetWindowProxy}; +use js::rust::{Handle, MutableHandle}; +use js::JSCLASS_IS_GLOBAL; use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 3ad9525466c5..957d630ece1c 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -9,11 +9,13 @@ use crate::dom::bindings::codegen::Bindings::WorkerBinding::WorkerMethods; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone::StructuredCloneData; -use crate::dom::dedicatedworkerglobalscope::{DedicatedWorkerGlobalScope, DedicatedWorkerScriptMsg}; +use crate::dom::dedicatedworkerglobalscope::{ + DedicatedWorkerGlobalScope, DedicatedWorkerScriptMsg, +}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; @@ -28,8 +30,8 @@ use js::rust::HandleValue; use script_traits::WorkerScriptLoadOrigin; use servo_channel::{channel, Sender}; use std::cell::Cell; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; pub type TrustedWorkerAddress = Trusted; diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index e7c141f15002..a9b1fc4aca47 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use crate::dom::bindings::codegen::UnionTypes::RequestOrUSVString; -use crate::dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; +use crate::dom::bindings::error::{report_pending_exception, Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; @@ -23,7 +23,7 @@ use crate::dom::window::{base64_atob, base64_btoa}; use crate::dom::workerlocation::WorkerLocation; use crate::dom::workernavigator::WorkerNavigator; use crate::fetch; -use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, get_reports, Runtime}; +use crate::script_runtime::{get_reports, CommonScriptMsg, Runtime, ScriptChan, ScriptPort}; use crate::task::TaskCanceller; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use crate::task_source::file_reading::FileReadingTaskSource; @@ -40,16 +40,16 @@ use js::jsval::UndefinedValue; use js::panic::maybe_resume_unwind; use js::rust::HandleValue; use msg::constellation_msg::PipelineId; -use net_traits::{IpcSend, load_whole_resource}; use net_traits::request::{CredentialsMode, Destination, RequestInit as NetRequestInit}; -use script_traits::{TimerEvent, TimerEventId}; +use net_traits::{load_whole_resource, IpcSend}; use script_traits::WorkerGlobalScopeInit; +use script_traits::{TimerEvent, TimerEventId}; use servo_channel::Receiver; use servo_url::{MutableOrigin, ServoUrl}; use std::default::Default; use std::rc::Rc; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; use time::precise_time_ns; pub fn prepare_workerscope_init( diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index 5ff7c05961cc..e48fe96d466a 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::WorkerLocationBinding; use crate::dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::{DOMString, USVString}; use crate::dom::urlhelper::UrlHelper; diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index 6c1f5526a15a..f98dc3e7b13d 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -4,7 +4,7 @@ use crate::dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use crate::dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods; -use crate::dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::navigatorinfo; diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 07c21fc59993..5a88fa418431 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -18,8 +18,8 @@ use crate::dom::bindings::codegen::Bindings::WorkletBinding::Wrap; use crate::dom::bindings::error::Error; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::TrustedPromise; -use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::{Dom, DomRoot, RootCollection, ThreadLocalStackRoots}; use crate::dom::bindings::str::USVString; use crate::dom::bindings::trace::JSTraceable; @@ -32,39 +32,39 @@ use crate::dom::workletglobalscope::WorkletGlobalScope; use crate::dom::workletglobalscope::WorkletGlobalScopeInit; use crate::dom::workletglobalscope::WorkletGlobalScopeType; use crate::dom::workletglobalscope::WorkletTask; +use crate::script_runtime::new_rt_and_cx; use crate::script_runtime::CommonScriptMsg; use crate::script_runtime::Runtime; use crate::script_runtime::ScriptThreadEventCategory; -use crate::script_runtime::new_rt_and_cx; use crate::script_thread::{MainThreadScriptMsg, ScriptThread}; use crate::task::TaskBox; use crate::task_source::TaskSourceName; use dom_struct::dom_struct; use js::jsapi::JSGCParamKey; use js::jsapi::JSTracer; -use js::jsapi::JS_GC; use js::jsapi::JS_GetGCParameter; +use js::jsapi::JS_GC; use msg::constellation_msg::PipelineId; -use net_traits::IpcSend; use net_traits::load_whole_resource; use net_traits::request::Destination; use net_traits::request::RequestInit; use net_traits::request::RequestMode; -use servo_channel::{channel, Sender, Receiver}; +use net_traits::IpcSend; +use servo_channel::{channel, Receiver, Sender}; use servo_rand; use servo_url::ImmutableOrigin; use servo_url::ServoUrl; use std::cmp::max; -use std::collections::HashMap; use std::collections::hash_map; +use std::collections::HashMap; use std::rc::Rc; -use std::sync::Arc; use std::sync::atomic::AtomicIsize; use std::sync::atomic::Ordering; +use std::sync::Arc; use std::thread; use style::thread_state::{self, ThreadState}; -use swapper::Swapper; use swapper::swapper; +use swapper::Swapper; use uuid::Uuid; // Magic numbers diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index eab249abc127..9e672723c549 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -19,8 +19,8 @@ use js::jsapi::JSContext; use js::jsval::UndefinedValue; use js::rust::Runtime; use msg::constellation_msg::PipelineId; -use net_traits::ResourceThreads; use net_traits::image_cache::ImageCache; +use net_traits::ResourceThreads; use profile_traits::mem; use profile_traits::time; use script_traits::{Painter, ScriptMsg}; diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 038a7a018bd8..bfb1916211d0 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -15,12 +15,12 @@ use crate::dom::bindings::conversions::ToJSValConvertible; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; -use crate::dom::bindings::reflector::{DomObject, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; -use crate::dom::bindings::str::{ByteString, DOMString, USVString, is_token}; +use crate::dom::bindings::str::{is_token, ByteString, DOMString, USVString}; use crate::dom::blob::{Blob, BlobImpl}; -use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::document::DocumentSource; +use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::formdata::FormData; @@ -37,8 +37,8 @@ use crate::dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget; use crate::dom::xmlhttprequestupload::XMLHttpRequestUpload; use crate::fetch::FetchCanceller; use crate::network_listener::{NetworkListener, PreInvoke}; -use crate::task_source::TaskSourceName; use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::TaskSourceName; use crate::timers::{OneshotTimerCallback, OneshotTimerHandle}; use dom_struct::dom_struct; use encoding_rs::{Encoding, UTF_8}; @@ -52,17 +52,17 @@ use hyper::Method; use hyper_serde::Serde; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use js::jsapi::{Heap, JSContext, JSObject}; use js::jsapi::JS_ClearPendingException; +use js::jsapi::{Heap, JSContext, JSObject}; use js::jsval::{JSVal, NullValue, UndefinedValue}; use js::rust::wrappers::JS_ParseJSON; use js::typedarray::{ArrayBuffer, CreateWith}; use mime::{self, Mime, Name}; -use net_traits::{FetchChannels, FetchMetadata, FilteredMetadata}; -use net_traits::{FetchResponseListener, NetworkError, ReferrerPolicy}; -use net_traits::CoreResourceMsg::Fetch; use net_traits::request::{CredentialsMode, Destination, RequestInit, RequestMode}; use net_traits::trim_http_whitespace; +use net_traits::CoreResourceMsg::Fetch; +use net_traits::{FetchChannels, FetchMetadata, FilteredMetadata}; +use net_traits::{FetchResponseListener, NetworkError, ReferrerPolicy}; use script_traits::DocumentActivity; use servo_atoms::Atom; use servo_url::ServoUrl; diff --git a/components/script/fetch.rs b/components/script/fetch.rs index 319a965dcab9..01bc19945a8b 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -23,11 +23,11 @@ use crate::task_source::TaskSourceName; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoCompartment; -use net_traits::{FetchChannels, FetchResponseListener, NetworkError}; -use net_traits::{FilteredMetadata, FetchMetadata, Metadata}; -use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch; -use net_traits::request::{Request as NetTraitsRequest, ServiceWorkersMode}; use net_traits::request::RequestInit as NetTraitsRequestInit; +use net_traits::request::{Request as NetTraitsRequest, ServiceWorkersMode}; +use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch; +use net_traits::{FetchChannels, FetchResponseListener, NetworkError}; +use net_traits::{FetchMetadata, FilteredMetadata, Metadata}; use servo_url::ServoUrl; use std::mem; use std::rc::Rc; diff --git a/components/script/layout_image.rs b/components/script/layout_image.rs index 5ede7398506d..99240074eaa3 100644 --- a/components/script/layout_image.rs +++ b/components/script/layout_image.rs @@ -8,14 +8,14 @@ //! layout thread holds on to them during asynchronous operations. use crate::dom::bindings::reflector::DomObject; -use crate::dom::node::{Node, document_from_node}; +use crate::dom::node::{document_from_node, Node}; use crate::network_listener::{NetworkListener, PreInvoke}; use crate::task_source::TaskSourceName; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use net_traits::{FetchResponseMsg, FetchResponseListener, FetchMetadata, NetworkError}; use net_traits::image_cache::{ImageCache, PendingImageId}; use net_traits::request::{Destination, RequestInit as FetchRequestInit}; +use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError}; use servo_url::ServoUrl; use std::sync::{Arc, Mutex}; diff --git a/components/script/network_listener.rs b/components/script/network_listener.rs index 6a7512c05610..bf67d16071c0 100644 --- a/components/script/network_listener.rs +++ b/components/script/network_listener.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::task::{TaskCanceller, TaskOnce}; -use crate::task_source::TaskSource; use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::TaskSource; use net_traits::{Action, FetchResponseListener, FetchResponseMsg}; use std::sync::{Arc, Mutex}; diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 2625bb4d3ce7..8647c48d1cea 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -9,12 +9,12 @@ use crate::dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; use crate::dom::bindings::conversions::get_dom_class; use crate::dom::bindings::conversions::private_from_object; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; +use crate::dom::bindings::refcounted::{trace_refcounted_objects, LiveDOMReferences}; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::trace_roots; use crate::dom::bindings::settings_stack; -use crate::dom::bindings::trace::{JSTraceable, trace_traceables}; +use crate::dom::bindings::trace::{trace_traceables, JSTraceable}; use crate::dom::bindings::utils::DOM_CALLBACKS; use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus}; use crate::dom::eventtarget::EventTarget; @@ -27,19 +27,21 @@ use crate::task::TaskBox; use crate::task_source::{TaskSource, TaskSourceName}; use js::glue::CollectServoSizes; use js::glue::SetBuildId; +use js::jsapi::ContextOptionsRef; use js::jsapi::{BuildIdCharVector, DisableIncrementalGC, GCDescription, GCProgress}; -use js::jsapi::{Heap, HandleObject}; +use js::jsapi::{HandleObject, Heap}; use js::jsapi::{JSContext, JSTracer, SetDOMCallbacks, SetGCSliceCallback}; use js::jsapi::{JSGCInvocationKind, JSGCStatus, JS_AddExtraGCRootsTracer, JS_SetGCCallback}; use js::jsapi::{JSGCMode, JSGCParamKey, JS_SetGCParameter, JS_SetGlobalJitCompilerOption}; -use js::jsapi::{JSJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled}; +use js::jsapi::{ + JSJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled, +}; use js::jsapi::{JSObject, PromiseRejectionHandlingState, SetPreserveWrapperCallback}; use js::jsapi::{SetBuildIdOp, SetEnqueuePromiseJobCallback, SetPromiseRejectionTrackerCallback}; -use js::jsapi::ContextOptionsRef; use js::panic::wrap_panic; +use js::rust::wrappers::{GetPromiseIsHandled, GetPromiseResult}; use js::rust::Handle; use js::rust::Runtime as RustRuntime; -use js::rust::wrappers::{GetPromiseIsHandled, GetPromiseResult}; use malloc_size_of::MallocSizeOfOps; use msg::constellation_msg::PipelineId; use profile_traits::mem::{Report, ReportKind, ReportsChan}; @@ -47,14 +49,14 @@ use servo_config::opts; use servo_config::prefs::PREFS; use std::cell::Cell; use std::fmt; -use std::io::{Write, stdout}; +use std::io::{stdout, Write}; use std::ops::Deref; use std::os; use std::os::raw::c_void; use std::panic::AssertUnwindSafe; use std::ptr; use style::thread_state::{self, ThreadState}; -use time::{Tm, now}; +use time::{now, Tm}; /// Common messages used to control the event loops in both the script and the worker pub enum CommonScriptMsg { @@ -688,7 +690,7 @@ unsafe extern "C" fn servo_build_id(build_id: *mut BuildIdCharVector) -> bool { #[allow(unsafe_code)] #[cfg(feature = "debugmozjs")] unsafe fn set_gc_zeal_options(cx: *mut JSContext) { - use js::jsapi::{JS_DEFAULT_ZEAL_FREQ, JS_SetGCZeal}; + use js::jsapi::{JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ}; let level = match PREFS.get("js.mem.gc.zeal.level").as_i64() { Some(level @ 0...14) => level as u8, diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 02832ba45ace..abd7ec4fa1b7 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -24,11 +24,15 @@ use canvas_traits::webgl::WebGLPipeline; use crate::devtools; use crate::document_loader::DocumentLoader; use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::{ + DocumentMethods, DocumentReadyState, +}; use crate::dom::bindings::codegen::Bindings::EventBinding::EventInit; use crate::dom::bindings::codegen::Bindings::TransitionEventBinding::TransitionEventInit; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; +use crate::dom::bindings::conversions::{ + ConversionResult, FromJSValConvertible, StringificationBehavior, +}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::reflector::DomObject; @@ -38,15 +42,19 @@ use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone::StructuredCloneData; use crate::dom::bindings::trace::JSTraceable; use crate::dom::bindings::utils::WRAP_CALLBACKS; -use crate::dom::customelementregistry::{CallbackReaction, CustomElementDefinition, CustomElementReactionStack}; -use crate::dom::document::{Document, DocumentSource, FocusType, HasBrowsingContext, IsHTMLDocument, TouchEventResult}; +use crate::dom::customelementregistry::{ + CallbackReaction, CustomElementDefinition, CustomElementReactionStack, +}; +use crate::dom::document::{ + Document, DocumentSource, FocusType, HasBrowsingContext, IsHTMLDocument, TouchEventResult, +}; use crate::dom::element::Element; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlanchorelement::HTMLAnchorElement; use crate::dom::htmliframeelement::{HTMLIFrameElement, NavigationType}; use crate::dom::mutationobserver::MutationObserver; -use crate::dom::node::{Node, NodeDamage, window_from_node, from_untrusted_node_address}; +use crate::dom::node::{from_untrusted_node_address, window_from_node, Node, NodeDamage}; use crate::dom::performanceentry::PerformanceEntry; use crate::dom::performancepainttiming::PerformancePaintTiming; use crate::dom::serviceworker::TrustedServiceWorkerAddress; @@ -60,12 +68,11 @@ use crate::dom::worker::TrustedWorkerAddress; use crate::dom::worklet::WorkletThreadPool; use crate::dom::workletglobalscope::WorkletGlobalScopeInit; use crate::fetch::FetchCanceller; -use crate::microtask::{MicrotaskQueue, Microtask}; +use crate::microtask::{Microtask, MicrotaskQueue}; +use crate::script_runtime::{get_reports, new_rt_and_cx, Runtime, ScriptPort}; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; -use crate::script_runtime::{ScriptPort, get_reports, new_rt_and_cx, Runtime}; use crate::serviceworkerjob::{Job, JobQueue}; use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue}; -use crate::task_source::TaskSourceName; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use crate::task_source::file_reading::FileReadingTaskSource; use crate::task_source::history_traversal::HistoryTraversalTaskSource; @@ -75,12 +82,13 @@ use crate::task_source::performance_timeline::PerformanceTimelineTaskSource; use crate::task_source::remote_event::RemoteEventTaskSource; use crate::task_source::user_interaction::UserInteractionTaskSource; use crate::task_source::websocket::WebsocketTaskSource; +use crate::task_source::TaskSourceName; use crate::webdriver_handlers; +use devtools_traits::CSSError; use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; -use devtools_traits::CSSError; use embedder_traits::EmbedderMsg; -use euclid::{Point2D, Vector2D, Rect}; +use euclid::{Point2D, Rect, Vector2D}; use headers_core::HeaderMapExt; use headers_ext::LastModified; use headers_ext::ReferrerPolicy as ReferrerPolicyHeader; @@ -90,31 +98,35 @@ use js::glue::GetWindowProxyClass; use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks}; use js::jsapi::{JSTracer, SetWindowProxyClass}; use js::jsval::UndefinedValue; -use metrics::{MAX_TASK_NS, PaintTimeMetrics}; +use metrics::{PaintTimeMetrics, MAX_TASK_NS}; use mime::{self, Mime}; use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId}; use msg::constellation_msg::{PipelineNamespace, TopLevelBrowsingContextId}; -use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg}; -use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestInit}; use net_traits::storage_thread::StorageType; +use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg}; +use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan}; -use profile_traits::time::{self as profile_time, ProfilerCategory, profile}; +use profile_traits::time::{self as profile_time, profile, ProfilerCategory}; use script_layout_interface::message::{self, Msg, NewLayoutThreadInfo, ReflowGoal}; +use script_traits::webdriver_msg::WebDriverScriptCommand; +use script_traits::CompositorEvent::{ + KeyboardEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent, TouchEvent, +}; use script_traits::{CompositorEvent, ConstellationControlMsg}; use script_traits::{DiscardBrowsingContext, DocumentActivity, EventResult}; use script_traits::{InitialScriptState, JsEvalResult, LayoutMsg, LoadData}; use script_traits::{MouseButton, MouseEventType, NewLayoutInfo}; -use script_traits::{ProgressiveWebMetricType, Painter, ScriptMsg, ScriptThreadFactory}; +use script_traits::{Painter, ProgressiveWebMetricType, ScriptMsg, ScriptThreadFactory}; use script_traits::{ScriptToConstellationChan, TimerEvent, TimerSchedulerMsg}; use script_traits::{TimerSource, TouchEventType, TouchId, UntrustedNodeAddress}; use script_traits::{UpdatePipelineIdReason, WindowSizeData, WindowSizeType}; -use script_traits::CompositorEvent::{KeyboardEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent, TouchEvent}; -use script_traits::webdriver_msg::WebDriverScriptCommand; use servo_atoms::Atom; use servo_channel::{channel, Receiver, Sender}; -use servo_channel::{route_ipc_receiver_to_new_servo_receiver, route_ipc_receiver_to_new_servo_sender}; +use servo_channel::{ + route_ipc_receiver_to_new_servo_receiver, route_ipc_receiver_to_new_servo_sender, +}; use servo_config::opts; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use std::cell::Cell; @@ -131,8 +143,8 @@ use std::thread; use std::time::SystemTime; use style::thread_state::{self, ThreadState}; use time::{at_utc, get_time, precise_time_ns, Timespec}; -use url::Position; use url::percent_encoding::percent_decode; +use url::Position; use webrender_api::{DocumentId, RenderApiSender}; use webvr_traits::{WebVREvent, WebVRMsg}; diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs index 9aee99f2bae2..198c230adf93 100644 --- a/components/script/serviceworker_manager.rs +++ b/components/script/serviceworker_manager.rs @@ -13,9 +13,9 @@ use crate::dom::serviceworkerglobalscope::{ServiceWorkerGlobalScope, ServiceWork use crate::dom::serviceworkerregistration::longest_prefix_match; use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg}; use ipc_channel::ipc::{self, IpcSender}; -use net_traits::{CustomResponseMediator, CoreResourceMsg}; -use script_traits::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders, DOMMessage}; -use servo_channel::{channel, route_ipc_receiver_to_new_servo_receiver, Sender, Receiver}; +use net_traits::{CoreResourceMsg, CustomResponseMediator}; +use script_traits::{DOMMessage, SWManagerMsg, SWManagerSenders, ScopeThings, ServiceWorkerMsg}; +use servo_channel::{channel, route_ipc_receiver_to_new_servo_receiver, Receiver, Sender}; use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::collections::HashMap; diff --git a/components/script/serviceworkerjob.rs b/components/script/serviceworkerjob.rs index 95193ecebf58..4b95b8933d83 100644 --- a/components/script/serviceworkerjob.rs +++ b/components/script/serviceworkerjob.rs @@ -17,8 +17,8 @@ use crate::dom::promise::Promise; use crate::dom::serviceworkerregistration::ServiceWorkerRegistration; use crate::dom::urlhelper::UrlHelper; use crate::script_thread::ScriptThread; -use crate::task_source::TaskSource; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; +use crate::task_source::TaskSource; use servo_url::ServoUrl; use std::cmp::PartialEq; use std::collections::HashMap; diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 17bf780cf326..29144d488368 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -10,7 +10,7 @@ use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlelement::HTMLElement; -use crate::dom::htmllinkelement::{RequestGenerationId, HTMLLinkElement}; +use crate::dom::htmllinkelement::{HTMLLinkElement, RequestGenerationId}; use crate::dom::node::{document_from_node, window_from_node}; use crate::network_listener::{NetworkListener, PreInvoke}; use crate::task_source::TaskSourceName; @@ -19,20 +19,24 @@ use encoding_rs::UTF_8; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use mime::{self, Mime}; -use net_traits::{FetchResponseListener, FetchMetadata, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy}; use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestInit, RequestMode}; +use net_traits::{ + FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy, +}; use parking_lot::RwLock; use servo_arc::Arc; use servo_url::ServoUrl; use std::mem; -use std::sync::Mutex; use std::sync::atomic::AtomicBool; +use std::sync::Mutex; use style::media_queries::MediaList; use style::parser::ParserContext; use style::shared_lock::{Locked, SharedRwLock}; -use style::stylesheets::{CssRules, ImportRule, Namespaces, Stylesheet, StylesheetContents, Origin}; -use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; use style::stylesheets::import_rule::ImportSheet; +use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; +use style::stylesheets::{ + CssRules, ImportRule, Namespaces, Origin, Stylesheet, StylesheetContents, +}; use style::values::CssUrl; pub trait StylesheetOwner { diff --git a/components/script/task.rs b/components/script/task.rs index e7461ee46854..622da35567df 100644 --- a/components/script/task.rs +++ b/components/script/task.rs @@ -5,8 +5,8 @@ //! Machinery for [tasks](https://html.spec.whatwg.org/multipage/#concept-task). use std::fmt; -use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; macro_rules! task { ($name:ident: move || $body:tt) => {{ diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 0b9098c6083c..1160da51c967 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -10,7 +10,7 @@ use crate::script_runtime::ScriptThreadEventCategory; use crate::task::TaskBox; use crate::task_source::TaskSourceName; use msg::constellation_msg::PipelineId; -use servo_channel::{Receiver, Sender, base_channel}; +use servo_channel::{base_channel, Receiver, Sender}; use std::cell::Cell; use std::collections::{HashMap, VecDeque}; use std::default::Default; diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index 129e4f353155..3c5b0bbcb694 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::domexception::DOMErrorName; -use crate::dom::filereader::{FileReader, TrustedFileReader, GenerationId, ReadMetaData}; -use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory, ScriptChan}; +use crate::dom::filereader::{FileReader, GenerationId, ReadMetaData, TrustedFileReader}; +use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; use crate::task_source::{TaskSource, TaskSourceName}; use msg::constellation_msg::PipelineId; diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs index 97c099fd3b23..0bc5841b73c9 100644 --- a/components/script/task_source/history_traversal.rs +++ b/components/script/task_source/history_traversal.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::script_runtime::{ScriptChan, CommonScriptMsg}; +use crate::script_runtime::{CommonScriptMsg, ScriptChan}; use crate::script_thread::MainThreadScriptMsg; use servo_channel::Sender; diff --git a/components/script/test.rs b/components/script/test.rs index 7b87cb71f8c2..22fa3b8af2be 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -7,9 +7,9 @@ pub use crate::dom::headers::normalize_value; // For compile-fail tests only. pub use crate::dom::bindings::cell::DomRefCell; +pub use crate::dom::bindings::refcounted::TrustedPromise; pub use crate::dom::bindings::root::Dom; pub use crate::dom::node::Node; -pub use crate::dom::bindings::refcounted::TrustedPromise; pub mod area { pub use crate::dom::htmlareaelement::{Area, Shape}; @@ -60,7 +60,7 @@ pub mod size_of { } pub mod srcset { - pub use crate::dom::htmlimageelement::{parse_a_srcset_attribute, ImageSource, Descriptor}; + pub use crate::dom::htmlimageelement::{parse_a_srcset_attribute, Descriptor, ImageSource}; } pub mod timeranges { diff --git a/components/script/timers.rs b/components/script/timers.rs index c2affe1e740a..fe533d121001 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -17,7 +17,7 @@ use ipc_channel::ipc::IpcSender; use js::jsapi::Heap; use js::jsval::{JSVal, UndefinedValue}; use js::rust::HandleValue; -use script_traits::{MsDuration, precise_time_ms}; +use script_traits::{precise_time_ms, MsDuration}; use script_traits::{TimerEvent, TimerEventId, TimerEventRequest}; use script_traits::{TimerSchedulerMsg, TimerSource}; use servo_config::prefs::PREFS; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 30291e62be77..30f1f12c6b53 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -11,7 +11,9 @@ use crate::dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputE use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; +use crate::dom::bindings::conversions::{ + ConversionResult, FromJSValConvertible, StringificationBehavior, +}; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; @@ -21,7 +23,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::htmliframeelement::HTMLIFrameElement; use crate::dom::htmlinputelement::HTMLInputElement; use crate::dom::htmloptionelement::HTMLOptionElement; -use crate::dom::node::{Node, window_from_node}; +use crate::dom::node::{window_from_node, Node}; use crate::script_thread::Documents; use euclid::{Point2D, Rect, Size2D}; use hyper_serde::Serde; @@ -31,11 +33,13 @@ use js::jsval::UndefinedValue; use js::rust::HandleValue; use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; -use net_traits::CookieSource::{HTTP, NonHTTP}; +use net_traits::CookieSource::{NonHTTP, HTTP}; use net_traits::CoreResourceMsg::{GetCookiesDataForUrl, SetCookieForUrl}; use net_traits::IpcSend; -use script_traits::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue}; use script_traits::webdriver_msg::WebDriverCookieError; +use script_traits::webdriver_msg::{ + WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue, +}; use servo_url::ServoUrl; fn find_node_by_unique_id( diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs index bd48b2b7c515..58695a277503 100644 --- a/components/script_layout_interface/lib.rs +++ b/components/script_layout_interface/lib.rs @@ -44,7 +44,7 @@ pub mod rpc; pub mod wrapper_traits; use atomic_refcell::AtomicRefCell; -use canvas_traits::canvas::{CanvasMsg, CanvasId}; +use canvas_traits::canvas::{CanvasId, CanvasMsg}; use ipc_channel::ipc::IpcSender; use libc::c_void; use net_traits::image_cache::PendingImageId; diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 326c6b04b755..01edca28a776 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress}; use crate::rpc::LayoutRPC; +use crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress}; use euclid::{Point2D, Rect}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; @@ -12,9 +12,9 @@ use metrics::PaintTimeMetrics; use msg::constellation_msg::PipelineId; use net_traits::image_cache::ImageCache; use profile_traits::mem::ReportsChan; +use script_traits::Painter; use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData}; -use script_traits::Painter; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_channel::{Receiver, Sender}; diff --git a/components/script_layout_interface/reporter.rs b/components/script_layout_interface/reporter.rs index e96e5669b00c..ac52cde80129 100644 --- a/components/script_layout_interface/reporter.rs +++ b/components/script_layout_interface/reporter.rs @@ -8,8 +8,8 @@ use log; use msg::constellation_msg::PipelineId; use script_traits::ConstellationControlMsg; use servo_url::ServoUrl; -use std::sync::{Mutex, Arc}; -use style::error_reporting::{ParseErrorReporter, ContextualParseError}; +use std::sync::{Arc, Mutex}; +use style::error_reporting::{ContextualParseError, ParseErrorReporter}; #[derive(Clone, MallocSizeOf)] pub struct CSSErrorReporter { diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index 8bdb285ed8e2..8533b22ef9e1 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -6,8 +6,8 @@ use app_units::Au; use euclid::{Point2D, Rect}; use script_traits::UntrustedNodeAddress; use servo_arc::Arc; -use style::properties::ComputedValues; use style::properties::longhands::overflow_x; +use style::properties::ComputedValues; use webrender_api::ExternalScrollId; /// Synchronous messages that script can send to layout. diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index d3de357a3e4b..724905f3a8a1 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -10,8 +10,8 @@ use crate::HTMLMediaData; use crate::LayoutNodeType; use crate::OpaqueStyleAndLayoutData; use crate::SVGSVGData; -use gfx_traits::{ByteIndex, FragmentType, combine_id_with_fragment_type}; -use html5ever::{Namespace, LocalName}; +use gfx_traits::{combine_id_with_fragment_type, ByteIndex, FragmentType}; +use html5ever::{LocalName, Namespace}; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use range::Range; @@ -22,8 +22,8 @@ use std::sync::Arc as StdArc; use style::attr::AttrValue; use style::context::SharedStyleContext; use style::data::ElementData; -use style::dom::{LayoutIterator, NodeInfo, TElement, TNode}; use style::dom::OpaqueNode; +use style::dom::{LayoutIterator, NodeInfo, TElement, TNode}; use style::font_metrics::ServoMetricsProvider; use style::properties::ComputedValues; use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl}; diff --git a/components/script_plugins/unrooted_must_root.rs b/components/script_plugins/unrooted_must_root.rs index 5b4a756194dc..7e72f2cc8277 100644 --- a/components/script_plugins/unrooted_must_root.rs +++ b/components/script_plugins/unrooted_must_root.rs @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::utils::{match_def_path, in_derive_expn}; -use rustc::hir::{self, ExprKind}; +use crate::utils::{in_derive_expn, match_def_path}; use rustc::hir::intravisit as visit; -use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; +use rustc::hir::{self, ExprKind}; +use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc::ty; use syntax::{ast, source_map, symbol::Ident}; diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 4dc483e81012..5f54c4c6ce12 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -47,21 +47,21 @@ use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand}; use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId}; -use euclid::{Length, Point2D, Vector2D, Rect, TypedSize2D, TypedScale}; +use euclid::{Length, Point2D, Rect, TypedScale, TypedSize2D, Vector2D}; use gfx_traits::Epoch; use http::HeaderMap; use hyper::Method; -use ipc_channel::{Error as IpcError}; use ipc_channel::ipc::{IpcReceiver, IpcSender}; +use ipc_channel::Error as IpcError; use keyboard_types::KeyboardEvent; use libc::c_void; use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId}; -use msg::constellation_msg::{PipelineNamespaceId, TraversalDirection, TopLevelBrowsingContextId}; -use net_traits::{FetchResponseMsg, ReferrerPolicy, ResourceThreads}; +use msg::constellation_msg::{PipelineNamespaceId, TopLevelBrowsingContextId, TraversalDirection}; use net_traits::image::base::Image; use net_traits::image::base::PixelFormat; use net_traits::image_cache::ImageCache; use net_traits::storage_thread::StorageType; +use net_traits::{FetchResponseMsg, ReferrerPolicy, ResourceThreads}; use profile_traits::mem; use profile_traits::time as profile_time; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -72,14 +72,18 @@ use servo_url::ServoUrl; use std::collections::HashMap; use std::fmt; use std::sync::Arc; +use style_traits::cursor::CursorKind; use style_traits::CSSPixel; use style_traits::SpeculativePainter; -use style_traits::cursor::CursorKind; -use webrender_api::{DevicePixel, DeviceUintSize, DocumentId, ExternalScrollId, ImageKey, RenderApiSender}; +use webrender_api::{ + DevicePixel, DeviceUintSize, DocumentId, ExternalScrollId, ImageKey, RenderApiSender, +}; use webvr_traits::{WebVREvent, WebVRMsg}; -pub use crate::script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry}; -pub use crate::script_msg::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders, DOMMessage}; +pub use crate::script_msg::{ + DOMMessage, SWManagerMsg, SWManagerSenders, ScopeThings, ServiceWorkerMsg, +}; +pub use crate::script_msg::{EventResult, LayoutMsg, LogEntry, ScriptMsg}; /// The address of a node. Layout sends these back. They must be validated via /// `from_untrusted_node_address` before they can be used, because we do not trust layout. diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index b77524f448b5..5167f1915091 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use canvas_traits::canvas::{CanvasMsg, CanvasId}; +use canvas_traits::canvas::{CanvasId, CanvasMsg}; use crate::AnimationState; use crate::AuxiliaryBrowsingContextLoadInfo; use crate::DocumentState; @@ -19,15 +19,15 @@ use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use msg::constellation_msg::{HistoryStateId, TraversalDirection}; -use net_traits::CoreResourceMsg; use net_traits::request::RequestInit; use net_traits::storage_thread::StorageType; +use net_traits::CoreResourceMsg; use servo_url::ImmutableOrigin; use servo_url::ServoUrl; use std::fmt; -use style_traits::CSSPixel; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; +use style_traits::CSSPixel; use webrender_api::{DeviceIntPoint, DeviceUintSize}; /// Messages from the layout to the constellation. diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs index b17ed9bfc63c..8fcca8f78e25 100644 --- a/components/selectors/builder.rs +++ b/components/selectors/builder.rs @@ -23,7 +23,7 @@ use sink::Push; use smallvec::{self, SmallVec}; use std::cmp; use std::iter; -use std::ops::{AddAssign, Add}; +use std::ops::{Add, AddAssign}; use std::ptr; use std::slice; diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index 433f58992af5..0709c4eef998 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -8,10 +8,10 @@ use attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE}; use bloom::BLOOM_HASH_MASK; use builder::{SelectorBuilder, SpecificityAndFlags}; use context::QuirksMode; +use cssparser::{parse_nth, serialize_identifier}; use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind}; use cssparser::{CowRcStr, Delimiter, SourceLocation}; use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token}; -use cssparser::{parse_nth, serialize_identifier}; use precomputed_hash::PrecomputedHash; use servo_arc::ThinArc; use sink::Push; @@ -2146,12 +2146,12 @@ where // NB: pub module in order to access the DummyParser #[cfg(test)] pub mod tests { + use super::*; use builder::HAS_PSEUDO_BIT; use cssparser::{serialize_identifier, Parser as CssParser, ParserInput, ToCss}; use parser; use std::collections::HashMap; use std::fmt; - use super::*; #[derive(Clone, Debug, Eq, PartialEq)] pub enum PseudoClass { diff --git a/components/servo/lib.rs b/components/servo/lib.rs index c1b1e21f91a3..94fd50508af5 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -44,8 +44,8 @@ pub extern crate net_traits; pub extern crate profile; pub extern crate profile_traits; pub extern crate script; -pub extern crate script_traits; pub extern crate script_layout_interface; +pub extern crate script_traits; pub extern crate servo_channel; pub extern crate servo_config; pub extern crate servo_geometry; @@ -73,13 +73,13 @@ use bluetooth::BluetoothThreadFactory; use bluetooth_traits::BluetoothRequest; use canvas::gl_context::GLContextFactory; use canvas::webgl_thread::WebGLThreads; -use compositing::{IOCompositor, ShutdownState, RenderNotifier}; use compositing::compositor_thread::{CompositorProxy, CompositorReceiver, InitialCompositorState}; use compositing::windowing::{WindowEvent, WindowMethods}; -use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent}; -use constellation::{FromCompositorLogger, FromScriptLogger}; +use compositing::{IOCompositor, RenderNotifier, ShutdownState}; #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] use constellation::content_process_sandbox_profile; +use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent}; +use constellation::{FromCompositorLogger, FromScriptLogger}; use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker}; use env_logger::Builder as EnvLoggerBuilder; #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] @@ -95,7 +95,7 @@ use profile::time as profile_time; use profile_traits::mem; use profile_traits::time; use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan}; -use servo_channel::{Sender, channel}; +use servo_channel::{channel, Sender}; use servo_config::opts; use servo_config::prefs::PREFS; use std::borrow::Cow; @@ -103,12 +103,12 @@ use std::cmp::max; use std::path::PathBuf; use std::rc::Rc; use webrender::{RendererKind, ShaderPrecacheFlags}; -use webvr::{WebVRThread, WebVRCompositorHandler}; +use webvr::{WebVRCompositorHandler, WebVRThread}; pub use gleam::gl; +pub use msg::constellation_msg::TopLevelBrowsingContextId as BrowserId; pub use servo_config as config; pub use servo_url as url; -pub use msg::constellation_msg::{TopLevelBrowsingContextId as BrowserId}; /// The in-process interface to Servo. /// diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index 05296165acc2..1a80f057b9b4 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -32,7 +32,6 @@ use nodrop::NoDrop; #[cfg(feature = "servo")] use serde::{Deserialize, Serialize}; use stable_deref_trait::{CloneStableDeref, StableDeref}; -use std::{isize, usize}; use std::borrow; use std::cmp::Ordering; use std::convert::From; @@ -48,6 +47,7 @@ use std::ptr; use std::slice; use std::sync::atomic; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; +use std::{isize, usize}; // Private macro to get the offset of a struct field in bytes from the address of the struct. macro_rules! offset_of { @@ -1170,11 +1170,11 @@ impl fmt::Debug for ArcUnion { #[cfg(test)] mod tests { + use super::{Arc, HeaderWithLength, ThinArc}; use std::clone::Clone; use std::ops::Drop; use std::sync::atomic; use std::sync::atomic::Ordering::{Acquire, SeqCst}; - use super::{Arc, HeaderWithLength, ThinArc}; #[derive(PartialEq)] struct Canary(*mut atomic::AtomicUsize); diff --git a/components/style/animation.rs b/components/style/animation.rs index 0dc55739e5f1..14ea1e21a2d0 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -8,15 +8,14 @@ // compile it out so that people remember it exists, thus the cfg'd Sender // import. -use Atom; use bezier::Bezier; use context::SharedStyleContext; use dom::{OpaqueNode, TElement}; use font_metrics::FontMetricsProvider; -use properties::{self, CascadeMode, ComputedValues, LonghandId}; use properties::animated_properties::AnimatedProperty; use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection; use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState; +use properties::{self, CascadeMode, ComputedValues, LonghandId}; use rule_tree::CascadeLevel; use servo_arc::Arc; #[cfg(feature = "servo")] @@ -26,11 +25,12 @@ use std::fmt; use std::sync::mpsc::Sender; use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue}; use timer::Timer; +use values::computed::box_::TransitionProperty; use values::computed::Time; use values::computed::TimingFunction; -use values::computed::box_::TransitionProperty; use values::generics::box_::AnimationIterationCount; use values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction}; +use Atom; /// This structure represents a keyframes animation current iteration state. /// diff --git a/components/style/attr.rs b/components/style/attr.rs index a3b119c3a975..158875ea327f 100644 --- a/components/style/attr.rs +++ b/components/style/attr.rs @@ -6,7 +6,6 @@ //! //! [attr]: https://dom.spec.whatwg.org/#interface-attr -use {Atom, LocalName, Namespace, Prefix}; use app_units::Au; use cssparser::{self, Color, RGBA}; use euclid::num::Zero; @@ -17,10 +16,11 @@ use servo_arc::Arc; use servo_url::ServoUrl; use shared_lock::Locked; use std::str::FromStr; +use str::str_join; use str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS}; use str::{read_numbers, split_commas, split_html_space_chars}; -use str::str_join; use values::specified::Length; +use {Atom, LocalName, Namespace, Prefix}; // Duplicated from script::dom::values. const UNSIGNED_LONG_MAX: u32 = 2147483647; diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index adce4698ce62..1909c15330d3 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -14,6 +14,8 @@ mod common { #[cfg(feature = "bindgen")] mod bindings { + use super::super::PYTHON; + use super::common::*; use bindgen::{Builder, CodegenConfig}; use regex::Regex; use std::cmp; @@ -26,8 +28,6 @@ mod bindings { use std::slice; use std::sync::Mutex; use std::time::SystemTime; - use super::common::*; - use super::super::PYTHON; use toml; use toml::value::Table; @@ -606,9 +606,9 @@ mod bindings { #[cfg(not(feature = "bindgen"))] mod bindings { - use std::{env, fs, io}; - use std::path::{Path, PathBuf}; use super::common::*; + use std::path::{Path, PathBuf}; + use std::{env, fs, io}; /// Copy contents of one directory into another. /// It currently only does a shallow copy. diff --git a/components/style/context.rs b/components/style/context.rs index 0623cb05a4a1..822107a351dc 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -9,9 +9,9 @@ use animation::Animation; use app_units::Au; use bloom::StyleBloom; use data::{EagerPseudoStyles, ElementData}; -use dom::{SendElement, TElement}; #[cfg(feature = "servo")] use dom::OpaqueNode; +use dom::{SendElement, TElement}; use euclid::Size2D; use euclid::TypedScale; use font_metrics::FontMetricsProvider; @@ -27,8 +27,8 @@ use properties::PropertyId; use rule_cache::RuleCache; use rule_tree::StrongRuleNode; use selector_parser::{SnapshotMap, EAGER_PSEUDO_COUNT}; -use selectors::NthIndexCache; use selectors::matching::ElementSelectorFlags; +use selectors::NthIndexCache; use servo_arc::Arc; #[cfg(feature = "servo")] use servo_atoms::Atom; diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 97c8d414d894..73bab7659203 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -6,7 +6,6 @@ //! //! [counter-style]: https://drafts.csswg.org/css-counter-styles/ -use Atom; use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser}; use cssparser::{CowRcStr, Parser, SourceLocation, Token}; use error_reporting::ContextualParseError; @@ -20,8 +19,9 @@ use std::ops::Range; use str::CssStringWriter; use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError}; use style_traits::{StyleParseErrorKind, ToCss}; -use values::CustomIdent; use values::specified::Integer; +use values::CustomIdent; +use Atom; /// Parse a counter style name reference. /// diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 7f91c93378bf..630fb4ba116e 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -6,7 +6,6 @@ //! //! [custom]: https://drafts.csswg.org/css-variables/ -use Atom; use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType}; use hash::map::Entry; use precomputed_hash::PrecomputedHash; @@ -20,6 +19,7 @@ use std::cmp; use std::fmt::{self, Write}; use std::hash::Hash; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; +use Atom; /// The environment from which to get `env` function values. /// diff --git a/components/style/dom.rs b/components/style/dom.rs index 872a55a54b23..3d2b05de7dcb 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -7,7 +7,6 @@ #![allow(unsafe_code)] #![deny(missing_docs)] -use {Atom, LocalName, Namespace, WeakAtom}; use applicable_declarations::ApplicableDeclarationBlock; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; #[cfg(feature = "gecko")] @@ -20,9 +19,9 @@ use font_metrics::FontMetricsProvider; use media_queries::Device; use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock}; use selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl}; -use selectors::Element as SelectorsElement; use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode}; use selectors::sink::Push; +use selectors::Element as SelectorsElement; use servo_arc::{Arc, ArcBorrow}; use shared_lock::Locked; use std::fmt; @@ -31,6 +30,7 @@ use std::hash::Hash; use std::ops::Deref; use stylist::CascadeData; use traversal_flags::TraversalFlags; +use {Atom, LocalName, Namespace, WeakAtom}; /// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed /// back into a non-opaque representation. The only safe operation that can be diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index 9b613f150576..371c83e7238c 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -5,17 +5,17 @@ //! Generic implementations of some DOM APIs so they can be shared between Servo //! and Gecko. -use Atom; use context::QuirksMode; use dom::{TDocument, TElement, TNode, TShadowRoot}; use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation}; use invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector}; -use selectors::{Element, NthIndexCache, SelectorList}; use selectors::attr::CaseSensitivity; use selectors::matching::{self, MatchingContext, MatchingMode}; use selectors::parser::{Combinator, Component, LocalName, SelectorImpl}; +use selectors::{Element, NthIndexCache, SelectorList}; use smallvec::SmallVec; use std::borrow::Borrow; +use Atom; /// pub fn element_matches( diff --git a/components/style/font_face.rs b/components/style/font_face.rs index b09c929c2dfb..d257aa53773c 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -6,10 +6,10 @@ //! //! [ff]: https://drafts.csswg.org/css-fonts/#at-font-face-rule -use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; -use cssparser::{CowRcStr, SourceLocation}; #[cfg(feature = "gecko")] use cssparser::UnicodeRange; +use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; +use cssparser::{CowRcStr, SourceLocation}; use error_reporting::ContextualParseError; use parser::{Parse, ParserContext}; #[cfg(feature = "gecko")] @@ -18,17 +18,17 @@ use selectors::parser::SelectorParseErrorKind; use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard}; use std::fmt::{self, Write}; use str::CssStringWriter; +use style_traits::values::SequenceWriter; use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError}; use style_traits::{StyleParseErrorKind, ToCss}; -use style_traits::values::SequenceWriter; use values::computed::font::FamilyName; use values::generics::font::FontStyle as GenericFontStyle; -use values::specified::Angle; +use values::specified::font::SpecifiedFontStyle; use values::specified::font::{AbsoluteFontWeight, FontStretch}; #[cfg(feature = "gecko")] use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings}; -use values::specified::font::SpecifiedFontStyle; use values::specified::url::SpecifiedUrl; +use values::specified::Angle; /// A source for a font-face rule. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] diff --git a/components/style/font_metrics.rs b/components/style/font_metrics.rs index dfe461cb3930..e093f13ef185 100644 --- a/components/style/font_metrics.rs +++ b/components/style/font_metrics.rs @@ -6,12 +6,12 @@ #![deny(missing_docs)] -use Atom; use app_units::Au; use context::SharedStyleContext; use logical_geometry::WritingMode; use media_queries::Device; use properties::style_structs::Font; +use Atom; /// 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/arc_types.rs b/components/style/gecko/arc_types.rs index 0a9bf4d5ccc5..ed4098042749 100644 --- a/components/style/gecko/arc_types.rs +++ b/components/style/gecko/arc_types.rs @@ -31,16 +31,16 @@ use gecko_bindings::structs::RawServoStyleRule; use gecko_bindings::structs::RawServoStyleSheetContents; use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong}; use media_queries::MediaList; -use properties::{ComputedValues, PropertyDeclarationBlock}; use properties::animated_properties::AnimationValue; +use properties::{ComputedValues, PropertyDeclarationBlock}; use rule_tree::StrongRuleNode; use servo_arc::{Arc, ArcBorrow}; use shared_lock::Locked; use std::{mem, ptr}; +use stylesheets::keyframes_rule::Keyframe; use stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule}; use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule}; use stylesheets::{StyleRule, StylesheetContents, SupportsRule}; -use stylesheets::keyframes_rule::Keyframe; macro_rules! impl_arc_ffi { ($servo_type:ty => $gecko_type:ty[$addref:ident, $release:ident]) => { diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 947a8c6e1a63..b85b3bd6eb1a 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -12,15 +12,17 @@ use app_units::Au; use gecko::values::GeckoStyleCoordConvertible; use gecko_bindings::bindings; use gecko_bindings::structs::{self, nsStyleCoord_CalcValue}; -use gecko_bindings::structs::{nsresult, SheetType, nsStyleImage}; +use gecko_bindings::structs::{nsStyleImage, nsresult, SheetType}; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue}; use std::f32::consts::PI; use stylesheets::{Origin, RulesMutateError}; -use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image}; -use values::computed::{Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto}; -use values::computed::{Percentage, TextAlign}; use values::computed::image::LineDirection; use values::computed::url::ComputedImageUrl; +use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image}; +use values::computed::{ + Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto, +}; +use values::computed::{Percentage, TextAlign}; use values::generics::box_::VerticalAlign; use values::generics::grid::{TrackListValue, TrackSize}; use values::generics::image::{CompatMode, GradientItem, Image as GenericImage}; @@ -233,11 +235,11 @@ impl nsStyleImage { // FIXME(emilio): This is really complex, we should use cbindgen for this. fn set_gradient(&mut self, gradient: Gradient) { + use self::structs::nsStyleCoord; use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER as CLOSEST_CORNER; use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE; use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER; use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE; - use self::structs::nsStyleCoord; use values::generics::image::{Circle, Ellipse, EndingShape, GradientKind, ShapeExtent}; use values::specified::position::{X, Y}; @@ -495,9 +497,9 @@ impl nsStyleImage { use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE; use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER; use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE; - use values::computed::Length; use values::computed::image::LineDirection; use values::computed::position::Position; + use values::computed::Length; use values::generics::image::{Circle, ColorStop, CompatMode, Ellipse}; use values::generics::image::{EndingShape, GradientKind, ShapeExtent}; @@ -652,9 +654,9 @@ pub mod basic_shape { use gecko::values::GeckoStyleCoordConvertible; use gecko_bindings::structs; + use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners}; use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType}; use gecko_bindings::structs::{StyleGeometryBox, StyleShapeSource, StyleShapeSourceType}; - use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners}; use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue}; use gecko_bindings::sugar::refptr::RefPtr; use std::borrow::Borrow; diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs index 2ede2f5b81f5..7761d9c26555 100644 --- a/components/style/gecko/data.rs +++ b/components/style/gecko/data.rs @@ -8,8 +8,10 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use context::QuirksMode; use dom::TElement; use gecko_bindings::bindings::{self, RawServoStyleSet}; -use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet}; -use gecko_bindings::structs::{StyleSheetInfo, nsIDocument}; +use gecko_bindings::structs::{nsIDocument, StyleSheetInfo}; +use gecko_bindings::structs::{ + RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet, +}; use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI}; use invalidation::media_queries::{MediaListKey, ToMediaListKey}; use malloc_size_of::MallocSizeOfOps; diff --git a/components/style/gecko/global_style_data.rs b/components/style/gecko/global_style_data.rs index 6671de9867d2..8007acb6ce2a 100644 --- a/components/style/gecko/global_style_data.rs +++ b/components/style/gecko/global_style_data.rs @@ -5,8 +5,8 @@ //! Global style data use context::StyleSystemOptions; -use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread}; use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena; +use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread}; use num_cpus; use parallel::STYLE_THREAD_STACK_SIZE_KB; use rayon; diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index c0453b18d226..176d36459dfd 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -4,17 +4,17 @@ //! Gecko's media feature list and evaluator. -use Atom; use app_units::Au; use euclid::Size2D; use gecko_bindings::bindings; use gecko_bindings::structs; -use media_queries::Device; use media_queries::media_feature::{AllowsRanges, ParsingRequirements}; -use media_queries::media_feature::{MediaFeatureDescription, Evaluator}; +use media_queries::media_feature::{Evaluator, MediaFeatureDescription}; use media_queries::media_feature_expression::{AspectRatio, RangeOrOperator}; +use media_queries::Device; use values::computed::CSSPixelLength; use values::computed::Resolution; +use Atom; fn viewport_size(device: &Device) -> Size2D { let pc = device.pres_context(); diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index ae14d332f89a..25abac6f974c 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -4,8 +4,8 @@ //! Gecko's media-query device and expression representation. -use app_units::AU_PER_PX; use app_units::Au; +use app_units::AU_PER_PX; use cssparser::RGBA; use custom_properties::CssEnvironment; use euclid::Size2D; @@ -20,10 +20,10 @@ use servo_arc::Arc; use std::fmt; use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering}; use string_cache::Atom; -use style_traits::{CSSPixel, DevicePixel}; use style_traits::viewport::ViewportConstraints; -use values::{CustomIdent, KeyframesName}; +use style_traits::{CSSPixel, DevicePixel}; use values::computed::font::FontSize; +use values::{CustomIdent, KeyframesName}; /// The `Device` in Gecko wraps a pres context, has a default values computed, /// and contains all the viewport rule state. diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index 1164a39bdc42..b17a5e6349e1 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -10,8 +10,8 @@ use cssparser::ToCss; use gecko_bindings::structs::{self, CSSPseudoElementType}; -use properties::{ComputedValues, PropertyFlags}; use properties::longhands::display::computed_value::T as Display; +use properties::{ComputedValues, PropertyFlags}; use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl}; use std::fmt; use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase}; diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 2365356f2f8b..420c2f014363 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -12,10 +12,10 @@ use gecko_bindings::structs::RawServoSelectorList; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use invalidation::element::document_state::InvalidationMatchingData; use selector_parser::{Direction, SelectorParser}; -use selectors::SelectorList; -use selectors::parser::{SelectorParseErrorKind, Visit}; use selectors::parser::{self as selector_parser, Selector}; +use selectors::parser::{SelectorParseErrorKind, Visit}; use selectors::visitor::SelectorVisitor; +use selectors::SelectorList; use std::fmt; use str::starts_with_ignore_ascii_case; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; diff --git a/components/style/gecko/snapshot.rs b/components/style/gecko/snapshot.rs index fc4a9121ae40..a72fea248aa6 100644 --- a/components/style/gecko/snapshot.rs +++ b/components/style/gecko/snapshot.rs @@ -5,7 +5,6 @@ //! A gecko snapshot, that stores the element attributes and state before they //! change in order to properly calculate restyle hints. -use WeakAtom; use dom::TElement; use element_state::ElementState; use gecko::snapshot_helpers; @@ -18,6 +17,7 @@ use invalidation::element::element_wrapper::ElementSnapshot; use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator}; use selectors::attr::{CaseSensitivity, NamespaceConstraint}; use string_cache::{Atom, Namespace}; +use WeakAtom; /// A snapshot of a Gecko element. pub type GeckoElementSnapshot = ServoElementSnapshot; diff --git a/components/style/gecko/snapshot_helpers.rs b/components/style/gecko/snapshot_helpers.rs index 371a2b78da16..61f6646514d3 100644 --- a/components/style/gecko/snapshot_helpers.rs +++ b/components/style/gecko/snapshot_helpers.rs @@ -4,11 +4,11 @@ //! Element an snapshot common logic. -use CaseSensitivityExt; use gecko_bindings::bindings; use gecko_bindings::structs::{self, nsAtom}; use selectors::attr::CaseSensitivity; use string_cache::{Atom, WeakAtom}; +use CaseSensitivityExt; /// A function that, given an element of type `T`, allows you to get a single /// class or a class list. diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index a95eb037e35e..a04b8e57b70d 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -6,10 +6,10 @@ use cssparser::Parser; use gecko_bindings::bindings; -use gecko_bindings::structs::root::mozilla::CORSMode; use gecko_bindings::structs::root::mozilla::css::URLValue; +use gecko_bindings::structs::root::mozilla::CORSMode; use gecko_bindings::structs::root::nsStyleImageRequest; -use gecko_bindings::sugar::ownership::{HasArcFFI, FFIArcHelpers}; +use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI}; use gecko_bindings::sugar::refptr::RefPtr; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use nsstring::nsCString; diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index ffa7a65ee0ce..9020888d9a8d 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -6,30 +6,34 @@ //! Different kind of helpers to interact with Gecko values. -use Atom; use app_units::Au; use counter_style::{Symbol, Symbols}; use cssparser::RGBA; -use gecko_bindings::structs::{self, CounterStylePtr, nsStyleCoord}; +use gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr}; use gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius}; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue}; use media_queries::Device; use nsstring::{nsACString, nsCStr}; use std::cmp::max; -use values::{Auto, Either, None_, Normal}; -use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto}; +use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius; +use values::computed::FlexBasis as ComputedFlexBasis; +use values::computed::{ + Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto, +}; use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage}; -use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage}; +use values::computed::{ + MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage, +}; use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber}; -use values::computed::FlexBasis as ComputedFlexBasis; -use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius; -use values::generics::{CounterStyleOrNone, NonNegative}; use values::generics::basic_shape::ShapeRadius; use values::generics::box_::Perspective; use values::generics::flex::FlexBasis; use values::generics::gecko::ScrollSnapPoint; use values::generics::grid::{TrackBreadth, TrackKeyword}; use values::generics::length::{MaxLength, MozLength}; +use values::generics::{CounterStyleOrNone, NonNegative}; +use values::{Auto, Either, None_, Normal}; +use Atom; /// A trait that defines an interface to convert from and to `nsStyleCoord`s. pub trait GeckoStyleCoordConvertible: Sized { @@ -558,8 +562,8 @@ impl CounterStyleOrNone { /// Convert Gecko CounterStylePtr to CounterStyleOrNone or String. pub fn from_gecko_value(gecko_value: &CounterStylePtr) -> Either { use gecko_bindings::bindings; - use values::CustomIdent; use values::generics::SymbolsType; + use values::CustomIdent; let name = unsafe { bindings::Gecko_CounterStyle_GetName(gecko_value) }; if !name.is_null() { diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 7c40fd4c2ec3..b67e69849d17 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -14,7 +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 CaseSensitivityExt; use app_units::Au; use applicable_declarations::ApplicableDeclarationBlock; use atomic_refcell::{AtomicRefCell, AtomicRefMut}; @@ -29,9 +28,6 @@ use gecko::global_style_data::GLOBAL_STYLE_DATA; use gecko::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl}; use gecko::snapshot_helpers; use gecko_bindings::bindings; -use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme}; -use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetPreviousSibling, Gecko_GetNextStyleChild}; -use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use gecko_bindings::bindings::Gecko_ElementHasAnimations; use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations; use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions; @@ -47,35 +43,40 @@ use gecko_bindings::bindings::Gecko_IsSignificantChild; use gecko_bindings::bindings::Gecko_MatchLang; use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr; use gecko_bindings::bindings::Gecko_UpdateAnimations; +use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme}; +use gecko_bindings::bindings::{ + Gecko_GetLastChild, Gecko_GetNextStyleChild, Gecko_GetPreviousSibling, +}; +use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use gecko_bindings::structs; -use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding}; -use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag}; +use gecko_bindings::structs::nsChangeHint; +use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme; +use gecko_bindings::structs::nsRestyleHint; +use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; use gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT; use gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO; use gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO; use gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT; -use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; use gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES; use gecko_bindings::structs::NODE_NEEDS_FRAME; -use gecko_bindings::structs::nsChangeHint; -use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme; -use gecko_bindings::structs::nsRestyleHint; +use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag}; +use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding}; use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI}; use hash::FxHashMap; use logical_geometry::WritingMode; use media_queries::Device; -use properties::{ComputedValues, LonghandId}; -use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock}; use properties::animated_properties::{AnimationValue, AnimationValueMap}; use properties::style_structs::Font; +use properties::{ComputedValues, LonghandId}; +use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock}; use rule_tree::CascadeLevel as ServoCascadeLevel; use selector_parser::{AttrValue, HorizontalDirection, Lang}; -use selectors::{Element, OpaqueElement}; use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator}; use selectors::attr::{CaseSensitivity, NamespaceConstraint}; -use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::matching::VisitedHandlingMode; +use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::sink::Push; +use selectors::{Element, OpaqueElement}; use servo_arc::{Arc, ArcBorrow, RawOffsetArc}; use shared_lock::Locked; use std::cell::RefCell; @@ -85,6 +86,7 @@ use std::mem; use std::ptr; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; use stylist::CascadeData; +use CaseSensitivityExt; #[inline] fn elements_with_id<'a, 'le>( diff --git a/components/style/gecko_bindings/sugar/ns_css_shadow_array.rs b/components/style/gecko_bindings/sugar/ns_css_shadow_array.rs index 8e445a837e62..f0050796c22c 100644 --- a/components/style/gecko_bindings/sugar/ns_css_shadow_array.rs +++ b/components/style/gecko_bindings/sugar/ns_css_shadow_array.rs @@ -7,9 +7,9 @@ use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread; use gecko_bindings::bindings::Gecko_NewCSSShadowArray; use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread; -use gecko_bindings::structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem}; -use std::{ptr, slice}; +use gecko_bindings::structs::{nsCSSShadowArray, nsCSSShadowItem, RefPtr}; use std::ops::{Deref, DerefMut}; +use std::{ptr, slice}; impl RefPtr { /// Replaces the current `nsCSSShadowArray` with a new one of len `len`. diff --git a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs index 8adb8bb54d17..256199df7276 100644 --- a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs +++ b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs @@ -6,8 +6,8 @@ use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength; use gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength; -use gecko_bindings::structs::{StyleAnimation, StyleTransition}; use gecko_bindings::structs::nsStyleAutoArray; +use gecko_bindings::structs::{StyleAnimation, StyleTransition}; use std::iter::{once, Chain, IntoIterator, Once}; use std::ops::{Index, IndexMut}; use std::slice::{Iter, IterMut}; diff --git a/components/style/gecko_bindings/sugar/ns_style_coord.rs b/components/style/gecko_bindings/sugar/ns_style_coord.rs index a4220f8c53c0..4dca851f0509 100644 --- a/components/style/gecko_bindings/sugar/ns_style_coord.rs +++ b/components/style/gecko_bindings/sugar/ns_style_coord.rs @@ -6,7 +6,7 @@ use gecko_bindings::bindings; use gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue}; -use gecko_bindings::structs::{nscoord, nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit}; +use gecko_bindings::structs::{nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit, nscoord}; use std::mem; impl nsStyleCoord { @@ -277,8 +277,8 @@ pub unsafe trait CoordDataMut: CoordData { #[inline(always)] /// Sets the inner value. fn set_value(&mut self, value: CoordDataValue) { - use gecko_bindings::structs::nsStyleUnit::*; use self::CoordDataValue::*; + use gecko_bindings::structs::nsStyleUnit::*; self.reset(); unsafe { let (unit, union) = self.values_mut(); @@ -364,8 +364,8 @@ pub unsafe trait CoordData { #[inline(always)] /// Get the appropriate value for this object. fn as_value(&self) -> CoordDataValue { - use gecko_bindings::structs::nsStyleUnit::*; use self::CoordDataValue::*; + use gecko_bindings::structs::nsStyleUnit::*; unsafe { match self.unit() { eStyleUnit_Null => Null, diff --git a/components/style/gecko_bindings/sugar/refptr.rs b/components/style/gecko_bindings/sugar/refptr.rs index d7e7141e6026..ca37c4e576ff 100644 --- a/components/style/gecko_bindings/sugar/refptr.rs +++ b/components/style/gecko_bindings/sugar/refptr.rs @@ -4,13 +4,13 @@ //! A rust helper to ease the use of Gecko's refcounted types. -use Atom; -use gecko_bindings::{structs, bindings}; use gecko_bindings::sugar::ownership::HasArcFFI; +use gecko_bindings::{bindings, structs}; use servo_arc::Arc; -use std::{fmt, mem, ptr}; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; +use std::{fmt, mem, ptr}; +use Atom; /// Trait for all objects that have Addref() and Release /// methods and can be placed inside RefPtr diff --git a/components/style/gecko_bindings/sugar/style_complex_color.rs b/components/style/gecko_bindings/sugar/style_complex_color.rs index c2b3b1c62709..e65d023a68d9 100644 --- a/components/style/gecko_bindings/sugar/style_complex_color.rs +++ b/components/style/gecko_bindings/sugar/style_complex_color.rs @@ -7,10 +7,10 @@ use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor}; use gecko_bindings::structs::StyleComplexColor; use gecko_bindings::structs::StyleComplexColor_Tag as Tag; -use values::{Auto, Either}; -use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA}; use values::computed::ui::ColorOrAuto; +use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA}; use values::generics::color::{Color as GenericColor, ComplexColorRatios}; +use values::{Auto, Either}; impl StyleComplexColor { /// Create a `StyleComplexColor` value that represents `currentColor`. diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs index f4941184beb4..aedf065aaf40 100644 --- a/components/style/gecko_string_cache/mod.rs +++ b/components/style/gecko_string_cache/mod.rs @@ -17,13 +17,13 @@ use gecko_bindings::bindings::Gecko_ReleaseAtom; use gecko_bindings::structs::{nsAtom, nsAtom_AtomKind, nsDynamicAtom, nsStaticAtom}; use nsstring::{nsAString, nsStr}; use precomputed_hash::PrecomputedHash; -use std::{mem, slice, str}; use std::borrow::{Borrow, Cow}; use std::char::{self, DecodeUtf16}; use std::fmt::{self, Write}; use std::hash::{Hash, Hasher}; use std::iter::Cloned; use std::ops::Deref; +use std::{mem, slice, str}; use style_traits::SpecifiedValueInfo; #[macro_use] diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs index cd1b1d13a256..457c8238abc1 100644 --- a/components/style/invalidation/element/element_wrapper.rs +++ b/components/style/invalidation/element/element_wrapper.rs @@ -5,16 +5,16 @@ //! A wrapper over an element and a snapshot, that allows us to selector-match //! against a past state of the element. -use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom}; use dom::TElement; use element_state::ElementState; use selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl}; use selector_parser::{Snapshot, SnapshotMap}; -use selectors::{Element, OpaqueElement}; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::matching::{ElementSelectorFlags, MatchingContext}; +use selectors::{Element, OpaqueElement}; use std::cell::Cell; use std::fmt; +use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom}; /// In order to compute restyle hints, we perform a selector match against a /// list of partial selectors whose rightmost simple selector may be sensitive diff --git a/components/style/invalidation/element/invalidation_map.rs b/components/style/invalidation/element/invalidation_map.rs index 038852a6dd4a..adc6783a2729 100644 --- a/components/style/invalidation/element/invalidation_map.rs +++ b/components/style/invalidation/element/invalidation_map.rs @@ -4,7 +4,6 @@ //! Code for invalidations due to state or attribute changes. -use {Atom, LocalName, Namespace}; use context::QuirksMode; use element_state::{DocumentState, ElementState}; use fallible::FallibleVec; @@ -16,6 +15,7 @@ use selectors::parser::{Combinator, Component}; use selectors::parser::{Selector, SelectorIter, Visit}; use selectors::visitor::SelectorVisitor; use smallvec::SmallVec; +use {Atom, LocalName, Namespace}; /// Mapping between (partial) CompoundSelectors (and the combinator to their /// right) and the states and attributes they depend on. diff --git a/components/style/invalidation/element/invalidator.rs b/components/style/invalidation/element/invalidator.rs index 8d60ade88e26..4a38c0ef931d 100644 --- a/components/style/invalidation/element/invalidator.rs +++ b/components/style/invalidation/element/invalidator.rs @@ -8,8 +8,8 @@ use context::StackLimitChecker; use dom::{TElement, TNode, TShadowRoot}; use selector_parser::SelectorImpl; -use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext}; use selectors::matching::matches_compound_selector_from; +use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext}; use selectors::parser::{Combinator, Component, Selector}; use smallvec::SmallVec; use std::fmt; diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs index bf259bb6f025..1de675d396e7 100644 --- a/components/style/invalidation/element/state_and_attributes.rs +++ b/components/style/invalidation/element/state_and_attributes.rs @@ -5,7 +5,6 @@ //! An invalidation processor for style changes due to state and attribute //! changes. -use {Atom, WeakAtom}; use context::SharedStyleContext; use data::ElementData; use dom::TElement; @@ -17,12 +16,13 @@ use invalidation::element::invalidator::{Invalidation, InvalidationProcessor}; use invalidation::element::restyle_hints::RestyleHint; use selector_map::SelectorMap; use selector_parser::Snapshot; -use selectors::NthIndexCache; use selectors::attr::CaseSensitivity; -use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode}; use selectors::matching::matches_selector; +use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode}; +use selectors::NthIndexCache; use smallvec::SmallVec; use stylesheets::origin::{Origin, OriginSet}; +use {Atom, WeakAtom}; /// The collector implementation. struct Collector<'a, 'b: 'a, 'selectors: 'a, E> diff --git a/components/style/invalidation/stylesheets.rs b/components/style/invalidation/stylesheets.rs index 1889d325630f..fac9428bc75f 100644 --- a/components/style/invalidation/stylesheets.rs +++ b/components/style/invalidation/stylesheets.rs @@ -7,9 +7,6 @@ #![deny(unsafe_code)] -use Atom; -use CaseSensitivityExt; -use LocalName as SelectorLocalName; use dom::{TDocument, TElement, TNode}; use fxhash::FxHashSet; use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper}; @@ -20,6 +17,9 @@ use selectors::attr::CaseSensitivity; use selectors::parser::{Component, LocalName, Selector}; use shared_lock::SharedRwLockReadGuard; use stylesheets::{CssRule, StylesheetInDocument}; +use Atom; +use CaseSensitivityExt; +use LocalName as SelectorLocalName; /// A style sheet invalidation represents a kind of element or subtree that may /// need to be restyled. Whether it represents a whole subtree or just a single diff --git a/components/style/lib.rs b/components/style/lib.rs index 7c0a78a36bcf..29df16f6183a 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -169,20 +169,20 @@ pub use gecko_string_cache as string_cache; #[cfg(feature = "gecko")] pub use gecko_string_cache::Atom; #[cfg(feature = "gecko")] -pub use gecko_string_cache::Namespace; -#[cfg(feature = "gecko")] pub use gecko_string_cache::Atom as Prefix; #[cfg(feature = "gecko")] pub use gecko_string_cache::Atom as LocalName; +#[cfg(feature = "gecko")] +pub use gecko_string_cache::Namespace; -#[cfg(feature = "servo")] -pub use servo_atoms::Atom; -#[cfg(feature = "servo")] -pub use html5ever::Prefix; #[cfg(feature = "servo")] pub use html5ever::LocalName; #[cfg(feature = "servo")] pub use html5ever::Namespace; +#[cfg(feature = "servo")] +pub use html5ever::Prefix; +#[cfg(feature = "servo")] +pub use servo_atoms::Atom; /// The CSS properties supported by the style system. /// Generated from the properties.mako.rs template by build.rs diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index 8c677c210bfb..cae71229bbdd 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -4,8 +4,8 @@ //! Geometry in flow-relative space. -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::num::Zero; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use properties::style_structs; use std::cmp::{max, min}; use std::fmt::{self, Debug, Error, Formatter}; diff --git a/components/style/matching.rs b/components/style/matching.rs index fd1569bea687..1b0f14feb56b 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -12,8 +12,8 @@ use context::{SharedStyleContext, StyleContext}; use data::ElementData; use dom::TElement; use invalidation::element::restyle_hints::RestyleHint; -use properties::ComputedValues; use properties::longhands::display::computed_value::T as Display; +use properties::ComputedValues; use rule_tree::{CascadeLevel, StrongRuleNode}; use selector_parser::{PseudoElement, RestyleDamage}; use selectors::matching::ElementSelectorFlags; diff --git a/components/style/media_queries/media_condition.rs b/components/style/media_queries/media_condition.rs index 78252db8c0b1..af2d5a3be69e 100644 --- a/components/style/media_queries/media_condition.rs +++ b/components/style/media_queries/media_condition.rs @@ -6,12 +6,12 @@ //! //! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition +use super::{Device, MediaFeatureExpression}; use context::QuirksMode; use cssparser::{Parser, Token}; use parser::ParserContext; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -use super::{Device, MediaFeatureExpression}; /// A binary `and` or `or` operator. #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] diff --git a/components/style/media_queries/media_feature.rs b/components/style/media_queries/media_feature.rs index 771a11e8fbbe..84a13c06f635 100644 --- a/components/style/media_queries/media_feature.rs +++ b/components/style/media_queries/media_feature.rs @@ -4,14 +4,14 @@ //! Media features. -use Atom; +use super::media_feature_expression::{AspectRatio, RangeOrOperator}; +use super::Device; use cssparser::Parser; use parser::ParserContext; use std::fmt; use style_traits::ParseError; -use super::Device; -use super::media_feature_expression::{AspectRatio, RangeOrOperator}; use values::computed::{CSSPixelLength, Resolution}; +use Atom; /// A generic discriminant for an enum value. pub type KeywordDiscriminant = u8; diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs index 64406218e889..52292e9571b5 100644 --- a/components/style/media_queries/media_feature_expression.rs +++ b/components/style/media_queries/media_feature_expression.rs @@ -5,24 +5,24 @@ //! Parsing for media feature expressions, like `(foo: bar)` or //! `(width >= 400px)`. -use Atom; +use super::media_feature::{Evaluator, MediaFeatureDescription}; +use super::media_feature::{KeywordDiscriminant, ParsingRequirements}; +use super::Device; use context::QuirksMode; use cssparser::{Parser, Token}; #[cfg(feature = "gecko")] use gecko_bindings::structs; use num_traits::Zero; use parser::{Parse, ParserContext}; -use std::cmp::{PartialOrd, Ordering}; +use std::cmp::{Ordering, PartialOrd}; use std::fmt::{self, Write}; use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use stylesheets::Origin; -use super::Device; -use super::media_feature::{Evaluator, MediaFeatureDescription}; -use super::media_feature::{ParsingRequirements, KeywordDiscriminant}; -use values::{serialize_atom_identifier, CSSFloat}; use values::computed::{self, ToComputedValue}; use values::specified::{Integer, Length, Number, Resolution}; +use values::{serialize_atom_identifier, CSSFloat}; +use Atom; /// An aspect ratio, with a numerator and denominator. #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] diff --git a/components/style/media_queries/media_list.rs b/components/style/media_queries/media_list.rs index 168671288cfd..302b3db69990 100644 --- a/components/style/media_queries/media_list.rs +++ b/components/style/media_queries/media_list.rs @@ -6,12 +6,12 @@ //! //! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list +use super::{Device, MediaQuery, Qualifier}; use context::QuirksMode; use cssparser::{Delimiter, Parser}; use cssparser::{ParserInput, Token}; use error_reporting::ContextualParseError; use parser::ParserContext; -use super::{Device, MediaQuery, Qualifier}; /// A type that encapsulates a media query list. #[css(comma, derive_debug)] diff --git a/components/style/media_queries/media_query.rs b/components/style/media_queries/media_query.rs index fd1727fe2b23..5875b5b38ea5 100644 --- a/components/style/media_queries/media_query.rs +++ b/components/style/media_queries/media_query.rs @@ -6,14 +6,14 @@ //! //! https://drafts.csswg.org/mediaqueries/#typedef-media-query -use Atom; +use super::media_condition::MediaCondition; use cssparser::Parser; use parser::ParserContext; use std::fmt::{self, Write}; use str::string_as_ascii_lowercase; use style_traits::{CssWriter, ParseError, ToCss}; -use super::media_condition::MediaCondition; use values::CustomIdent; +use Atom; /// #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] diff --git a/components/style/media_queries/mod.rs b/components/style/media_queries/mod.rs index b59ec32443dc..93a5abf3b011 100644 --- a/components/style/media_queries/mod.rs +++ b/components/style/media_queries/mod.rs @@ -14,11 +14,11 @@ pub mod media_feature; pub mod media_feature_expression; pub use self::media_condition::MediaCondition; +pub use self::media_feature_expression::MediaFeatureExpression; pub use self::media_list::MediaList; pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier}; -pub use self::media_feature_expression::MediaFeatureExpression; -#[cfg(feature = "servo")] -pub use servo::media_queries::Device; #[cfg(feature = "gecko")] pub use gecko::media_queries::Device; +#[cfg(feature = "servo")] +pub use servo::media_queries::Device; diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 3222625749c3..c1b818892897 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -731,9 +731,9 @@ unsafe impl Send for RuleTree {} #[cfg(feature = "gecko")] #[cfg(debug_assertions)] mod gecko_leak_checking { + use super::RuleNode; use std::mem::size_of; use std::os::raw::{c_char, c_void}; - use super::RuleNode; extern "C" { pub fn NS_LogCtor(aPtr: *const c_void, aTypeName: *const c_char, aSize: u32); diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index 1e35f748917e..d9bf07710842 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -5,13 +5,12 @@ //! A data structure to efficiently index structs containing selectors by local //! name, ids and hash. -use {Atom, LocalName, Namespace, WeakAtom}; use applicable_declarations::ApplicableDeclarationList; use context::QuirksMode; use dom::TElement; use fallible::FallibleVec; -use hash::{HashMap, HashSet}; use hash::map as hash_map; +use hash::{HashMap, HashSet}; use hashglobe::FailedAllocationError; use precomputed_hash::PrecomputedHash; use rule_tree::{CascadeLevel, ShadowCascadeOrder}; @@ -21,6 +20,7 @@ use selectors::parser::{Combinator, Component, SelectorIter}; use smallvec::SmallVec; use std::hash::{BuildHasherDefault, Hash, Hasher}; use stylist::Rule; +use {Atom, LocalName, Namespace, WeakAtom}; /// A hasher implementation that doesn't hash anything, because it expects its /// input to be a suitable u32 hash. diff --git a/components/style/selector_parser.rs b/components/style/selector_parser.rs index 5d6ddbb0e3fa..1bfe115c5f47 100644 --- a/components/style/selector_parser.rs +++ b/components/style/selector_parser.rs @@ -6,7 +6,6 @@ #![deny(missing_docs)] -use Atom; use cssparser::{Parser as CssParser, ParserInput}; use element_state::ElementState; use selectors::parser::SelectorList; @@ -14,6 +13,7 @@ use std::fmt::{self, Debug, Write}; use style_traits::{CssWriter, ParseError, ToCss}; use stylesheets::{Namespaces, Origin, UrlExtraData}; use values::serialize_atom_identifier; +use Atom; /// A convenient alias for the type that represents an attribute value used for /// selector parser implementation. diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs index bae0aa3978b9..77113e703c38 100644 --- a/components/style/servo/media_queries.rs +++ b/components/style/servo/media_queries.rs @@ -8,17 +8,17 @@ use app_units::Au; use cssparser::RGBA; use custom_properties::CssEnvironment; use euclid::{Size2D, TypedScale, TypedSize2D}; -use media_queries::MediaType; use media_queries::media_feature::{AllowsRanges, ParsingRequirements}; -use media_queries::media_feature::{MediaFeatureDescription, Evaluator}; +use media_queries::media_feature::{Evaluator, MediaFeatureDescription}; use media_queries::media_feature_expression::RangeOrOperator; +use media_queries::MediaType; use properties::ComputedValues; use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering}; -use style_traits::{CSSPixel, DevicePixel}; use style_traits::viewport::ViewportConstraints; -use values::KeyframesName; -use values::computed::CSSPixelLength; +use style_traits::{CSSPixel, DevicePixel}; use values::computed::font::FontSize; +use values::computed::CSSPixelLength; +use values::KeyframesName; /// A device is a structure that represents the current media a given document /// is displayed in. diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index de8257dcc4ca..97fb3e298547 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -6,7 +6,6 @@ //! Servo's selector parser. -use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix}; use attr::{AttrIdentifier, AttrValue}; use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss}; use dom::{OpaqueNode, TElement, TNode}; @@ -14,8 +13,8 @@ use element_state::{DocumentState, ElementState}; use fxhash::FxHashMap; use invalidation::element::document_state::InvalidationMatchingData; use invalidation::element::element_wrapper::ElementSnapshot; -use properties::{ComputedValues, PropertyFlags}; use properties::longhands::display::computed_value::T as Display; +use properties::{ComputedValues, PropertyFlags}; use selector_parser::{AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser}; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::parser::{SelectorParseErrorKind, Visit}; @@ -24,6 +23,7 @@ use std::fmt; use std::mem; use std::ops::{Deref, DerefMut}; use style_traits::{ParseError, StyleParseErrorKind}; +use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix}; /// A pseudo-element, both public and private. /// @@ -348,8 +348,8 @@ impl NonTSPseudoClass { /// Gets a given state flag for this pseudo-class. This is used to do /// selector matching, and it's set from the DOM. pub fn state_flag(&self) -> ElementState { - use element_state::ElementState; use self::NonTSPseudoClass::*; + use element_state::ElementState; match *self { Active => ElementState::IN_ACTIVE_STATE, Focus => ElementState::IN_FOCUS_STATE, diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 3a4a3635206c..f4ac8f30b135 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 Atom; use applicable_declarations::ApplicableDeclarationBlock; use atomic_refcell::{AtomicRefCell, AtomicRefMut}; use bloom::StyleBloom; @@ -74,8 +73,8 @@ use matching::MatchMethods; use owning_ref::OwningHandle; use properties::ComputedValues; use rule_tree::StrongRuleNode; -use selectors::NthIndexCache; use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode}; +use selectors::NthIndexCache; use servo_arc::Arc; use smallbitvec::SmallBitVec; use smallvec::SmallVec; @@ -86,6 +85,7 @@ use std::ptr::NonNull; use style_resolver::{PrimaryStyle, ResolvedElementStyles}; use stylist::Stylist; use uluru::{Entry, LRUCache}; +use Atom; mod checks; diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index ab6c15029ca2..0b6005197b37 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -7,12 +7,12 @@ use app_units::Au; use dom::TElement; -use properties::{self, ComputedValues, StyleBuilder}; use properties::computed_value_flags::ComputedValueFlags; use properties::longhands::display::computed_value::T as Display; use properties::longhands::float::computed_value::T as Float; use properties::longhands::overflow_x::computed_value::T as Overflow; use properties::longhands::position::computed_value::T as Position; +use properties::{self, ComputedValues, StyleBuilder}; /// A struct that implements all the adjustment methods. /// diff --git a/components/style/style_resolver.rs b/components/style/style_resolver.rs index 0899faa9ce7a..f1328858c3d9 100644 --- a/components/style/style_resolver.rs +++ b/components/style/style_resolver.rs @@ -10,11 +10,13 @@ use data::{EagerPseudoStyles, ElementStyles}; use dom::TElement; use log::Level::Trace; use matching::MatchMethods; -use properties::{AnimationRules, ComputedValues}; use properties::longhands::display::computed_value::T as Display; +use properties::{AnimationRules, ComputedValues}; use rule_tree::StrongRuleNode; use selector_parser::{PseudoElement, SelectorImpl}; -use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode}; +use selectors::matching::{ + ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode, +}; use servo_arc::Arc; use stylist::RuleInclusion; diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs index f1353744f08d..548b060e0142 100644 --- a/components/style/stylesheets/font_feature_values_rule.rs +++ b/components/style/stylesheets/font_feature_values_rule.rs @@ -6,7 +6,6 @@ //! //! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule -use Atom; use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr}; use cssparser::{DeclarationListParser, DeclarationParser, Parser}; use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token}; @@ -23,6 +22,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use stylesheets::CssRuleType; use values::computed::font::FamilyName; use values::serialize_atom_identifier; +use Atom; /// A @font-feature-values block declaration. /// It is `: +`. diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs index f16a3363f5e9..ffd415513946 100644 --- a/components/style/stylesheets/keyframes_rule.rs +++ b/components/style/stylesheets/keyframes_rule.rs @@ -4,23 +4,23 @@ //! Keyframes: https://drafts.csswg.org/css-animations/#keyframes -use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser}; use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token}; +use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser}; use error_reporting::ContextualParseError; use parser::ParserContext; +use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction; +use properties::LonghandIdSet; use properties::{Importance, PropertyDeclaration}; use properties::{LonghandId, PropertyDeclarationBlock, PropertyId}; use properties::{PropertyDeclarationId, SourcePropertyDeclaration}; -use properties::LonghandIdSet; -use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction; use servo_arc::Arc; use shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard}; use shared_lock::{Locked, ToCssWithGuard}; use std::fmt::{self, Write}; use str::CssStringWriter; use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss}; -use stylesheets::{CssRuleType, StylesheetContents}; use stylesheets::rule_parser::VendorPrefix; +use stylesheets::{CssRuleType, StylesheetContents}; use values::{serialize_percentage, KeyframesName}; /// A [`@keyframes`][keyframes] rule. diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index cf0497f5c3d8..9e1ae186d55c 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -45,13 +45,13 @@ pub use self::media_rule::MediaRule; pub use self::namespace_rule::NamespaceRule; pub use self::origin::{Origin, OriginSet, OriginSetIterator, PerOrigin, PerOriginIter}; pub use self::page_rule::PageRule; -pub use self::rule_parser::{State, TopLevelRuleParser, InsertRuleContext}; pub use self::rule_list::{CssRules, CssRulesHelpers}; +pub use self::rule_parser::{InsertRuleContext, State, TopLevelRuleParser}; pub use self::rules_iterator::{AllRules, EffectiveRules}; pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator}; +pub use self::style_rule::StyleRule; pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet}; pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets}; -pub use self::style_rule::StyleRule; pub use self::supports_rule::SupportsRule; pub use self::viewport_rule::ViewportRule; @@ -88,7 +88,7 @@ impl UrlExtraData { #[cfg(feature = "gecko")] impl fmt::Debug for UrlExtraData { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - use gecko_bindings::{structs, bindings}; + use gecko_bindings::{bindings, structs}; struct DebugURI(*mut structs::nsIURI); impl fmt::Debug for DebugURI { diff --git a/components/style/stylesheets/namespace_rule.rs b/components/style/stylesheets/namespace_rule.rs index f28f2ba0881a..1f927f08f172 100644 --- a/components/style/stylesheets/namespace_rule.rs +++ b/components/style/stylesheets/namespace_rule.rs @@ -4,11 +4,11 @@ //! The `@namespace` at-rule. -use {Namespace, Prefix}; use cssparser::SourceLocation; use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard}; use std::fmt::{self, Write}; use str::CssStringWriter; +use {Namespace, Prefix}; /// A `@namespace` rule. #[derive(Clone, Debug, PartialEq)] diff --git a/components/style/stylesheets/rule_list.rs b/components/style/stylesheets/rule_list.rs index cfbf62ea721a..280f879a77b9 100644 --- a/components/style/stylesheets/rule_list.rs +++ b/components/style/stylesheets/rule_list.rs @@ -11,10 +11,10 @@ use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked}; use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard}; use std::fmt::{self, Write}; use str::CssStringWriter; -use stylesheets::{CssRule, RulesMutateError}; use stylesheets::loader::StylesheetLoader; use stylesheets::rule_parser::{InsertRuleContext, State}; use stylesheets::stylesheet::StylesheetContents; +use stylesheets::{CssRule, RulesMutateError}; /// A list of CSS rules. #[derive(Debug)] diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs index aa449c70e934..642eabd9b6ab 100644 --- a/components/style/stylesheets/rule_parser.rs +++ b/components/style/stylesheets/rule_parser.rs @@ -4,7 +4,6 @@ //! Parsing of the stylesheet contents. -use {Namespace, Prefix}; use counter_style::{parse_counter_style_body, parse_counter_style_name_definition}; use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser}; use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation}; @@ -19,17 +18,18 @@ use servo_arc::Arc; use shared_lock::{Locked, SharedRwLock}; use str::starts_with_ignore_ascii_case; use style_traits::{ParseError, StyleParseErrorKind}; -use stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader}; -use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule}; -use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule}; use stylesheets::document_rule::DocumentCondition; use stylesheets::font_feature_values_rule::parse_family_name_list; use stylesheets::keyframes_rule::parse_keyframe_list; use stylesheets::stylesheet::Namespaces; use stylesheets::supports_rule::SupportsCondition; use stylesheets::viewport_rule; -use values::{CssUrl, CustomIdent, KeyframesName}; +use stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader}; +use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule}; +use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule}; use values::computed::font::FamilyName; +use values::{CssUrl, CustomIdent, KeyframesName}; +use {Namespace, Prefix}; /// The information we need particularly to do CSSOM insertRule stuff. pub struct InsertRuleContext<'a> { diff --git a/components/style/stylesheets/rules_iterator.rs b/components/style/stylesheets/rules_iterator.rs index eac6d2084e2a..5609e75f215b 100644 --- a/components/style/stylesheets/rules_iterator.rs +++ b/components/style/stylesheets/rules_iterator.rs @@ -9,8 +9,8 @@ use media_queries::Device; use shared_lock::SharedRwLockReadGuard; use smallvec::SmallVec; use std::slice; -use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule}; use stylesheets::StylesheetInDocument; +use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule}; /// An iterator over a list of rules. pub struct RulesIterator<'a, 'b, C> diff --git a/components/style/stylesheets/style_rule.rs b/components/style/stylesheets/style_rule.rs index c161cc43ee21..a017b38bdf52 100644 --- a/components/style/stylesheets/style_rule.rs +++ b/components/style/stylesheets/style_rule.rs @@ -6,9 +6,9 @@ use cssparser::SourceLocation; #[cfg(feature = "gecko")] -use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -#[cfg(feature = "gecko")] use malloc_size_of::MallocUnconditionalShallowSizeOf; +#[cfg(feature = "gecko")] +use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use properties::PropertyDeclarationBlock; use selector_parser::SelectorImpl; use selectors::SelectorList; diff --git a/components/style/stylesheets/stylesheet.rs b/components/style/stylesheets/stylesheet.rs index ac1d810a05bb..9bdc9c6834bf 100644 --- a/components/style/stylesheets/stylesheet.rs +++ b/components/style/stylesheets/stylesheet.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use {Namespace, Prefix}; use context::QuirksMode; use cssparser::{Parser, ParserInput, RuleListParser}; use error_reporting::{ContextualParseError, ParseErrorReporter}; @@ -15,16 +14,19 @@ use media_queries::{Device, MediaList}; use parking_lot::RwLock; use parser::ParserContext; use servo_arc::Arc; -use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard}; +use shared_lock::{ + DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, +}; use std::mem; use std::sync::atomic::{AtomicBool, Ordering}; use style_traits::ParsingMode; -use stylesheets::{CssRule, CssRules, Origin, UrlExtraData}; use stylesheets::loader::StylesheetLoader; use stylesheets::rule_parser::{State, TopLevelRuleParser}; use stylesheets::rules_iterator::{EffectiveRules, EffectiveRulesIterator}; use stylesheets::rules_iterator::{NestedRuleIterationCondition, RulesIterator}; +use stylesheets::{CssRule, CssRules, Origin, UrlExtraData}; use use_counters::UseCounters; +use {Namespace, Prefix}; /// This structure holds the user-agent and user stylesheets. pub struct UserAgentStylesheets { diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index 7af983541d2c..a273dcb48a92 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -4,9 +4,9 @@ //! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports) +use cssparser::parse_important; use cssparser::{Delimiter, Parser, SourceLocation, Token}; use cssparser::{ParseError as CssParseError, ParserInput}; -use cssparser::parse_important; #[cfg(feature = "gecko")] use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use parser::ParserContext; diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 16bffd14ab29..741e577229d2 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -9,8 +9,8 @@ use app_units::Au; use context::QuirksMode; -use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use cssparser::CowRcStr; +use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use error_reporting::ContextualParseError; use euclid::TypedSize2D; use font_metrics::get_metrics_provider_for_product; @@ -26,8 +26,8 @@ use std::fmt::{self, Write}; use std::iter::Enumerate; use std::str::Chars; use str::CssStringWriter; -use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss}; use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom}; +use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss}; use stylesheets::{Origin, StylesheetInDocument}; use values::computed::{Context, ToComputedValue}; use values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength}; diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 0013248e41e3..cd6ed7257e57 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -4,7 +4,6 @@ //! Selector matching. -use {Atom, LocalName, Namespace, WeakAtom}; use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList}; use context::{CascadeInputs, QuirksMode}; use dom::{TElement, TShadowRoot}; @@ -16,9 +15,9 @@ use hashglobe::FailedAllocationError; use invalidation::element::invalidation_map::InvalidationMap; use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey}; #[cfg(feature = "gecko")] -use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps}; -#[cfg(feature = "gecko")] use malloc_size_of::MallocUnconditionalShallowSizeOf; +#[cfg(feature = "gecko")] +use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps}; use media_queries::Device; use properties::{self, CascadeMode, ComputedValues}; use properties::{AnimationRules, PropertyDeclarationBlock}; @@ -26,14 +25,14 @@ use rule_cache::{RuleCache, RuleCacheConditions}; use rule_tree::{CascadeLevel, RuleTree, ShadowCascadeOrder, StrongRuleNode, StyleSource}; use selector_map::{PrecomputedHashMap, PrecomputedHashSet, SelectorMap, SelectorMapEntry}; use selector_parser::{PerPseudoElementMap, PseudoElement, SelectorImpl, SnapshotMap}; -use selectors::NthIndexCache; use selectors::attr::{CaseSensitivity, NamespaceConstraint}; use selectors::bloom::BloomFilter; -use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext, MatchingMode}; use selectors::matching::VisitedHandlingMode; +use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext, MatchingMode}; use selectors::parser::{AncestorHashes, Combinator, Component, Selector}; use selectors::parser::{SelectorIter, Visit}; use selectors::visitor::SelectorVisitor; +use selectors::NthIndexCache; use servo_arc::{Arc, ArcBorrow}; use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards}; use smallbitvec::SmallBitVec; @@ -43,14 +42,15 @@ use std::sync::Mutex; use style_traits::viewport::ViewportConstraints; use stylesheet_set::{DataValidity, DocumentStylesheetSet, SheetRebuildKind}; use stylesheet_set::{DocumentStylesheetFlusher, SheetCollectionFlusher}; +use stylesheets::keyframes_rule::KeyframesAnimation; +use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule}; +use stylesheets::StyleRule; +use stylesheets::StylesheetInDocument; #[cfg(feature = "gecko")] use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule}; use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter}; -use stylesheets::StyleRule; -use stylesheets::StylesheetInDocument; -use stylesheets::keyframes_rule::KeyframesAnimation; -use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule}; use thread_state::{self, ThreadState}; +use {Atom, LocalName, Namespace, WeakAtom}; /// The type of the stylesheets that the stylist contains. #[cfg(feature = "servo")] diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 317fe99a1231..d207c196d66f 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -720,8 +720,8 @@ where E: TElement, { use style_traits::ToCss; - use values::Either; use values::generics::image::Image; + use values::Either; // We speculatively evaluate any paint worklets during styling. // This allows us to run paint worklets in parallel with style and layout. diff --git a/components/style/values/animated/effects.rs b/components/style/values/animated/effects.rs index a86396506df5..674a601764ac 100644 --- a/components/style/values/animated/effects.rs +++ b/components/style/values/animated/effects.rs @@ -4,16 +4,16 @@ //! Animated types for CSS values related to effects. -#[cfg(not(feature = "gecko"))] -use values::Impossible; use values::animated::color::Color; -use values::computed::{Angle, Number}; use values::computed::length::Length; #[cfg(feature = "gecko")] use values::computed::url::ComputedUrl; +use values::computed::{Angle, Number}; use values::generics::effects::BoxShadow as GenericBoxShadow; use values::generics::effects::Filter as GenericFilter; use values::generics::effects::SimpleShadow as GenericSimpleShadow; +#[cfg(not(feature = "gecko"))] +use values::Impossible; /// An animated value for a single `box-shadow`. pub type BoxShadow = GenericBoxShadow; diff --git a/components/style/values/animated/font.rs b/components/style/values/animated/font.rs index 58da5c58258e..65050ffe1da7 100644 --- a/components/style/values/animated/font.rs +++ b/components/style/values/animated/font.rs @@ -5,8 +5,8 @@ //! Animation implementation for various font-related types. use super::{Animate, Procedure, ToAnimatedZero}; +use values::computed::font::{FontVariationSettings, FontWeight}; use values::computed::Number; -use values::computed::font::{FontWeight, FontVariationSettings}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; use values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue}; diff --git a/components/style/values/animated/length.rs b/components/style/values/animated/length.rs index d3c6d8aa3c20..5b47103f0ea5 100644 --- a/components/style/values/animated/length.rs +++ b/components/style/values/animated/length.rs @@ -5,10 +5,12 @@ //! Animation implementation for various length-related types. use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; +use values::computed::length::{ + CalcLengthOrPercentage, Length, LengthOrPercentageOrAuto, LengthOrPercentageOrNone, +}; use values::computed::MaxLength as ComputedMaxLength; use values::computed::MozLength as ComputedMozLength; use values::computed::Percentage; -use values::computed::length::{Length, CalcLengthOrPercentage, LengthOrPercentageOrNone, LengthOrPercentageOrAuto}; /// impl Animate for CalcLengthOrPercentage { diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index ae2236928fc6..707fc263c70a 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -13,10 +13,10 @@ use euclid::{Point2D, Size2D}; use properties::PropertyId; use smallvec::SmallVec; use std::cmp; -use values::computed::Angle as ComputedAngle; -use values::computed::BorderCornerRadius as ComputedBorderCornerRadius; use values::computed::length::CalcLengthOrPercentage; use values::computed::url::ComputedUrl; +use values::computed::Angle as ComputedAngle; +use values::computed::BorderCornerRadius as ComputedBorderCornerRadius; pub mod color; pub mod effects; diff --git a/components/style/values/animated/svg.rs b/components/style/values/animated/svg.rs index 4c6961de9564..630a2203252e 100644 --- a/components/style/values/animated/svg.rs +++ b/components/style/values/animated/svg.rs @@ -4,14 +4,14 @@ //! Animation implementations for various SVG-related types. -use properties::animated_properties::ListAnimation; use super::{Animate, Procedure, ToAnimatedZero}; +use properties::animated_properties::ListAnimation; use values::animated::color::Color as AnimatedColor; -use values::computed::{Number, NumberOrPercentage, LengthOrPercentage}; use values::computed::url::ComputedUrl; +use values::computed::{LengthOrPercentage, Number, NumberOrPercentage}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; -use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint}; -use values::generics::svg::{SVGStrokeDashArray, SVGOpacity}; +use values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber}; +use values::generics::svg::{SVGOpacity, SVGStrokeDashArray}; /// Animated SVGPaint. pub type IntermediateSVGPaint = SVGPaint; diff --git a/components/style/values/computed/angle.rs b/components/style/values/computed/angle.rs index f46c80873094..3f697578cd51 100644 --- a/components/style/values/computed/angle.rs +++ b/components/style/values/computed/angle.rs @@ -5,13 +5,13 @@ //! Computed angles. use num_traits::Zero; -use std::{f32, f64}; use std::f64::consts::PI; use std::fmt::{self, Write}; use std::ops::Add; +use std::{f32, f64}; use style_traits::{CssWriter, ToCss}; -use values::CSSFloat; use values::distance::{ComputeSquaredDistance, SquaredDistance}; +use values::CSSFloat; /// A computed angle in degrees. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] diff --git a/components/style/values/computed/background.rs b/components/style/values/computed/background.rs index e94bece983e5..78b9a92a9d0f 100644 --- a/components/style/values/computed/background.rs +++ b/components/style/values/computed/background.rs @@ -6,8 +6,8 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -use values::computed::{Context, ToComputedValue}; use values::computed::length::NonNegativeLengthOrPercentageOrAuto; +use values::computed::{Context, ToComputedValue}; use values::generics::background::BackgroundSize as GenericBackgroundSize; use values::specified::background::BackgroundRepeat as SpecifiedBackgroundRepeat; use values::specified::background::BackgroundRepeatKeyword; diff --git a/components/style/values/computed/basic_shape.rs b/components/style/values/computed/basic_shape.rs index e0409a9d9042..9c6cdb66260f 100644 --- a/components/style/values/computed/basic_shape.rs +++ b/components/style/values/computed/basic_shape.rs @@ -9,8 +9,8 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -use values::computed::{Image, LengthOrPercentage}; use values::computed::url::ComputedUrl; +use values::computed::{Image, LengthOrPercentage}; use values::generics::basic_shape as generic; /// A computed alias for FillRule. diff --git a/components/style/values/computed/border.rs b/components/style/values/computed/border.rs index 8c54aeba43bb..9a92175d9786 100644 --- a/components/style/values/computed/border.rs +++ b/components/style/values/computed/border.rs @@ -6,8 +6,8 @@ use app_units::Au; use values::animated::ToAnimatedZero; -use values::computed::{Number, NumberOrPercentage}; use values::computed::length::{LengthOrPercentage, NonNegativeLength}; +use values::computed::{Number, NumberOrPercentage}; use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth; use values::generics::border::BorderImageSlice as GenericBorderImageSlice; diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 002583b2c214..3e219305eff1 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -4,8 +4,8 @@ //! Computed types for box properties. -use values::computed::{Context, Number, ToComputedValue}; use values::computed::length::{LengthOrPercentage, NonNegativeLength}; +use values::computed::{Context, Number, ToComputedValue}; use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount; use values::generics::box_::Perspective as GenericPerspective; use values::generics::box_::VerticalAlign as GenericVerticalAlign; @@ -13,7 +13,9 @@ use values::specified::box_ as specified; pub use values::specified::box_::{AnimationName, Appearance, Contain, Display, OverflowClipBox}; pub use values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; -pub use values::specified::box_::{OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange}; +pub use values::specified::box_::{ + OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange, +}; /// A computed value for the `vertical-align` property. pub type VerticalAlign = GenericVerticalAlign; diff --git a/components/style/values/computed/color.rs b/components/style/values/computed/color.rs index 5effffe59661..6d0713ac1d4a 100644 --- a/components/style/values/computed/color.rs +++ b/components/style/values/computed/color.rs @@ -7,8 +7,8 @@ use cssparser::{Color as CSSParserColor, RGBA}; use std::fmt; use style_traits::{CssWriter, ToCss}; -use values::animated::ToAnimatedValue; use values::animated::color::RGBA as AnimatedRGBA; +use values::animated::ToAnimatedValue; use values::generics::color::Color as GenericColor; /// Computed value type for the specified RGBAColor. diff --git a/components/style/values/computed/effects.rs b/components/style/values/computed/effects.rs index b7e8315a6ace..9a511c4fd89a 100644 --- a/components/style/values/computed/effects.rs +++ b/components/style/values/computed/effects.rs @@ -4,16 +4,16 @@ //! Computed types for CSS values related to effects. -#[cfg(not(feature = "gecko"))] -use values::Impossible; -use values::computed::{Angle, NonNegativeNumber}; use values::computed::color::Color; use values::computed::length::{Length, NonNegativeLength}; #[cfg(feature = "gecko")] use values::computed::url::ComputedUrl; +use values::computed::{Angle, NonNegativeNumber}; use values::generics::effects::BoxShadow as GenericBoxShadow; use values::generics::effects::Filter as GenericFilter; use values::generics::effects::SimpleShadow as GenericSimpleShadow; +#[cfg(not(feature = "gecko"))] +use values::Impossible; /// A computed value for a single shadow of the `box-shadow` property. pub type BoxShadow = GenericBoxShadow; diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index e83f4b3f6b87..27a8fad133d6 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -4,28 +4,28 @@ //! Computed values for font properties -use Atom; use app_units::Au; use byteorder::{BigEndian, ByteOrder}; use cssparser::{serialize_identifier, CssStringWriter, Parser}; #[cfg(feature = "gecko")] -use gecko_bindings::{bindings, structs}; -#[cfg(feature = "gecko")] use gecko_bindings::sugar::refptr::RefPtr; #[cfg(feature = "gecko")] +use gecko_bindings::{bindings, structs}; +#[cfg(feature = "gecko")] use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use std::fmt::{self, Write}; use std::hash::{Hash, Hasher}; #[cfg(feature = "servo")] use std::slice; use style_traits::{CssWriter, ParseError, ToCss}; -use values::CSSFloat; use values::animated::{ToAnimatedValue, ToAnimatedZero}; use values::computed::{Angle, Context, Integer, NonNegativeLength, NonNegativePercentage}; use values::computed::{Number, Percentage, ToComputedValue}; use values::generics::font::{self as generics, FeatureTagValue, FontSettings, VariationValue}; -use values::specified::font::{self as specified, MIN_FONT_WEIGHT, MAX_FONT_WEIGHT}; +use values::specified::font::{self as specified, MAX_FONT_WEIGHT, MIN_FONT_WEIGHT}; use values::specified::length::{FontBaseSize, NoCalcLength}; +use values::CSSFloat; +use Atom; pub use values::computed::Length as MozScriptMinSize; pub use values::specified::font::{FontSynthesis, MozScriptSizeMultiplier, XLang, XTextZoom}; diff --git a/components/style/values/computed/image.rs b/components/style/values/computed/image.rs index 91e55c399101..c89871f6cfb1 100644 --- a/components/style/values/computed/image.rs +++ b/components/style/values/computed/image.rs @@ -10,16 +10,16 @@ use std::f32::consts::PI; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -use values::{Either, None_}; -use values::computed::{Angle, Color, Context}; -use values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue}; -#[cfg(feature = "gecko")] -use values::computed::Percentage; use values::computed::position::Position; use values::computed::url::ComputedImageUrl; +#[cfg(feature = "gecko")] +use values::computed::Percentage; +use values::computed::{Angle, Color, Context}; +use values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue}; use values::generics::image::{self as generic, CompatMode}; use values::specified::image::LineDirection as SpecifiedLineDirection; use values::specified::position::{X, Y}; +use values::{Either, None_}; /// A computed image layer. pub type ImageLayer = Either; diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index ff41f2c37ba4..10e1f211db32 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -4,20 +4,20 @@ //! `` computed values, and related ones. +use super::{Context, Number, Percentage, ToComputedValue}; use app_units::Au; use ordered_float::NotNan; use std::fmt::{self, Write}; use std::ops::{Add, Neg}; -use style_traits::{CssWriter, ToCss}; use style_traits::values::specified::AllowedNumericType; -use super::{Context, Number, Percentage, ToComputedValue}; -use values::{specified, Auto, CSSFloat, Either, Normal}; +use style_traits::{CssWriter, ToCss}; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; -use values::generics::NonNegative; use values::generics::length::{MaxLength as GenericMaxLength, MozLength as GenericMozLength}; -use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength}; +use values::generics::NonNegative; use values::specified::length::ViewportPercentageLength; +use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength}; +use values::{specified, Auto, CSSFloat, Either, Normal}; pub use super::image::Image; pub use values::specified::url::UrlOrNone; diff --git a/components/style/values/computed/list.rs b/components/style/values/computed/list.rs index 84136007711f..bd3930fa8de2 100644 --- a/components/style/values/computed/list.rs +++ b/components/style/values/computed/list.rs @@ -4,9 +4,9 @@ //! `list` computed values. -pub use values::specified::list::Quotes; #[cfg(feature = "gecko")] pub use values::specified::list::ListStyleType; +pub use values::specified::list::Quotes; impl Quotes { /// Initial value for `quotes`. diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 8b9a33f0df24..a5c83eb43e0c 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -4,9 +4,13 @@ //! Computed values. -use Atom; -#[cfg(feature = "servo")] -use Prefix; +use super::animated::ToAnimatedValue; +use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent; +use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; +use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize}; +use super::generics::{GreaterThanOrEqualToOne, NonNegative}; +use super::specified; +use super::{CSSFloat, CSSInteger}; use context::QuirksMode; use euclid::Size2D; use font_metrics::{get_metrics_provider_for_product, FontMetricsProvider}; @@ -19,17 +23,12 @@ use std::cell::RefCell; use std::cmp; use std::f32; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ToCss}; use style_traits::cursor::CursorKind; -use super::{CSSFloat, CSSInteger}; -use super::animated::ToAnimatedValue; -use super::generics::{GreaterThanOrEqualToOne, NonNegative}; -use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; -use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize}; -use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent; -use super::specified; +use style_traits::{CssWriter, ToCss}; +use Atom; +#[cfg(feature = "servo")] +use Prefix; -pub use app_units::Au; #[cfg(feature = "gecko")] pub use self::align::{AlignContent, AlignItems, JustifyContent, JustifyItems, SelfAlignment}; #[cfg(feature = "gecko")] @@ -37,13 +36,13 @@ pub use self::align::{AlignSelf, JustifySelf}; pub use self::angle::Angle; pub use self::background::{BackgroundRepeat, BackgroundSize}; pub use self::basic_shape::FillRule; -pub use self::border::{BorderImageRepeat, BorderImageSideWidth, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderCornerRadius, BorderRadius, BorderSpacing}; -pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight}; -pub use self::font::{FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings}; -pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; -pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom}; -pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display, TransitionProperty}; +pub use self::border::{ + BorderImageRepeat, BorderImageSideWidth, BorderImageSlice, BorderImageWidth, +}; +pub use self::box_::{ + AnimationIterationCount, AnimationName, Contain, Display, TransitionProperty, +}; pub use self::box_::{Appearance, Clear, Float}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange}; @@ -53,36 +52,47 @@ pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset}; pub use self::easing::TimingFunction; pub use self::effects::{BoxShadow, Filter, SimpleShadow}; pub use self::flex::FlexBasis; -pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect}; +pub use self::font::{ + FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings, +}; +pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; +pub use self::font::{ + FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight, +}; +pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom}; #[cfg(feature = "gecko")] pub use self::gecko::ScrollSnapPoint; -pub use self::rect::LengthOrNumberRect; -pub use self::resolution::Resolution; -pub use super::{Auto, Either, None_}; -pub use super::specified::{BorderStyle, TextDecorationLine}; +pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect}; +pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength}; pub use self::length::{CalcLengthOrPercentage, Length, LengthOrNumber, LengthOrPercentage}; pub use self::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, MaxLength, MozLength}; -pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength}; pub use self::length::{NonNegativeLengthOrPercentage, NonNegativeLengthOrPercentageOrAuto}; -pub use self::list::Quotes; #[cfg(feature = "gecko")] pub use self::list::ListStyleType; +pub use self::list::Quotes; pub use self::motion::OffsetPath; pub use self::outline::OutlineStyle; -pub use self::percentage::{Percentage, NonNegativePercentage}; +pub use self::percentage::{NonNegativePercentage, Percentage}; pub use self::position::{GridAutoFlow, GridTemplateAreas, Position, ZIndex}; +pub use self::rect::LengthOrNumberRect; +pub use self::resolution::Resolution; +pub use self::svg::MozContextProperties; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; -pub use self::svg::MozContextProperties; pub use self::table::XSpan; pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize}; -pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle, TextOverflow, WordSpacing}; +pub use self::text::{ + TextAlign, TextEmphasisPosition, TextEmphasisStyle, TextOverflow, WordSpacing, +}; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform, TransformOperation}; pub use self::transform::{TransformOrigin, TransformStyle, Translate}; -pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon}; #[cfg(feature = "gecko")] pub use self::ui::CursorImage; +pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon}; +pub use super::specified::{BorderStyle, TextDecorationLine}; +pub use super::{Auto, Either, None_}; +pub use app_units::Au; #[cfg(feature = "gecko")] pub mod align; diff --git a/components/style/values/computed/percentage.rs b/components/style/values/computed/percentage.rs index e7f038f4befe..9f5cd02abbe6 100644 --- a/components/style/values/computed/percentage.rs +++ b/components/style/values/computed/percentage.rs @@ -6,9 +6,9 @@ use std::fmt; use style_traits::{CssWriter, ToCss}; -use values::{serialize_percentage, CSSFloat}; use values::animated::ToAnimatedValue; use values::generics::NonNegative; +use values::{serialize_percentage, CSSFloat}; /// A computed percentage. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] diff --git a/components/style/values/computed/resolution.rs b/components/style/values/computed/resolution.rs index d90bdf4867df..9d743f9cbf3e 100644 --- a/components/style/values/computed/resolution.rs +++ b/components/style/values/computed/resolution.rs @@ -8,9 +8,9 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -use values::CSSFloat; use values::computed::{Context, ToComputedValue}; use values::specified; +use values::CSSFloat; /// A computed ``. pub struct Resolution(CSSFloat); diff --git a/components/style/values/computed/svg.rs b/components/style/values/computed/svg.rs index 778292a67354..dd9cfb03b4b3 100644 --- a/components/style/values/computed/svg.rs +++ b/components/style/values/computed/svg.rs @@ -4,11 +4,13 @@ //! Computed types for SVG properties. -use values::RGBA; -use values::computed::{NonNegativeLengthOrPercentage, NonNegativeNumber, Number, LengthOrPercentage, Opacity}; use values::computed::color::Color; use values::computed::url::ComputedUrl; +use values::computed::{ + LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber, Number, Opacity, +}; use values::generics::svg as generic; +use values::RGBA; pub use values::specified::SVGPaintOrder; diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index b41ecdb7e678..f8443ec607ac 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -8,14 +8,14 @@ use properties::StyleBuilder; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -use values::{CSSFloat, CSSInteger}; -use values::computed::{NonNegativeLength, NonNegativeNumber}; use values::computed::length::{Length, LengthOrPercentage}; +use values::computed::{NonNegativeLength, NonNegativeNumber}; use values::generics::text::InitialLetter as GenericInitialLetter; use values::generics::text::LineHeight as GenericLineHeight; use values::generics::text::MozTabSize as GenericMozTabSize; use values::generics::text::Spacing; use values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword, TextOverflowSide}; +use values::{CSSFloat, CSSInteger}; pub use values::specified::TextAlignKeyword as TextAlign; pub use values::specified::TextEmphasisPosition; diff --git a/components/style/values/computed/transform.rs b/components/style/values/computed/transform.rs index 33c55d8a1e2a..9590ad4025f3 100644 --- a/components/style/values/computed/transform.rs +++ b/components/style/values/computed/transform.rs @@ -4,9 +4,9 @@ //! Computed types for CSS values that are related to transformations. +use super::CSSFloat; use euclid::{Transform3D, Vector3D}; use num_traits::Zero; -use super::CSSFloat; use values::animated::ToAnimatedZero; use values::computed::{Angle, Integer, Length, LengthOrPercentage, Number, Percentage}; use values::generics::transform as generic; diff --git a/components/style/values/computed/ui.rs b/components/style/values/computed/ui.rs index 40f1a378cc97..cf1d953fd26f 100644 --- a/components/style/values/computed/ui.rs +++ b/components/style/values/computed/ui.rs @@ -4,11 +4,11 @@ //! Computed values for UI properties -use values::{Auto, Either}; -use values::computed::Number; use values::computed::color::Color; use values::computed::url::ComputedImageUrl; +use values::computed::Number; use values::generics::ui as generics; +use values::{Auto, Either}; pub use values::specified::ui::MozForceBrokenImageIcon; diff --git a/components/style/values/computed/url.rs b/components/style/values/computed/url.rs index cf9577101822..aca5d301fd25 100644 --- a/components/style/values/computed/url.rs +++ b/components/style/values/computed/url.rs @@ -6,10 +6,10 @@ use values::generics::url::UrlOrNone as GenericUrlOrNone; -#[cfg(feature = "servo")] -pub use servo::url::{ComputedImageUrl, ComputedUrl}; #[cfg(feature = "gecko")] pub use gecko::url::{ComputedImageUrl, ComputedUrl}; +#[cfg(feature = "servo")] +pub use servo::url::{ComputedImageUrl, ComputedUrl}; /// Computed | pub type UrlOrNone = GenericUrlOrNone; diff --git a/components/style/values/generics/counters.rs b/components/style/values/generics/counters.rs index 4bbf728d457c..a5990691336d 100644 --- a/components/style/values/generics/counters.rs +++ b/components/style/values/generics/counters.rs @@ -7,11 +7,11 @@ #[cfg(feature = "servo")] use computed_values::list_style_type::T as ListStyleType; use std::ops::Deref; -use values::CustomIdent; #[cfg(feature = "gecko")] use values::generics::CounterStyleOrNone; #[cfg(feature = "gecko")] use values::specified::Attr; +use values::CustomIdent; /// A name / value pair for counters. #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 13c7fa542002..fda0c3a07594 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -7,13 +7,13 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; -use std::{mem, usize}; use std::fmt::{self, Write}; +use std::{mem, usize}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -use values::{CSSFloat, CustomIdent}; use values::computed::{Context, ToComputedValue}; use values::specified; use values::specified::grid::parse_line_names; +use values::{CSSFloat, CustomIdent}; /// A `` type. /// diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index 16d348ac47ec..9ce60d3362c3 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -6,12 +6,12 @@ //! //! [images]: https://drafts.csswg.org/css-images/#image-values -use Atom; use custom_properties; use servo_arc::Arc; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; use values::serialize_atom_identifier; +use Atom; /// An [image]. /// diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index 712b62679d82..0f13cfcdd2f7 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -5,12 +5,12 @@ //! Generic types that share their serialization implementations //! for both specified and computed values. +use super::CustomIdent; use counter_style::{parse_counter_style_name, Symbols}; use cssparser::Parser; use parser::{Parse, ParserContext}; use style_traits::{KeywordsCollectFn, ParseError}; use style_traits::{SpecifiedValueInfo, StyleParseErrorKind}; -use super::CustomIdent; pub mod background; pub mod basic_shape; diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index 7a3eaead1cb6..b4d011fd6824 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -7,12 +7,12 @@ use app_units::Au; use euclid::{self, Rect, Transform3D}; use num_traits::Zero; -use values::{computed, CSSFloat}; use values::computed::length::Length as ComputedLength; use values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage; use values::specified::angle::Angle as SpecifiedAngle; use values::specified::length::Length as SpecifiedLength; use values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage; +use values::{computed, CSSFloat}; /// A generic 2D transformation matrix. #[allow(missing_docs)] diff --git a/components/style/values/generics/ui.rs b/components/style/values/generics/ui.rs index 2154c42f5d65..c959ad73e51f 100644 --- a/components/style/values/generics/ui.rs +++ b/components/style/values/generics/ui.rs @@ -5,8 +5,8 @@ //! Generic values for UI properties. use std::fmt::{self, Write}; -use style_traits::{CssWriter, ToCss}; use style_traits::cursor::CursorKind; +use style_traits::{CssWriter, ToCss}; /// A generic value for the `cursor` property. /// diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index d3ae6a839715..f182477e374a 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -8,19 +8,21 @@ #![deny(missing_docs)] -use Atom; -pub use cssparser::{serialize_identifier, serialize_name, CowRcStr, Parser, SourceLocation, Token, RGBA}; +pub use cssparser::{ + serialize_identifier, serialize_name, CowRcStr, Parser, SourceLocation, Token, RGBA, +}; use parser::{Parse, ParserContext}; use selectors::parser::SelectorParseErrorKind; use std::fmt::{self, Debug, Write}; use std::hash; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; +use Atom; -#[cfg(feature = "servo")] -pub use servo::url::CssUrl; #[cfg(feature = "gecko")] pub use gecko::url::CssUrl; +#[cfg(feature = "servo")] +pub use servo::url::CssUrl; pub mod animated; pub mod computed; diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs index 5d1740c6991f..01c86aab1801 100644 --- a/components/style/values/specified/angle.rs +++ b/components/style/values/specified/angle.rs @@ -9,10 +9,10 @@ use parser::{Parse, ParserContext}; use std::f32::consts::PI; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss}; -use values::CSSFloat; -use values::computed::{Context, ToComputedValue}; use values::computed::angle::Angle as ComputedAngle; +use values::computed::{Context, ToComputedValue}; use values::specified::calc::CalcNode; +use values::CSSFloat; /// A specified angle dimension. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] diff --git a/components/style/values/specified/basic_shape.rs b/components/style/values/specified/basic_shape.rs index 64bd362f7482..9470311b7a99 100644 --- a/components/style/values/specified/basic_shape.rs +++ b/components/style/values/specified/basic_shape.rs @@ -17,13 +17,13 @@ use values::generics::basic_shape as generic; use values::generics::basic_shape::{GeometryBox, Path, PolygonCoord}; use values::generics::basic_shape::{ShapeBox, ShapeSource}; use values::generics::rect::Rect; -use values::specified::LengthOrPercentage; -use values::specified::SVGPathData; use values::specified::border::BorderRadius; use values::specified::image::Image; use values::specified::position::{HorizontalPosition, Position, PositionComponent}; use values::specified::position::{Side, VerticalPosition}; use values::specified::url::SpecifiedUrl; +use values::specified::LengthOrPercentage; +use values::specified::SVGPathData; /// A specified alias for FillRule. pub use values::generics::basic_shape::FillRule; diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index 2f4d3548351a..27f403c4a289 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -16,8 +16,8 @@ use values::generics::border::BorderRadius as GenericBorderRadius; use values::generics::border::BorderSpacing as GenericBorderSpacing; use values::generics::rect::Rect; use values::generics::size::Size; -use values::specified::{AllowQuirks, Number, NumberOrPercentage}; use values::specified::length::{Length, LengthOrPercentage, NonNegativeLength}; +use values::specified::{AllowQuirks, Number, NumberOrPercentage}; /// A specified value for a single side of the `border-width` property. #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 7e79fc892a5c..589d0b13d0ce 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -4,20 +4,22 @@ //! Specified types for box properties. -use Atom; use cssparser::Parser; use custom_properties::Name as CustomPropertyName; use parser::{Parse, ParserContext}; -use properties::{LonghandId, ShorthandId, PropertyId, PropertyFlags, PropertyDeclarationId}; +use properties::{LonghandId, PropertyDeclarationId, PropertyFlags, PropertyId, ShorthandId}; use selectors::parser::SelectorParseErrorKind; use std::fmt::{self, Write}; -use style_traits::{CssWriter, KeywordsCollectFn, ParseError, StyleParseErrorKind, SpecifiedValueInfo, ToCss}; -use values::{CustomIdent, KeyframesName}; +use style_traits::{ + CssWriter, KeywordsCollectFn, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss, +}; use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount; use values::generics::box_::Perspective as GenericPerspective; use values::generics::box_::VerticalAlign as GenericVerticalAlign; -use values::specified::{AllowQuirks, Number}; use values::specified::length::{LengthOrPercentage, NonNegativeLength}; +use values::specified::{AllowQuirks, Number}; +use values::{CustomIdent, KeyframesName}; +use Atom; fn in_ua_or_chrome_sheet(context: &ParserContext) -> bool { use stylesheets::Origin; diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index 0bb8abc62aa2..6a0f54b39261 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -9,13 +9,13 @@ use cssparser::{AngleOrNumber, NumberOrPercentage, Parser, Token}; use parser::ParserContext; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use style_traits::values::specified::AllowedNumericType; -use values::{CSSFloat, CSSInteger}; +use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use values::computed; -use values::specified::{Angle, Time}; -use values::specified::length::{AbsoluteLength, FontRelativeLength, NoCalcLength}; use values::specified::length::ViewportPercentageLength; +use values::specified::length::{AbsoluteLength, FontRelativeLength, NoCalcLength}; +use values::specified::{Angle, Time}; +use values::{CSSFloat, CSSInteger}; /// A node inside a `Calc` expression's AST. #[derive(Clone, Debug)] diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 85d29f3e7e77..cc9884525ffc 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -4,6 +4,7 @@ //! Specified color values. +use super::AllowQuirks; use cssparser::{AngleOrNumber, Color as CSSParserColor, Parser, Token, RGBA}; use cssparser::{BasicParseErrorKind, NumberOrPercentage, ParseErrorKind}; #[cfg(feature = "gecko")] @@ -16,7 +17,6 @@ use std::fmt::{self, Write}; use std::io::Write as IoWrite; use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError, StyleParseErrorKind}; use style_traits::{SpecifiedValueInfo, ToCss, ValueParseErrorKind}; -use super::AllowQuirks; use values::computed::{Color as ComputedColor, Context, ToComputedValue}; use values::generics::color::Color as GenericColor; use values::specified::calc::CalcNode; diff --git a/components/style/values/specified/counters.rs b/components/style/values/specified/counters.rs index ea369f9dec75..d994339c5b59 100644 --- a/components/style/values/specified/counters.rs +++ b/components/style/values/specified/counters.rs @@ -10,17 +10,17 @@ use cssparser::{Parser, Token}; use parser::{Parse, ParserContext}; use selectors::parser::SelectorParseErrorKind; use style_traits::{ParseError, StyleParseErrorKind}; -use values::CustomIdent; -#[cfg(feature = "gecko")] -use values::generics::CounterStyleOrNone; use values::generics::counters as generics; use values::generics::counters::CounterIncrement as GenericCounterIncrement; use values::generics::counters::CounterPair; use values::generics::counters::CounterReset as GenericCounterReset; #[cfg(feature = "gecko")] +use values::generics::CounterStyleOrNone; +use values::specified::url::SpecifiedImageUrl; +#[cfg(feature = "gecko")] use values::specified::Attr; use values::specified::Integer; -use values::specified::url::SpecifiedImageUrl; +use values::CustomIdent; /// A specified value for the `counter-increment` property. pub type CounterIncrement = GenericCounterIncrement; diff --git a/components/style/values/specified/easing.rs b/components/style/values/specified/easing.rs index d6235612693e..ab3b4cb43bcd 100644 --- a/components/style/values/specified/easing.rs +++ b/components/style/values/specified/easing.rs @@ -9,8 +9,8 @@ use parser::{Parse, ParserContext}; use selectors::parser::SelectorParseErrorKind; use style_traits::{ParseError, StyleParseErrorKind}; use values::computed::easing::TimingFunction as ComputedTimingFunction; -use values::generics::easing::{StepPosition, TimingKeyword}; use values::generics::easing::TimingFunction as GenericTimingFunction; +use values::generics::easing::{StepPosition, TimingKeyword}; use values::specified::{Integer, Number}; /// A specified timing function. diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index 861414ca756d..3562d4fdfa4c 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -7,20 +7,20 @@ use cssparser::{self, BasicParseErrorKind, Parser, Token}; use parser::{Parse, ParserContext}; use style_traits::{ParseError, StyleParseErrorKind, ValueParseErrorKind}; -#[cfg(not(feature = "gecko"))] -use values::Impossible; -use values::computed::{Context, NonNegativeNumber as ComputedNonNegativeNumber, ToComputedValue}; use values::computed::effects::BoxShadow as ComputedBoxShadow; use values::computed::effects::SimpleShadow as ComputedSimpleShadow; -use values::generics::NonNegative; +use values::computed::{Context, NonNegativeNumber as ComputedNonNegativeNumber, ToComputedValue}; use values::generics::effects::BoxShadow as GenericBoxShadow; use values::generics::effects::Filter as GenericFilter; use values::generics::effects::SimpleShadow as GenericSimpleShadow; -use values::specified::{Angle, NumberOrPercentage}; +use values::generics::NonNegative; use values::specified::color::Color; use values::specified::length::{Length, NonNegativeLength}; #[cfg(feature = "gecko")] use values::specified::url::SpecifiedUrl; +use values::specified::{Angle, NumberOrPercentage}; +#[cfg(not(feature = "gecko"))] +use values::Impossible; /// A specified value for a single shadow of the `box-shadow` property. pub type BoxShadow = diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index c69b9b1a6fc1..a2323c75c4b9 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -4,7 +4,6 @@ //! Specified values for font properties -use Atom; use app_units::Au; use byteorder::{BigEndian, ByteOrder}; use cssparser::{Parser, Token}; @@ -15,18 +14,21 @@ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use parser::{Parse, ParserContext}; use properties::longhands::system_font::SystemFont; use std::fmt::{self, Write}; +use style_traits::values::SequenceWriter; use style_traits::{CssWriter, KeywordsCollectFn, ParseError}; use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; -use style_traits::values::SequenceWriter; -use values::CustomIdent; -use values::computed::{Angle as ComputedAngle, Percentage as ComputedPercentage}; -use values::computed::{font as computed, Context, Length, NonNegativeLength, ToComputedValue}; use values::computed::font::{FamilyName, FontFamilyList, FontStyleAngle, SingleFontFamily}; -use values::generics::NonNegative; -use values::generics::font::{KeywordSize, VariationValue}; +use values::computed::{font as computed, Context, Length, NonNegativeLength, ToComputedValue}; +use values::computed::{Angle as ComputedAngle, Percentage as ComputedPercentage}; use values::generics::font::{self as generics, FeatureTagValue, FontSettings, FontTag}; -use values::specified::{AllowQuirks, Angle, Integer, LengthOrPercentage, NoCalcLength, Number, Percentage}; +use values::generics::font::{KeywordSize, VariationValue}; +use values::generics::NonNegative; use values::specified::length::{FontBaseSize, AU_PER_PT, AU_PER_PX}; +use values::specified::{ + AllowQuirks, Angle, Integer, LengthOrPercentage, NoCalcLength, Number, Percentage, +}; +use values::CustomIdent; +use Atom; // FIXME(emilio): The system font code is copy-pasta, and should be cleaned up. macro_rules! system_font_methods { diff --git a/components/style/values/specified/gecko.rs b/components/style/values/specified/gecko.rs index 847d632511e7..5d9b773fd045 100644 --- a/components/style/values/specified/gecko.rs +++ b/components/style/values/specified/gecko.rs @@ -9,8 +9,8 @@ use gecko::values::GeckoStyleCoordConvertible; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut}; use parser::{Parse, ParserContext}; use std::fmt; -use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::values::SequenceWriter; +use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use values::computed; use values::computed::length::CSSPixelLength; use values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint; diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index ec00393febdf..80b98688979f 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -9,12 +9,12 @@ use cssparser::{ParseError as CssParseError, Parser, Token}; use parser::{Parse, ParserContext}; use std::mem; use style_traits::{ParseError, StyleParseErrorKind}; -use values::{CSSFloat, CustomIdent}; use values::computed::{self, Context, ToComputedValue}; use values::generics::grid::{GridTemplateComponent, RepeatCount, TrackBreadth}; use values::generics::grid::{LineNameList, TrackKeyword, TrackRepeat, TrackSize}; use values::generics::grid::{TrackList, TrackListType, TrackListValue}; use values::specified::{Integer, LengthOrPercentage}; +use values::{CSSFloat, CustomIdent}; /// Parse a single flexible length. pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index b8c1c9f3958f..e515082d860d 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -7,8 +7,7 @@ //! //! [image]: https://drafts.csswg.org/css-images/#image-values -use Atom; -use cssparser::{Parser, Token, Delimiter}; +use cssparser::{Delimiter, Parser, Token}; use custom_properties::SpecifiedValue; use parser::{Parse, ParserContext}; use selectors::parser::SelectorParseErrorKind; @@ -17,17 +16,18 @@ use servo_url::ServoUrl; use std::cmp::Ordering; use std::fmt::{self, Write}; use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError}; -use style_traits::{StyleParseErrorKind, SpecifiedValueInfo, ToCss}; -use values::{Either, None_}; +use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; #[cfg(feature = "gecko")] use values::computed::{Context, Position as ComputedPosition, ToComputedValue}; -use values::generics::image::{self as generic, Circle, CompatMode, Ellipse, ShapeExtent}; use values::generics::image::PaintWorklet; +use values::generics::image::{self as generic, Circle, CompatMode, Ellipse, ShapeExtent}; use values::generics::position::Position as GenericPosition; -use values::specified::{Angle, Color, Length, LengthOrPercentage}; -use values::specified::{Number, NumberOrPercentage, Percentage}; use values::specified::position::{LegacyPosition, Position, PositionComponent, Side, X, Y}; use values::specified::url::SpecifiedImageUrl; +use values::specified::{Angle, Color, Length, LengthOrPercentage}; +use values::specified::{Number, NumberOrPercentage, Percentage}; +use values::{Either, None_}; +use Atom; /// A specified image layer. pub type ImageLayer = Either; diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 128ab9959a58..05f5ccd55cd0 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -6,6 +6,7 @@ //! //! [length]: https://drafts.csswg.org/css-values/#lengths +use super::{AllowQuirks, Number, Percentage, ToComputedValue}; use app_units::Au; use cssparser::{Parser, Token}; use euclid::Size2D; @@ -13,18 +14,17 @@ use font_metrics::FontMetricsQueryResult; use parser::{Parse, ParserContext}; use std::cmp; use std::ops::{Add, Mul}; -use style_traits::{ParseError, SpecifiedValueInfo, StyleParseErrorKind}; use style_traits::values::specified::AllowedNumericType; -use super::{AllowQuirks, Number, Percentage, ToComputedValue}; -use values::{Auto, CSSFloat, Either, Normal}; +use style_traits::{ParseError, SpecifiedValueInfo, StyleParseErrorKind}; use values::computed::{self, CSSPixelLength, Context, ExtremumLength}; -use values::generics::NonNegative; use values::generics::length::{MaxLength as GenericMaxLength, MozLength as GenericMozLength}; +use values::generics::NonNegative; use values::specified::calc::CalcNode; +use values::{Auto, CSSFloat, Either, Normal}; -pub use values::specified::calc::CalcLengthOrPercentage; pub use super::image::{ColorStop, EndingShape as GradientEndingShape, Gradient}; pub use super::image::{GradientKind, Image}; +pub use values::specified::calc::CalcLengthOrPercentage; /// Number of app units per pixel pub const AU_PER_PX: CSSFloat = 60.; diff --git a/components/style/values/specified/list.rs b/components/style/values/specified/list.rs index f1fba44b0802..4e30364eff52 100644 --- a/components/style/values/specified/list.rs +++ b/components/style/values/specified/list.rs @@ -9,9 +9,9 @@ use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; #[cfg(feature = "gecko")] -use values::CustomIdent; -#[cfg(feature = "gecko")] use values::generics::CounterStyleOrNone; +#[cfg(feature = "gecko")] +use values::CustomIdent; /// Specified and computed `list-style-type` property. #[cfg(feature = "gecko")] diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 0a910f9ce6ab..afac1f50a393 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -6,47 +6,51 @@ //! //! TODO(emilio): Enhance docs. -use {Atom, Namespace, Prefix}; +use super::computed::{Context, ToComputedValue}; +use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; +use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize}; +use super::generics::{GreaterThanOrEqualToOne, NonNegative}; +use super::{Auto, CSSFloat, CSSInteger, Either}; use context::QuirksMode; use cssparser::{Parser, Token}; use num_traits::One; use parser::{Parse, ParserContext}; use std::f32; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use style_traits::values::specified::AllowedNumericType; -use super::{Auto, CSSFloat, CSSInteger, Either}; -use super::computed::{Context, ToComputedValue}; -use super::generics::{GreaterThanOrEqualToOne, NonNegative}; -use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; -use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize}; +use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use values::serialize_atom_identifier; use values::specified::calc::CalcNode; +use {Atom, Namespace, Prefix}; -pub use self::angle::Angle; #[cfg(feature = "gecko")] pub use self::align::{AlignContent, AlignItems, AlignSelf, ContentDistribution}; #[cfg(feature = "gecko")] pub use self::align::{JustifyContent, JustifyItems, JustifySelf, SelfAlignment}; +pub use self::angle::Angle; pub use self::background::{BackgroundRepeat, BackgroundSize}; pub use self::basic_shape::FillRule; pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing}; -pub use self::column::ColumnCount; -pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight}; -pub use self::font::{FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings}; -pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; -pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; pub use self::box_::{Appearance, Clear, Float}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor}; +pub use self::column::ColumnCount; pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset}; pub use self::easing::TimingFunction; pub use self::effects::{BoxShadow, Filter, SimpleShadow}; pub use self::flex::FlexBasis; +pub use self::font::{ + FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings, +}; +pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; +pub use self::font::{ + FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight, +}; +pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom}; #[cfg(feature = "gecko")] pub use self::gecko::ScrollSnapPoint; pub use self::image::{ColorStop, EndingShape as GradientEndingShape, Gradient}; @@ -57,30 +61,30 @@ pub use self::length::{LengthOrPercentage, LengthOrPercentageOrAuto}; pub use self::length::{LengthOrPercentageOrNone, MaxLength, MozLength}; pub use self::length::{NoCalcLength, ViewportPercentageLength}; pub use self::length::{NonNegativeLengthOrPercentage, NonNegativeLengthOrPercentageOrAuto}; -pub use self::list::Quotes; #[cfg(feature = "gecko")] pub use self::list::ListStyleType; +pub use self::list::Quotes; pub use self::motion::OffsetPath; pub use self::outline::OutlineStyle; -pub use self::rect::LengthOrNumberRect; -pub use self::resolution::Resolution; pub use self::percentage::Percentage; pub use self::position::{GridAutoFlow, GridTemplateAreas, Position}; pub use self::position::{PositionComponent, ZIndex}; +pub use self::rect::LengthOrNumberRect; +pub use self::resolution::Resolution; +pub use self::svg::MozContextProperties; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; -pub use self::svg::MozContextProperties; pub use self::svg_path::SVGPathData; pub use self::table::XSpan; pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize, TextAlign}; -pub use self::text::{TextEmphasisPosition, TextEmphasisStyle}; pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing}; +pub use self::text::{TextEmphasisPosition, TextEmphasisStyle}; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform}; pub use self::transform::{TransformOrigin, TransformStyle, Translate}; -pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon}; #[cfg(feature = "gecko")] pub use self::ui::CursorImage; +pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon}; pub use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent; #[cfg(feature = "gecko")] diff --git a/components/style/values/specified/percentage.rs b/components/style/values/specified/percentage.rs index 9f8fb1bfbf5b..55c5216fb17a 100644 --- a/components/style/values/specified/percentage.rs +++ b/components/style/values/specified/percentage.rs @@ -7,12 +7,12 @@ use cssparser::{Parser, Token}; use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss}; use style_traits::values::specified::AllowedNumericType; -use values::{serialize_percentage, CSSFloat}; -use values::computed::{Context, ToComputedValue}; +use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss}; use values::computed::percentage::Percentage as ComputedPercentage; +use values::computed::{Context, ToComputedValue}; use values::specified::calc::CalcNode; +use values::{serialize_percentage, CSSFloat}; /// A percentage value. #[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)] diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index 6117436695fd..0459d2818d8d 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -16,13 +16,13 @@ use std::fmt::{self, Write}; use std::ops::Range; use str::HTML_SPACE_CHARACTERS; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -use values::{Either, None_}; use values::computed::{CalcLengthOrPercentage, LengthOrPercentage as ComputedLengthOrPercentage}; use values::computed::{Context, Percentage, ToComputedValue}; use values::generics::position::Position as GenericPosition; use values::generics::position::ZIndex as GenericZIndex; -use values::specified::{AllowQuirks, Integer, LengthOrPercentage}; use values::specified::transform::OriginComponent; +use values::specified::{AllowQuirks, Integer, LengthOrPercentage}; +use values::{Either, None_}; /// The specified value of a CSS `` pub type Position = GenericPosition; diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index f91ac511af1e..4b64e8fe5375 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -9,12 +9,12 @@ use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; use style_traits::{CommaWithSpace, CssWriter, ParseError, Separator}; use style_traits::{StyleParseErrorKind, ToCss}; -use values::CustomIdent; use values::generics::svg as generic; -use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber}; -use values::specified::{Number, Opacity}; use values::specified::color::Color; use values::specified::url::SpecifiedUrl; +use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber}; +use values::specified::{Number, Opacity}; +use values::CustomIdent; /// Specified SVG Paint value pub type SVGPaint = generic::SVGPaint; diff --git a/components/style/values/specified/svg_path.rs b/components/style/values/specified/svg_path.rs index c3acf4585fa9..02d19bffcf45 100644 --- a/components/style/values/specified/svg_path.rs +++ b/components/style/values/specified/svg_path.rs @@ -10,11 +10,11 @@ use std::fmt::{self, Write}; use std::iter::{Cloned, Peekable}; use std::ops::AddAssign; use std::slice; -use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::values::SequenceWriter; -use values::CSSFloat; +use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use values::animated::{Animate, Procedure, ToAnimatedZero}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; +use values::CSSFloat; /// The SVG path data. /// diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 3168dd4c06f0..32405076054e 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -9,22 +9,22 @@ use parser::{Parse, ParserContext}; use properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode; use selectors::parser::SelectorParseErrorKind; use std::fmt::{self, Write}; +use style_traits::values::SequenceWriter; use style_traits::{CssWriter, KeywordsCollectFn, ParseError}; use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; -use style_traits::values::SequenceWriter; use unicode_segmentation::UnicodeSegmentation; -use values::computed::{Context, ToComputedValue}; use values::computed::text::LineHeight as ComputedLineHeight; use values::computed::text::TextEmphasisKeywordValue as ComputedTextEmphasisKeywordValue; use values::computed::text::TextEmphasisStyle as ComputedTextEmphasisStyle; use values::computed::text::TextOverflow as ComputedTextOverflow; +use values::computed::{Context, ToComputedValue}; use values::generics::text::InitialLetter as GenericInitialLetter; use values::generics::text::LineHeight as GenericLineHeight; use values::generics::text::MozTabSize as GenericMozTabSize; use values::generics::text::Spacing; -use values::specified::{AllowQuirks, Integer, NonNegativeNumber, Number}; use values::specified::length::{FontRelativeLength, Length, LengthOrPercentage, NoCalcLength}; use values::specified::length::{NonNegativeLength, NonNegativeLengthOrPercentage}; +use values::specified::{AllowQuirks, Integer, NonNegativeNumber, Number}; /// A specified type for the `initial-letter` property. pub type InitialLetter = GenericInitialLetter; diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs index 6895a918346e..bca7c6b06365 100644 --- a/components/style/values/specified/time.rs +++ b/components/style/values/specified/time.rs @@ -7,12 +7,12 @@ use cssparser::{Parser, Token}; use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use style_traits::values::specified::AllowedNumericType; -use values::CSSFloat; -use values::computed::{Context, ToComputedValue}; +use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use values::computed::time::Time as ComputedTime; +use values::computed::{Context, ToComputedValue}; use values::specified::calc::CalcNode; +use values::CSSFloat; /// A time value according to CSS-VALUES ยง 6.2. #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)] diff --git a/components/style/values/specified/transform.rs b/components/style/values/specified/transform.rs index 1a789c1959d6..d306211329e0 100644 --- a/components/style/values/specified/transform.rs +++ b/components/style/values/specified/transform.rs @@ -11,8 +11,8 @@ use values::computed::{Context, LengthOrPercentage as ComputedLengthOrPercentage use values::computed::{Percentage as ComputedPercentage, ToComputedValue}; use values::generics::transform as generic; use values::generics::transform::{Matrix, Matrix3D}; -use values::specified::{self, Angle, Integer, Length, LengthOrPercentage, Number}; use values::specified::position::{Side, X, Y}; +use values::specified::{self, Angle, Integer, Length, LengthOrPercentage, Number}; pub use values::generics::transform::TransformStyle; diff --git a/components/style/values/specified/ui.rs b/components/style/values/specified/ui.rs index c9c5c0a84147..ec930b28c004 100644 --- a/components/style/values/specified/ui.rs +++ b/components/style/values/specified/ui.rs @@ -7,13 +7,13 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::cursor::CursorKind; -use values::{Auto, Either}; +use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use values::generics::ui as generics; -use values::specified::Number; use values::specified::color::Color; use values::specified::url::SpecifiedImageUrl; +use values::specified::Number; +use values::{Auto, Either}; /// auto | pub type ColorOrAuto = Either; diff --git a/components/style/values/specified/url.rs b/components/style/values/specified/url.rs index d5a165f22d81..fe68c3143f5b 100644 --- a/components/style/values/specified/url.rs +++ b/components/style/values/specified/url.rs @@ -6,10 +6,10 @@ use values::generics::url::UrlOrNone as GenericUrlOrNone; -#[cfg(feature = "servo")] -pub use servo::url::{SpecifiedImageUrl, SpecifiedUrl}; #[cfg(feature = "gecko")] pub use gecko::url::{SpecifiedImageUrl, SpecifiedUrl}; +#[cfg(feature = "servo")] +pub use servo::url::{SpecifiedImageUrl, SpecifiedUrl}; /// Specified | pub type UrlOrNone = GenericUrlOrNone; diff --git a/components/style_derive/cg.rs b/components/style_derive/cg.rs index 9338e3b4f5e1..fdbb96794c50 100644 --- a/components/style_derive/cg.rs +++ b/components/style_derive/cg.rs @@ -9,7 +9,7 @@ use syn::{GenericArgument, GenericParam, Ident, Path}; use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray}; use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple}; use syn::{Variant, WherePredicate}; -use synstructure::{self, BindingInfo, BindStyle, VariantAst, VariantInfo}; +use synstructure::{self, BindStyle, BindingInfo, VariantAst, VariantInfo}; pub fn add_predicate(where_clause: &mut Option, pred: WherePredicate) { where_clause diff --git a/components/style_derive/compute_squared_distance.rs b/components/style_derive/compute_squared_distance.rs index f7e50c6bb007..a2d7cb770909 100644 --- a/components/style_derive/compute_squared_distance.rs +++ b/components/style_derive/compute_squared_distance.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use animate::{AnimationInputAttrs, AnimationVariantAttrs, AnimationFieldAttrs}; +use animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs}; use cg; use quote::Tokens; use syn::{DeriveInput, Path}; diff --git a/components/style_traits/values.rs b/components/style_traits/values.rs index e101dd41c3ff..056f2179d28d 100644 --- a/components/style_traits/values.rs +++ b/components/style_traits/values.rs @@ -5,8 +5,8 @@ //! Helper types and traits for the handling of CSS values. use app_units::Au; -use cssparser::{ParseError, Parser, Token, UnicodeRange, serialize_string}; use cssparser::ToCss as CssparserToCss; +use cssparser::{serialize_string, ParseError, Parser, Token, UnicodeRange}; use servo_arc::Arc; use std::fmt::{self, Write}; diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs index 5cf7bc956676..7b01924dd668 100644 --- a/components/style_traits/viewport.rs +++ b/components/style_traits/viewport.rs @@ -4,10 +4,10 @@ //! Helper types for the `@viewport` rule. -use {CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss}; use cssparser::Parser; use euclid::TypedSize2D; use std::fmt::{self, Write}; +use {CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss}; define_css_keyword_enum! { pub enum UserZoom { @@ -115,9 +115,9 @@ impl Zoom { /// /// pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { - use ParsingMode; use cssparser::Token; use values::specified::AllowedNumericType::NonNegative; + use ParsingMode; let location = input.current_source_location(); match *input.next()? { diff --git a/components/url/lib.rs b/components/url/lib.rs index 3dc822617fbc..069fc767691c 100644 --- a/components/url/lib.rs +++ b/components/url/lib.rs @@ -19,14 +19,14 @@ extern crate uuid; pub mod origin; -pub use crate::origin::{OpaqueOrigin, ImmutableOrigin, MutableOrigin}; +pub use crate::origin::{ImmutableOrigin, MutableOrigin, OpaqueOrigin}; use std::fmt; use std::net::IpAddr; -use std::ops::{Range, RangeFrom, RangeTo, RangeFull, Index}; +use std::ops::{Index, Range, RangeFrom, RangeFull, RangeTo}; use std::path::Path; use std::sync::Arc; -use url::{Url, Position}; +use url::{Position, Url}; pub use url::Host; diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 179ebb829228..c199eddee28b 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -38,14 +38,16 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, TraversalDirection}; use net_traits::image::base::PixelFormat; use regex::Captures; -use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg}; use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId}; -use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand, WebDriverJSValue}; +use script_traits::webdriver_msg::{ + WebDriverJSError, WebDriverJSResult, WebDriverJSValue, WebDriverScriptCommand, +}; +use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg}; use serde::de::{Deserialize, Deserializer, MapAccess, Visitor}; use serde::ser::{Serialize, Serializer}; use serde_json::Value; use servo_channel::Sender; -use servo_config::prefs::{PREFS, PrefValue}; +use servo_config::prefs::{PrefValue, PREFS}; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::collections::BTreeMap; @@ -54,9 +56,13 @@ use std::net::{SocketAddr, SocketAddrV4}; use std::thread; use std::time::Duration; use uuid::Uuid; -use webdriver::command::{AddCookieParameters, GetParameters, JavascriptCommandParameters, LocatorParameters}; +use webdriver::command::{ + AddCookieParameters, GetParameters, JavascriptCommandParameters, LocatorParameters, +}; use webdriver::command::{SendKeysParameters, SwitchToFrameParameters, TimeoutsParameters}; -use webdriver::command::{WebDriverCommand, WebDriverExtensionCommand, WebDriverMessage, WindowRectParameters}; +use webdriver::command::{ + WebDriverCommand, WebDriverExtensionCommand, WebDriverMessage, WindowRectParameters, +}; use webdriver::common::{Cookie, Date, LocatorStrategy, WebElement}; use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult}; use webdriver::httpapi::WebDriverExtensionRoute; diff --git a/components/webvr/lib.rs b/components/webvr/lib.rs index cd22e81e3c93..6b84eb6e1a90 100644 --- a/components/webvr/lib.rs +++ b/components/webvr/lib.rs @@ -17,4 +17,4 @@ extern crate servo_config; extern crate webvr_traits; mod webvr_thread; -pub use crate::webvr_thread::{WebVRThread, WebVRCompositorHandler}; +pub use crate::webvr_thread::{WebVRCompositorHandler, WebVRThread}; diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs index cdfd4f6140a3..4a264e073c02 100644 --- a/components/webvr/webvr_thread.rs +++ b/components/webvr/webvr_thread.rs @@ -11,10 +11,10 @@ use rust_webvr::VRServiceManager; use script_traits::ConstellationMsg; use servo_channel::{channel, Receiver, Sender}; use servo_config::prefs::PREFS; -use std::{thread, time}; use std::collections::{HashMap, HashSet}; -use webvr_traits::{WebVRMsg, WebVRResult}; +use std::{thread, time}; use webvr_traits::webvr::*; +use webvr_traits::{WebVRMsg, WebVRResult}; /// WebVRThread owns native VRDisplays, handles their life cycle inside Servo and /// acts a doorman for untrusted VR requests from DOM Objects. These are the key components diff --git a/components/webvr_traits/lib.rs b/components/webvr_traits/lib.rs index 7478a1dbcb8c..d1d33111eb08 100644 --- a/components/webvr_traits/lib.rs +++ b/components/webvr_traits/lib.rs @@ -12,20 +12,20 @@ pub extern crate rust_webvr_api as webvr; mod webvr_traits; -pub use crate::webvr::VRDisplayData as WebVRDisplayData; pub use crate::webvr::VRDisplayCapabilities as WebVRDisplayCapabilities; +pub use crate::webvr::VRDisplayData as WebVRDisplayData; pub use crate::webvr::VRDisplayEvent as WebVRDisplayEvent; pub use crate::webvr::VRDisplayEventReason as WebVRDisplayEventReason; pub use crate::webvr::VREvent as WebVREvent; pub use crate::webvr::VREye as WebVREye; pub use crate::webvr::VREyeParameters as WebVREyeParameters; pub use crate::webvr::VRFieldOfView as WebVRFieldOfView; +pub use crate::webvr::VRFrameData as WebVRFrameData; pub use crate::webvr::VRGamepadButton as WebVRGamepadButton; pub use crate::webvr::VRGamepadData as WebVRGamepadData; pub use crate::webvr::VRGamepadEvent as WebVRGamepadEvent; pub use crate::webvr::VRGamepadHand as WebVRGamepadHand; pub use crate::webvr::VRGamepadState as WebVRGamepadState; -pub use crate::webvr::VRFrameData as WebVRFrameData; pub use crate::webvr::VRLayer as WebVRLayer; pub use crate::webvr::VRPose as WebVRPose; pub use crate::webvr::VRStageParameters as WebVRStageParameters; diff --git a/ports/libmlservo/src/lib.rs b/ports/libmlservo/src/lib.rs index 39e6f2af4818..e094d856d474 100644 --- a/ports/libmlservo/src/lib.rs +++ b/ports/libmlservo/src/lib.rs @@ -14,17 +14,15 @@ use egl::egl::EGLSurface; use egl::egl::MakeCurrent; use egl::egl::SwapBuffers; use egl::eglext::eglGetProcAddress; -use servo::BrowserId; -use servo::Servo; use servo::compositing::windowing::AnimationState; use servo::compositing::windowing::EmbedderCoordinates; use servo::compositing::windowing::MouseWindowEvent; use servo::compositing::windowing::WindowEvent; use servo::compositing::windowing::WindowMethods; -use servo::embedder_traits::EmbedderMsg; -use servo::embedder_traits::EventLoopWaker; use servo::embedder_traits::resources::Resource; use servo::embedder_traits::resources::ResourceReaderMethods; +use servo::embedder_traits::EmbedderMsg; +use servo::embedder_traits::EventLoopWaker; use servo::euclid::TypedPoint2D; use servo::euclid::TypedRect; use servo::euclid::TypedScale; @@ -40,6 +38,8 @@ use servo::webrender_api::DevicePixel; use servo::webrender_api::DevicePoint; use servo::webrender_api::LayoutPixel; use servo::webrender_api::ScrollLocation; +use servo::BrowserId; +use servo::Servo; use smallvec::SmallVec; use std::ffi::CStr; use std::ffi::CString; diff --git a/ports/libsimpleservo/src/api.rs b/ports/libsimpleservo/src/api.rs index 8ecc9ed6eb12..1c3745316127 100644 --- a/ports/libsimpleservo/src/api.rs +++ b/ports/libsimpleservo/src/api.rs @@ -3,16 +3,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use serde_json; -use servo::{self, gl, webrender_api, BrowserId, Servo}; -use servo::compositing::windowing::{AnimationState, EmbedderCoordinates, MouseWindowEvent, WindowEvent, WindowMethods}; -use servo::embedder_traits::EmbedderMsg; +use servo::compositing::windowing::{ + AnimationState, EmbedderCoordinates, MouseWindowEvent, WindowEvent, WindowMethods, +}; use servo::embedder_traits::resources::{self, Resource}; +use servo::embedder_traits::EmbedderMsg; use servo::euclid::{TypedPoint2D, TypedScale, TypedSize2D, TypedVector2D}; use servo::msg::constellation_msg::TraversalDirection; use servo::script_traits::{MouseButton, TouchEventType}; use servo::servo_config::opts; use servo::servo_config::prefs::{PrefValue, PREFS}; use servo::servo_url::ServoUrl; +use servo::{self, gl, webrender_api, BrowserId, Servo}; use std::cell::{Cell, RefCell}; use std::mem; use std::path::PathBuf; diff --git a/ports/libsimpleservo/src/capi.rs b/ports/libsimpleservo/src/capi.rs index b5b1f3939246..bcd1d2478549 100644 --- a/ports/libsimpleservo/src/capi.rs +++ b/ports/libsimpleservo/src/capi.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::api::{self, EventLoopWaker, InitOptions, ServoGlue, SERVO, HostTrait, ReadFileTrait}; +use crate::api::{self, EventLoopWaker, HostTrait, InitOptions, ReadFileTrait, ServoGlue, SERVO}; use crate::gl_glue; use servo::gl; use std::ffi::{CStr, CString}; diff --git a/ports/libsimpleservo/src/jniapi.rs b/ports/libsimpleservo/src/jniapi.rs index 27bc375d28c0..a6fc987ff954 100644 --- a/ports/libsimpleservo/src/jniapi.rs +++ b/ports/libsimpleservo/src/jniapi.rs @@ -5,12 +5,12 @@ #![allow(non_snake_case)] use android_logger::{self, Filter}; -use crate::api::{self, EventLoopWaker, InitOptions, ServoGlue, SERVO, HostTrait, ReadFileTrait}; +use crate::api::{self, EventLoopWaker, HostTrait, InitOptions, ReadFileTrait, ServoGlue, SERVO}; use crate::gl_glue; -use jni::{errors, JNIEnv, JavaVM}; use jni::objects::{GlobalRef, JClass, JObject, JString, JValue}; use jni::sys::{jboolean, jfloat, jint, jstring, JNI_TRUE}; -use libc::{pipe, dup2, read}; +use jni::{errors, JNIEnv, JavaVM}; +use libc::{dup2, pipe, read}; use log::Level; use std; use std::os::raw::{c_char, c_int, c_void}; @@ -441,7 +441,7 @@ impl HostTrait for HostCallbacks { } fn initialize_android_glue(env: &JNIEnv, activity: JObject) { - use android_injected_glue::{ANDROID_APP, ffi}; + use android_injected_glue::{ffi, ANDROID_APP}; // From jni-rs to android_injected_glue diff --git a/rustfmt.toml b/rustfmt.toml index 0a1dde3b80c4..de839baed137 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1,3 @@ match_block_trailing_comma = true binop_separator = "Back" -# Turn off import reordering, since the new algorithm clashes with tidy. -reorder_imports = false +reorder_imports = true diff --git a/tests/unit/metrics/interactive_time.rs b/tests/unit/metrics/interactive_time.rs index c525ccdfc2c8..9b3d0a6f5323 100644 --- a/tests/unit/metrics/interactive_time.rs +++ b/tests/unit/metrics/interactive_time.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use ipc_channel::ipc; -use metrics::{InteractiveMetrics, InteractiveFlag}; +use metrics::{InteractiveFlag, InteractiveMetrics}; use metrics::{ProfilerMetadataFactory, ProgressiveWebMetric}; use profile_traits::time::{ProfilerChan, TimerMetadata}; use servo_url::ServoUrl; diff --git a/tests/unit/script/headers.rs b/tests/unit/script/headers.rs index a08b82b5dfa1..ae0df0eff2b8 100644 --- a/tests/unit/script/headers.rs +++ b/tests/unit/script/headers.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use script::test::{ByteString, normalize_value}; +use script::test::{normalize_value, ByteString}; #[test] fn test_normalize_empty_bytestring() { diff --git a/tests/unit/script/htmlimageelement.rs b/tests/unit/script/htmlimageelement.rs index 6c38bfa83e2e..59810ba44ca1 100644 --- a/tests/unit/script/htmlimageelement.rs +++ b/tests/unit/script/htmlimageelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use script::test::srcset::{Descriptor, ImageSource, parse_a_srcset_attribute}; +use script::test::srcset::{parse_a_srcset_attribute, Descriptor, ImageSource}; #[test] fn no_value() { diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 6488542269b5..73d99cf15886 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -10,7 +10,7 @@ use keyboard_types::{Key, Modifiers}; use script::clipboard_provider::DummyClipboardContext; use script::test::DOMString; -use script::textinput::{TextInput, TextPoint, Selection, Lines, Direction, SelectionDirection}; +use script::textinput::{Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint}; fn text_input(lines: Lines, s: &str) -> TextInput { TextInput::new( diff --git a/tests/unit/style/attr.rs b/tests/unit/style/attr.rs index c0bcc87d28f3..b10a5c886dca 100644 --- a/tests/unit/style/attr.rs +++ b/tests/unit/style/attr.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_length}; +use style::attr::{parse_length, AttrValue, LengthOrPercentageOrAuto}; use style::values::computed::{CalcLengthOrPercentage, Percentage}; #[test] diff --git a/tests/unit/style/custom_properties.rs b/tests/unit/style/custom_properties.rs index e9b4399b1b7b..b103b869323a 100644 --- a/tests/unit/style/custom_properties.rs +++ b/tests/unit/style/custom_properties.rs @@ -4,7 +4,9 @@ use cssparser::{Parser, ParserInput}; use servo_arc::Arc; -use style::custom_properties::{Name, SpecifiedValue, CustomPropertiesMap, CustomPropertiesBuilder, CssEnvironment}; +use style::custom_properties::{ + CssEnvironment, CustomPropertiesBuilder, CustomPropertiesMap, Name, SpecifiedValue, +}; use style::properties::CustomDeclarationValue; use test::{self, Bencher}; diff --git a/tests/unit/style/logical_geometry.rs b/tests/unit/style/logical_geometry.rs index e024528e65d5..5fb27d1d8772 100644 --- a/tests/unit/style/logical_geometry.rs +++ b/tests/unit/style/logical_geometry.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use euclid::{Size2D, Point2D, SideOffsets2D, Rect}; -use style::logical_geometry::{WritingMode, LogicalSize, LogicalPoint, LogicalMargin, LogicalRect}; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode}; #[cfg(test)] fn modes() -> [WritingMode; 13] { diff --git a/tests/unit/style/parsing/animation.rs b/tests/unit/style/parsing/animation.rs index c138a51a1c49..c4057398855a 100644 --- a/tests/unit/style/parsing/animation.rs +++ b/tests/unit/style/parsing/animation.rs @@ -6,8 +6,8 @@ use parsing::parse; use servo_atoms::Atom; use style::parser::Parse; use style::properties::longhands::animation_name; -use style::values::{KeyframesName, CustomIdent}; use style::values::specified::AnimationIterationCount; +use style::values::{CustomIdent, KeyframesName}; use style_traits::ToCss; #[test] diff --git a/tests/unit/style/parsing/background.rs b/tests/unit/style/parsing/background.rs index 2afb894ecf86..a8483ddd0f83 100644 --- a/tests/unit/style/parsing/background.rs +++ b/tests/unit/style/parsing/background.rs @@ -3,9 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use parsing::parse; -use style::properties::longhands::{background_attachment, background_clip, background_color, background_image}; -use style::properties::longhands::{background_origin, background_position_x, background_position_y, background_repeat}; use style::properties::longhands::background_size; +use style::properties::longhands::{ + background_attachment, background_clip, background_color, background_image, +}; +use style::properties::longhands::{ + background_origin, background_position_x, background_position_y, background_repeat, +}; use style::properties::shorthands::background; #[test] diff --git a/tests/unit/style/parsing/border.rs b/tests/unit/style/parsing/border.rs index 635e3c60a718..332c75f4b05a 100644 --- a/tests/unit/style/parsing/border.rs +++ b/tests/unit/style/parsing/border.rs @@ -4,10 +4,10 @@ use parsing::parse; use style::parser::Parse; -use style::properties::MaybeBoxed; use style::properties::longhands::{border_image_outset, border_image_repeat, border_image_slice}; use style::properties::longhands::{border_image_source, border_image_width}; use style::properties::shorthands::border_image; +use style::properties::MaybeBoxed; use style::values::specified::BorderRadius; use style_traits::ToCss; diff --git a/tests/unit/style/parsing/inherited_text.rs b/tests/unit/style/parsing/inherited_text.rs index 6f923887c4dc..b26c930cb630 100644 --- a/tests/unit/style/parsing/inherited_text.rs +++ b/tests/unit/style/parsing/inherited_text.rs @@ -8,7 +8,7 @@ use style::values::generics::text::Spacing; #[test] fn negative_letter_spacing_should_parse_properly() { use style::properties::longhands::letter_spacing; - use style::values::specified::length::{Length, NoCalcLength, FontRelativeLength}; + use style::values::specified::length::{FontRelativeLength, Length, NoCalcLength}; let negative_value = parse_longhand!(letter_spacing, "-0.5em"); let expected = Spacing::Value(Length::NoCalc(NoCalcLength::FontRelative( @@ -20,7 +20,7 @@ fn negative_letter_spacing_should_parse_properly() { #[test] fn negative_word_spacing_should_parse_properly() { use style::properties::longhands::word_spacing; - use style::values::specified::length::{NoCalcLength, LengthOrPercentage, FontRelativeLength}; + use style::values::specified::length::{FontRelativeLength, LengthOrPercentage, NoCalcLength}; let negative_value = parse_longhand!(word_spacing, "-0.5em"); let expected = Spacing::Value(LengthOrPercentage::Length(NoCalcLength::FontRelative( diff --git a/tests/unit/style/parsing/mod.rs b/tests/unit/style/parsing/mod.rs index a801b3d66050..27256a4b12c1 100644 --- a/tests/unit/style/parsing/mod.rs +++ b/tests/unit/style/parsing/mod.rs @@ -8,7 +8,7 @@ use cssparser::{Parser, ParserInput}; use style::context::QuirksMode; use style::parser::ParserContext; use style::stylesheets::{CssRuleType, Origin}; -use style_traits::{ParsingMode, ParseError}; +use style_traits::{ParseError, ParsingMode}; fn parse(f: F, s: &'static str) -> Result> where diff --git a/tests/unit/style/parsing/selectors.rs b/tests/unit/style/parsing/selectors.rs index 8fbfbfc4f249..74c8376dce9f 100644 --- a/tests/unit/style/parsing/selectors.rs +++ b/tests/unit/style/parsing/selectors.rs @@ -5,7 +5,7 @@ use cssparser::{Parser, ParserInput, ToCss}; use selectors::parser::SelectorList; use style::selector_parser::{SelectorImpl, SelectorParser}; -use style::stylesheets::{Origin, Namespaces}; +use style::stylesheets::{Namespaces, Origin}; use style_traits::ParseError; fn parse_selector<'i, 't>( diff --git a/tests/unit/style/properties/mod.rs b/tests/unit/style/properties/mod.rs index 0ceaf7c02e50..bcc8b2ef86a5 100644 --- a/tests/unit/style/properties/mod.rs +++ b/tests/unit/style/properties/mod.rs @@ -6,7 +6,7 @@ use cssparser::{Parser, ParserInput}; use style::context::QuirksMode; use style::parser::ParserContext; use style::stylesheets::{CssRuleType, Origin}; -use style_traits::{ParsingMode, ParseError}; +use style_traits::{ParseError, ParsingMode}; fn parse(f: F, s: &'static str) -> Result> where diff --git a/tests/unit/style/properties/scaffolding.rs b/tests/unit/style/properties/scaffolding.rs index 56fa88165eff..fd1f169991d0 100644 --- a/tests/unit/style/properties/scaffolding.rs +++ b/tests/unit/style/properties/scaffolding.rs @@ -4,7 +4,7 @@ use serde_json::{self, Value}; use std::env; -use std::fs::{File, remove_file}; +use std::fs::{remove_file, File}; use std::path::Path; use std::process::Command; diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs index cf37bcc0ca9b..72d7798ba682 100644 --- a/tests/unit/style/properties/serialization.rs +++ b/tests/unit/style/properties/serialization.rs @@ -4,14 +4,14 @@ use properties::{parse, parse_input}; use style::computed_values::display::T as Display; -use style::properties::{PropertyDeclaration, Importance}; use style::properties::declaration_block::PropertyDeclarationBlock; use style::properties::parse_property_declaration_list; -use style::values::RGBA; -use style::values::specified::{BorderStyle, BorderSideWidth, Color}; -use style::values::specified::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; -use style::values::specified::NoCalcLength; +use style::properties::{Importance, PropertyDeclaration}; use style::values::specified::url::SpecifiedUrl; +use style::values::specified::NoCalcLength; +use style::values::specified::{BorderSideWidth, BorderStyle, Color}; +use style::values::specified::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; +use style::values::RGBA; use style_traits::ToCss; use stylesheets::block_from; @@ -486,10 +486,10 @@ mod shorthand_serialization { } mod list_style { + use super::*; use style::properties::longhands::list_style_position::SpecifiedValue as ListStylePosition; use style::properties::longhands::list_style_type::SpecifiedValue as ListStyleType; use style::values::generics::url::UrlOrNone as ImageUrlOrNone; - use super::*; #[test] fn list_style_should_show_all_properties_when_values_are_set() { diff --git a/tests/unit/style/rule_tree/bench.rs b/tests/unit/style/rule_tree/bench.rs index 4172431356ef..243e2e2d579a 100644 --- a/tests/unit/style/rule_tree/bench.rs +++ b/tests/unit/style/rule_tree/bench.rs @@ -7,12 +7,12 @@ use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::QuirksMode; -use style::error_reporting::{ParseErrorReporter, ContextualParseError}; +use style::error_reporting::{ContextualParseError, ParseErrorReporter}; use style::media_queries::MediaList; use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock}; use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource}; use style::shared_lock::SharedRwLock; -use style::stylesheets::{Origin, Stylesheet, CssRule}; +use style::stylesheets::{CssRule, Origin, Stylesheet}; use style::thread_state::{self, ThreadState}; use test::{self, Bencher}; diff --git a/tests/unit/style/str.rs b/tests/unit/style/str.rs index 78a870dced0e..bc000df43eaa 100644 --- a/tests/unit/style/str.rs +++ b/tests/unit/style/str.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use style::str::{split_html_space_chars, str_join, starts_with_ignore_ascii_case}; +use style::str::{split_html_space_chars, starts_with_ignore_ascii_case, str_join}; #[test] pub fn split_html_space_chars_whitespace() { diff --git a/tests/unit/style/stylesheets.rs b/tests/unit/style/stylesheets.rs index 74a2c18e94bf..d951b7c6f0e1 100644 --- a/tests/unit/style/stylesheets.rs +++ b/tests/unit/style/stylesheets.rs @@ -3,32 +3,34 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{self, SourceLocation}; -use html5ever::{Namespace as NsAtom}; +use html5ever::Namespace as NsAtom; use parking_lot::RwLock; use selectors::attr::*; use selectors::parser::*; use servo_arc::Arc; use servo_atoms::Atom; -use servo_config::prefs::{PREFS, PrefValue}; +use servo_config::prefs::{PrefValue, PREFS}; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::cell::RefCell; use std::sync::atomic::AtomicBool; use style::context::QuirksMode; -use style::error_reporting::{ParseErrorReporter, ContextualParseError}; +use style::error_reporting::{ContextualParseError, ParseErrorReporter}; use style::media_queries::MediaList; +use style::properties::longhands::{self, animation_timing_function}; use style::properties::{CSSWideKeyword, CustomDeclaration}; use style::properties::{CustomDeclarationValue, Importance}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock}; -use style::properties::longhands::{self, animation_timing_function}; use style::shared_lock::SharedRwLock; -use style::stylesheets::{Origin, Namespaces}; -use style::stylesheets::{Stylesheet, StylesheetContents, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule}; -use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframePercentage}; -use style::values::{KeyframesName, CustomIdent}; +use style::stylesheets::keyframes_rule::{Keyframe, KeyframePercentage, KeyframeSelector}; +use style::stylesheets::{ + CssRule, CssRules, KeyframesRule, NamespaceRule, StyleRule, Stylesheet, StylesheetContents, +}; +use style::stylesheets::{Namespaces, Origin}; use style::values::computed::Percentage; -use style::values::specified::{LengthOrPercentageOrAuto, PositionComponent}; use style::values::specified::TimingFunction; +use style::values::specified::{LengthOrPercentageOrAuto, PositionComponent}; +use style::values::{CustomIdent, KeyframesName}; pub fn block_from(iterable: I) -> PropertyDeclarationBlock where diff --git a/tests/unit/style/stylist.rs b/tests/unit/style/stylist.rs index 80d017611b73..e868505c3d1a 100644 --- a/tests/unit/style/stylist.rs +++ b/tests/unit/style/stylist.rs @@ -10,14 +10,14 @@ use servo_arc::Arc; use servo_atoms::Atom; use style::context::QuirksMode; use style::media_queries::{Device, MediaType}; -use style::properties::{PropertyDeclarationBlock, PropertyDeclaration}; use style::properties::{longhands, Importance}; +use style::properties::{PropertyDeclaration, PropertyDeclarationBlock}; use style::selector_map::SelectorMap; use style::selector_parser::{SelectorImpl, SelectorParser}; use style::shared_lock::SharedRwLock; use style::stylesheets::StyleRule; -use style::stylist::{Stylist, Rule}; use style::stylist::needs_revalidation_for_testing; +use style::stylist::{Rule, Stylist}; use style::thread_state::{self, ThreadState}; /// Helper method to get some Rules from selector strings. diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 2ad0c773c0a4..61fb725a56d5 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -6,19 +6,19 @@ use cssparser::{Parser, ParserInput}; use euclid::TypedScale; use euclid::TypedSize2D; use servo_arc::Arc; -use servo_config::prefs::{PREFS, PrefValue}; +use servo_config::prefs::{PrefValue, PREFS}; use servo_url::ServoUrl; use style::context::QuirksMode; use style::media_queries::{Device, MediaList, MediaType}; use style::parser::ParserContext; use style::shared_lock::{SharedRwLock, StylesheetGuards}; -use style::stylesheets::{CssRuleType, Stylesheet, StylesheetInDocument, Origin}; use style::stylesheets::viewport_rule::*; +use style::stylesheets::{CssRuleType, Origin, Stylesheet, StylesheetInDocument}; use style::values::specified::LengthOrPercentageOrAuto::{self, Auto}; use style::values::specified::NoCalcLength::{self, ViewportPercentage}; use style::values::specified::ViewportPercentageLength::Vw; -use style_traits::{ParsingMode, PinchZoomFactor}; use style_traits::viewport::*; +use style_traits::{ParsingMode, PinchZoomFactor}; macro_rules! stylesheet { ($css:expr, $origin:ident) => {