aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-11 21:16:54 +0200
committerGitHub <noreply@github.com>2023-09-11 19:16:54 +0000
commitaad2dccc9c9f6b89922c07933cfa7087a8cd1ec4 (patch)
tree68dec1a9d53f4ed564843a9580fba70bf90dbef1 /components/script
parent413da4ca69d3013528c09bbaf38629a72384372d (diff)
downloadservo-aad2dccc9c9f6b89922c07933cfa7087a8cd1ec4.tar.gz
servo-aad2dccc9c9f6b89922c07933cfa7087a8cd1ec4.zip
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting * Reformat all imports
Diffstat (limited to 'components/script')
-rw-r--r--components/script/animations.rs28
-rw-r--r--components/script/body.rs43
-rw-r--r--components/script/build.rs8
-rw-r--r--components/script/canvas_state.rs66
-rw-r--r--components/script/devtools.rs22
-rw-r--r--components/script/document_loader.rs10
-rw-r--r--components/script/dom/abstractworker.rs5
-rw-r--r--components/script/dom/abstractworkerglobalscope.rs5
-rw-r--r--components/script/dom/activation.rs3
-rw-r--r--components/script/dom/analysernode.rs17
-rw-r--r--components/script/dom/animationevent.rs7
-rw-r--r--components/script/dom/attr.rs18
-rw-r--r--components/script/dom/audiobuffer.rs20
-rw-r--r--components/script/dom/audiobuffersourcenode.rs24
-rw-r--r--components/script/dom/audiocontext.rs17
-rw-r--r--components/script/dom/audiodestinationnode.rs6
-rw-r--r--components/script/dom/audiolistener.rs14
-rw-r--r--components/script/dom/audionode.rs20
-rw-r--r--components/script/dom/audioparam.rs14
-rw-r--r--components/script/dom/audioscheduledsourcenode.rs11
-rw-r--r--components/script/dom/audiotrack.rs6
-rw-r--r--components/script/dom/audiotracklist.rs3
-rw-r--r--components/script/dom/baseaudiocontext.rs46
-rw-r--r--components/script/dom/beforeunloadevent.rs5
-rw-r--r--components/script/dom/bindings/callback.rs26
-rw-r--r--components/script/dom/bindings/cell.rs10
-rw-r--r--components/script/dom/bindings/constant.rs6
-rw-r--r--components/script/dom/bindings/conversions.rs44
-rw-r--r--components/script/dom/bindings/error.rs34
-rw-r--r--components/script/dom/bindings/guard.rs8
-rw-r--r--components/script/dom/bindings/htmlconstructor.rs112
-rw-r--r--components/script/dom/bindings/inheritance.rs7
-rw-r--r--components/script/dom/bindings/interface.rs65
-rw-r--r--components/script/dom/bindings/iterable.rs23
-rw-r--r--components/script/dom/bindings/like.rs7
-rw-r--r--components/script/dom/bindings/namespace.rs8
-rw-r--r--components/script/dom/bindings/num.rs5
-rw-r--r--components/script/dom/bindings/principals.rs18
-rw-r--r--components/script/dom/bindings/proxyhandler.rs65
-rw-r--r--components/script/dom/bindings/record.rs37
-rw-r--r--components/script/dom/bindings/refcounted.rs21
-rw-r--r--components/script/dom/bindings/reflector.rs8
-rw-r--r--components/script/dom/bindings/root.rs24
-rw-r--r--components/script/dom/bindings/settings_stack.rs13
-rw-r--r--components/script/dom/bindings/str.rs17
-rw-r--r--components/script/dom/bindings/structuredclone.rs48
-rw-r--r--components/script/dom/bindings/trace.rs51
-rw-r--r--components/script/dom/bindings/transferable.rs3
-rw-r--r--components/script/dom/bindings/utils.rs68
-rw-r--r--components/script/dom/bindings/weakref.rs20
-rw-r--r--components/script/dom/bindings/xmlname.rs3
-rw-r--r--components/script/dom/biquadfilternode.rs25
-rw-r--r--components/script/dom/blob.rs26
-rw-r--r--components/script/dom/bluetoothadvertisingevent.rs12
-rw-r--r--components/script/dom/bluetoothcharacteristicproperties.rs3
-rw-r--r--components/script/dom/bluetoothdevice.rs23
-rw-r--r--components/script/dom/bluetoothpermissionresult.rs10
-rw-r--r--components/script/dom/bluetoothremotegattcharacteristic.rs12
-rw-r--r--components/script/dom/bluetoothremotegattdescriptor.rs12
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs15
-rw-r--r--components/script/dom/bluetoothremotegattservice.rs8
-rw-r--r--components/script/dom/bluetoothuuid.rs5
-rw-r--r--components/script/dom/broadcastchannel.rs12
-rw-r--r--components/script/dom/canvasgradient.rs12
-rw-r--r--components/script/dom/canvaspattern.rs7
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs26
-rw-r--r--components/script/dom/cdatasection.rs3
-rw-r--r--components/script/dom/channelmergernode.rs9
-rw-r--r--components/script/dom/channelsplitternode.rs7
-rw-r--r--components/script/dom/characterdata.rs3
-rw-r--r--components/script/dom/client.rs13
-rw-r--r--components/script/dom/closeevent.rs7
-rw-r--r--components/script/dom/comment.rs5
-rw-r--r--components/script/dom/compositionevent.rs5
-rw-r--r--components/script/dom/console.rs8
-rw-r--r--components/script/dom/constantsourcenode.rs19
-rw-r--r--components/script/dom/create.rs10
-rw-r--r--components/script/dom/crypto.rs15
-rw-r--r--components/script/dom/css.rs15
-rw-r--r--components/script/dom/cssconditionrule.rs9
-rw-r--r--components/script/dom/cssfontfacerule.rs9
-rw-r--r--components/script/dom/cssgroupingrule.rs9
-rw-r--r--components/script/dom/cssimportrule.rs9
-rw-r--r--components/script/dom/csskeyframerule.rs9
-rw-r--r--components/script/dom/csskeyframesrule.rs13
-rw-r--r--components/script/dom/cssmediarule.rs17
-rw-r--r--components/script/dom/cssnamespacerule.rs9
-rw-r--r--components/script/dom/cssrule.rs10
-rw-r--r--components/script/dom/cssrulelist.rs15
-rw-r--r--components/script/dom/cssstyledeclaration.rs29
-rw-r--r--components/script/dom/cssstylerule.rs19
-rw-r--r--components/script/dom/cssstylesheet.rs12
-rw-r--r--components/script/dom/cssstylevalue.rs11
-rw-r--r--components/script/dom/csssupportsrule.rs17
-rw-r--r--components/script/dom/customelementregistry.rs39
-rw-r--r--components/script/dom/customevent.rs12
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs53
-rw-r--r--components/script/dom/dissimilaroriginlocation.rs9
-rw-r--r--components/script/dom/dissimilaroriginwindow.rs15
-rw-r--r--components/script/dom/document.rs150
-rw-r--r--components/script/dom/documentfragment.rs10
-rw-r--r--components/script/dom/documentorshadowroot.rs23
-rw-r--r--components/script/dom/documenttype.rs3
-rw-r--r--components/script/dom/domexception.rs10
-rw-r--r--components/script/dom/domimplementation.rs10
-rw-r--r--components/script/dom/dommatrix.rs9
-rw-r--r--components/script/dom/dommatrixreadonly.rs25
-rw-r--r--components/script/dom/domparser.rs17
-rw-r--r--components/script/dom/dompoint.rs5
-rw-r--r--components/script/dom/dompointreadonly.rs8
-rw-r--r--components/script/dom/domquad.rs5
-rw-r--r--components/script/dom/domrect.rs5
-rw-r--r--components/script/dom/domrectreadonly.rs8
-rw-r--r--components/script/dom/domstringlist.rs3
-rw-r--r--components/script/dom/domstringmap.rs3
-rw-r--r--components/script/dom/domtokenlist.rs9
-rw-r--r--components/script/dom/dynamicmoduleowner.rs8
-rw-r--r--components/script/dom/element.rs133
-rw-r--r--components/script/dom/errorevent.rs14
-rw-r--r--components/script/dom/event.rs16
-rw-r--r--components/script/dom/eventsource.rs45
-rw-r--r--components/script/dom/eventtarget.rs58
-rw-r--r--components/script/dom/extendableevent.rs7
-rw-r--r--components/script/dom/extendablemessageevent.rs11
-rw-r--r--components/script/dom/fakexrdevice.rs25
-rw-r--r--components/script/dom/fakexrinputcontroller.rs11
-rw-r--r--components/script/dom/file.rs9
-rw-r--r--components/script/dom/filelist.rs6
-rw-r--r--components/script/dom/filereader.rs25
-rw-r--r--components/script/dom/filereadersync.rs14
-rw-r--r--components/script/dom/focusevent.rs8
-rw-r--r--components/script/dom/formdata.rs12
-rw-r--r--components/script/dom/formdataevent.rs10
-rw-r--r--components/script/dom/gainnode.rs14
-rw-r--r--components/script/dom/gamepad.rs13
-rw-r--r--components/script/dom/gamepadbutton.rs6
-rw-r--r--components/script/dom/gamepadbuttonlist.rs3
-rw-r--r--components/script/dom/gamepadevent.rs7
-rw-r--r--components/script/dom/gamepadlist.rs3
-rw-r--r--components/script/dom/gamepadpose.rs12
-rw-r--r--components/script/dom/globalscope.rs126
-rw-r--r--components/script/dom/gpu.rs26
-rw-r--r--components/script/dom/gpuadapter.rs18
-rw-r--r--components/script/dom/gpuadapterinfo.rs5
-rw-r--r--components/script/dom/gpubindgroup.rs5
-rw-r--r--components/script/dom/gpubindgrouplayout.rs5
-rw-r--r--components/script/dom/gpubuffer.rs29
-rw-r--r--components/script/dom/gpubufferusage.rs3
-rw-r--r--components/script/dom/gpucanvascontext.rs37
-rw-r--r--components/script/dom/gpucolorwrite.rs3
-rw-r--r--components/script/dom/gpucommandbuffer.rs13
-rw-r--r--components/script/dom/gpucommandencoder.rs30
-rw-r--r--components/script/dom/gpucompilationinfo.rs5
-rw-r--r--components/script/dom/gpucompilationmessage.rs5
-rw-r--r--components/script/dom/gpucomputepassencoder.rs12
-rw-r--r--components/script/dom/gpucomputepipeline.rs8
-rw-r--r--components/script/dom/gpudevice.rs51
-rw-r--r--components/script/dom/gpudevicelostinfo.rs6
-rw-r--r--components/script/dom/gpumapmode.rs3
-rw-r--r--components/script/dom/gpuoutofmemoryerror.rs5
-rw-r--r--components/script/dom/gpupipelinelayout.rs5
-rw-r--r--components/script/dom/gpuqueryset.rs2
-rw-r--r--components/script/dom/gpuqueue.rs15
-rw-r--r--components/script/dom/gpurenderbundle.rs5
-rw-r--r--components/script/dom/gpurenderbundleencoder.rs12
-rw-r--r--components/script/dom/gpurenderpassencoder.rs14
-rw-r--r--components/script/dom/gpurenderpipeline.rs8
-rw-r--r--components/script/dom/gpusampler.rs5
-rw-r--r--components/script/dom/gpushadermodule.rs10
-rw-r--r--components/script/dom/gpushaderstage.rs3
-rw-r--r--components/script/dom/gpusupportedlimits.rs7
-rw-r--r--components/script/dom/gputexture.rs15
-rw-r--r--components/script/dom/gputextureusage.rs3
-rw-r--r--components/script/dom/gputextureview.rs5
-rw-r--r--components/script/dom/gpuuncapturederrorevent.rs7
-rw-r--r--components/script/dom/gpuvalidationerror.rs8
-rw-r--r--components/script/dom/hashchangeevent.rs7
-rw-r--r--components/script/dom/headers.rs19
-rw-r--r--components/script/dom/history.rs24
-rw-r--r--components/script/dom/htmlanchorelement.rs22
-rw-r--r--components/script/dom/htmlareaelement.rs21
-rw-r--r--components/script/dom/htmlaudioelement.rs7
-rw-r--r--components/script/dom/htmlbaseelement.rs9
-rw-r--r--components/script/dom/htmlbodyelement.rs15
-rw-r--r--components/script/dom/htmlbrelement.rs7
-rwxr-xr-xcomponents/script/dom/htmlbuttonelement.rs21
-rw-r--r--components/script/dom/htmlcanvaselement.rs36
-rw-r--r--components/script/dom/htmlcollection.rs12
-rw-r--r--components/script/dom/htmldataelement.rs7
-rw-r--r--components/script/dom/htmldatalistelement.rs7
-rw-r--r--components/script/dom/htmldetailselement.rs10
-rw-r--r--components/script/dom/htmldialogelement.rs7
-rw-r--r--components/script/dom/htmldirectoryelement.rs7
-rw-r--r--components/script/dom/htmldivelement.rs7
-rw-r--r--components/script/dom/htmldlistelement.rs7
-rw-r--r--components/script/dom/htmlelement.rs31
-rw-r--r--components/script/dom/htmlembedelement.rs7
-rw-r--r--components/script/dom/htmlfieldsetelement.rs12
-rw-r--r--components/script/dom/htmlfontelement.rs15
-rw-r--r--components/script/dom/htmlformcontrolscollection.rs5
-rw-r--r--components/script/dom/htmlformelement.rs54
-rw-r--r--components/script/dom/htmlframeelement.rs7
-rw-r--r--components/script/dom/htmlframesetelement.rs7
-rw-r--r--components/script/dom/htmlheadelement.rs7
-rw-r--r--components/script/dom/htmlheadingelement.rs7
-rw-r--r--components/script/dom/htmlhrelement.rs11
-rw-r--r--components/script/dom/htmlhtmlelement.rs7
-rw-r--r--components/script/dom/htmliframeelement.rs37
-rw-r--r--components/script/dom/htmlimageelement.rs94
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs73
-rw-r--r--components/script/dom/htmllabelelement.rs9
-rw-r--r--components/script/dom/htmllegendelement.rs7
-rw-r--r--components/script/dom/htmllielement.rs9
-rw-r--r--components/script/dom/htmllinkelement.rs39
-rw-r--r--components/script/dom/htmlmapelement.rs7
-rw-r--r--components/script/dom/htmlmediaelement.rs83
-rw-r--r--components/script/dom/htmlmenuelement.rs7
-rw-r--r--components/script/dom/htmlmetaelement.rs9
-rw-r--r--components/script/dom/htmlmeterelement.rs7
-rw-r--r--components/script/dom/htmlmodelement.rs7
-rwxr-xr-xcomponents/script/dom/htmlobjectelement.rs14
-rw-r--r--components/script/dom/htmlolistelement.rs7
-rw-r--r--components/script/dom/htmloptgroupelement.rs9
-rw-r--r--components/script/dom/htmloptionelement.rs16
-rw-r--r--components/script/dom/htmloptionscollection.rs5
-rw-r--r--components/script/dom/htmloutputelement.rs7
-rw-r--r--components/script/dom/htmlparagraphelement.rs7
-rw-r--r--components/script/dom/htmlparamelement.rs7
-rw-r--r--components/script/dom/htmlpictureelement.rs7
-rw-r--r--components/script/dom/htmlpreelement.rs7
-rw-r--r--components/script/dom/htmlprogresselement.rs7
-rw-r--r--components/script/dom/htmlquoteelement.rs7
-rw-r--r--components/script/dom/htmlscriptelement.rs90
-rwxr-xr-xcomponents/script/dom/htmlselectelement.rs21
-rw-r--r--components/script/dom/htmlsourceelement.rs10
-rw-r--r--components/script/dom/htmlspanelement.rs7
-rw-r--r--components/script/dom/htmlstyleelement.rs24
-rw-r--r--components/script/dom/htmltablecaptionelement.rs7
-rw-r--r--components/script/dom/htmltablecellelement.rs16
-rw-r--r--components/script/dom/htmltablecolelement.rs7
-rw-r--r--components/script/dom/htmltableelement.rs14
-rw-r--r--components/script/dom/htmltablerowelement.rs11
-rw-r--r--components/script/dom/htmltablesectionelement.rs11
-rw-r--r--components/script/dom/htmltemplateelement.rs7
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs27
-rw-r--r--components/script/dom/htmltimeelement.rs7
-rw-r--r--components/script/dom/htmltitleelement.rs7
-rw-r--r--components/script/dom/htmltrackelement.rs7
-rw-r--r--components/script/dom/htmlulistelement.rs7
-rw-r--r--components/script/dom/htmlunknownelement.rs7
-rw-r--r--components/script/dom/htmlvideoelement.rs40
-rw-r--r--components/script/dom/identityhub.rs12
-rw-r--r--components/script/dom/imagebitmap.rs15
-rw-r--r--components/script/dom/imagedata.rs24
-rw-r--r--components/script/dom/inputevent.rs5
-rw-r--r--components/script/dom/keyboardevent.rs10
-rw-r--r--components/script/dom/location.rs9
-rw-r--r--components/script/dom/mediadeviceinfo.rs10
-rw-r--r--components/script/dom/mediadevices.rs27
-rw-r--r--components/script/dom/mediaelementaudiosourcenode.rs17
-rw-r--r--components/script/dom/mediaerror.rs3
-rw-r--r--components/script/dom/mediafragmentparser.rs5
-rw-r--r--components/script/dom/medialist.rs18
-rw-r--r--components/script/dom/mediametadata.rs10
-rw-r--r--components/script/dom/mediaquerylist.rs17
-rw-r--r--components/script/dom/mediaquerylistevent.rs15
-rw-r--r--components/script/dom/mediasession.rs29
-rw-r--r--components/script/dom/mediastream.rs9
-rw-r--r--components/script/dom/mediastreamaudiodestinationnode.rs14
-rw-r--r--components/script/dom/mediastreamaudiosourcenode.rs9
-rw-r--r--components/script/dom/mediastreamtrack.rs7
-rw-r--r--components/script/dom/mediastreamtrackaudiosourcenode.rs7
-rw-r--r--components/script/dom/messagechannel.rs5
-rw-r--r--components/script/dom/messageevent.rs11
-rw-r--r--components/script/dom/messageport.rs23
-rw-r--r--components/script/dom/mimetype.rs3
-rw-r--r--components/script/dom/mimetypearray.rs3
-rw-r--r--components/script/dom/mouseevent.rs14
-rw-r--r--components/script/dom/mutationobserver.rs15
-rw-r--r--components/script/dom/mutationrecord.rs5
-rw-r--r--components/script/dom/namednodemap.rs5
-rw-r--r--components/script/dom/navigationpreloadmanager.rs13
-rw-r--r--components/script/dom/navigator.rs5
-rw-r--r--components/script/dom/navigatorinfo.rs3
-rw-r--r--components/script/dom/node.rs87
-rw-r--r--components/script/dom/nodeiterator.rs11
-rw-r--r--components/script/dom/nodelist.rs8
-rw-r--r--components/script/dom/offlineaudiocompletionevent.rs12
-rw-r--r--components/script/dom/offlineaudiocontext.rs24
-rw-r--r--components/script/dom/offscreencanvas.rs19
-rw-r--r--components/script/dom/offscreencanvasrenderingcontext2d.rs23
-rw-r--r--components/script/dom/oscillatornode.rs24
-rw-r--r--components/script/dom/pagetransitionevent.rs10
-rw-r--r--components/script/dom/paintrenderingcontext2d.rs31
-rw-r--r--components/script/dom/paintsize.rs10
-rw-r--r--components/script/dom/paintworkletglobalscope.rs81
-rw-r--r--components/script/dom/pannernode.rs24
-rw-r--r--components/script/dom/performance.rs15
-rw-r--r--components/script/dom/performanceentry.rs3
-rw-r--r--components/script/dom/performancenavigation.rs3
-rw-r--r--components/script/dom/performancenavigationtiming.rs8
-rw-r--r--components/script/dom/performanceobserver.rs18
-rw-r--r--components/script/dom/performanceobserverentrylist.rs3
-rw-r--r--components/script/dom/performancepainttiming.rs7
-rw-r--r--components/script/dom/performanceresourcetiming.rs7
-rw-r--r--components/script/dom/permissions.rs22
-rw-r--r--components/script/dom/permissionstatus.rs12
-rw-r--r--components/script/dom/plugin.rs3
-rw-r--r--components/script/dom/pluginarray.rs3
-rw-r--r--components/script/dom/popstateevent.rs11
-rw-r--r--components/script/dom/processinginstruction.rs3
-rw-r--r--components/script/dom/progressevent.rs7
-rw-r--r--components/script/dom/promise.rs36
-rw-r--r--components/script/dom/promisenativehandler.rs9
-rw-r--r--components/script/dom/promiserejectionevent.rs14
-rw-r--r--components/script/dom/radionodelist.rs5
-rw-r--r--components/script/dom/range.rs25
-rw-r--r--components/script/dom/raredata.rs8
-rw-r--r--components/script/dom/readablestream.rs45
-rw-r--r--components/script/dom/request.rs56
-rw-r--r--components/script/dom/response.rs33
-rw-r--r--components/script/dom/rtcdatachannel.rs32
-rw-r--r--components/script/dom/rtcdatachannelevent.rs12
-rw-r--r--components/script/dom/rtcerror.rs11
-rw-r--r--components/script/dom/rtcerrorevent.rs12
-rw-r--r--components/script/dom/rtcicecandidate.rs13
-rw-r--r--components/script/dom/rtcpeerconnection.rs39
-rw-r--r--components/script/dom/rtcpeerconnectioniceevent.rs15
-rw-r--r--components/script/dom/rtcrtpsender.rs9
-rw-r--r--components/script/dom/rtcrtptransceiver.rs6
-rw-r--r--components/script/dom/rtcsessiondescription.rs11
-rw-r--r--components/script/dom/rtctrackevent.rs7
-rw-r--r--components/script/dom/screen.rs16
-rw-r--r--components/script/dom/selection.rs6
-rw-r--r--components/script/dom/serviceworker.rs16
-rw-r--r--components/script/dom/serviceworkercontainer.rs25
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs42
-rw-r--r--components/script/dom/serviceworkerregistration.rs21
-rw-r--r--components/script/dom/servoparser/async_html.rs40
-rw-r--r--components/script/dom/servoparser/html.rs21
-rw-r--r--components/script/dom/servoparser/mod.rs59
-rw-r--r--components/script/dom/servoparser/prefetch.rs36
-rw-r--r--components/script/dom/servoparser/xml.rs13
-rw-r--r--components/script/dom/shadowroot.rs17
-rw-r--r--components/script/dom/stereopannernode.rs16
-rw-r--r--components/script/dom/storage.rs15
-rw-r--r--components/script/dom/storageevent.rs7
-rw-r--r--components/script/dom/stylepropertymapreadonly.rs18
-rw-r--r--components/script/dom/stylesheet.rs3
-rw-r--r--components/script/dom/stylesheetlist.rs7
-rw-r--r--components/script/dom/submitevent.rs7
-rw-r--r--components/script/dom/svgelement.rs12
-rw-r--r--components/script/dom/svggraphicselement.rs7
-rw-r--r--components/script/dom/svgsvgelement.rs11
-rw-r--r--components/script/dom/testbinding.rs60
-rw-r--r--components/script/dom/testbindingiterable.rs5
-rw-r--r--components/script/dom/testbindingmaplike.rs10
-rw-r--r--components/script/dom/testbindingpairiterable.rs5
-rw-r--r--components/script/dom/testbindingproxy.rs3
-rw-r--r--components/script/dom/testbindingsetlike.rs10
-rw-r--r--components/script/dom/testrunner.rs9
-rw-r--r--components/script/dom/testworklet.rs14
-rw-r--r--components/script/dom/testworkletglobalscope.rs17
-rw-r--r--components/script/dom/text.rs5
-rw-r--r--components/script/dom/textcontrol.rs3
-rw-r--r--components/script/dom/textdecoder.rs12
-rw-r--r--components/script/dom/textencoder.rs14
-rw-r--r--components/script/dom/textmetrics.rs3
-rw-r--r--components/script/dom/texttrack.rs6
-rw-r--r--components/script/dom/texttrackcue.rs6
-rw-r--r--components/script/dom/texttrackcuelist.rs3
-rw-r--r--components/script/dom/texttracklist.rs3
-rw-r--r--components/script/dom/timeranges.rs6
-rw-r--r--components/script/dom/touch.rs3
-rw-r--r--components/script/dom/touchevent.rs6
-rw-r--r--components/script/dom/touchlist.rs3
-rw-r--r--components/script/dom/trackevent.rs7
-rw-r--r--components/script/dom/transitionevent.rs7
-rw-r--r--components/script/dom/treewalker.rs11
-rw-r--r--components/script/dom/uievent.rs12
-rw-r--r--components/script/dom/url.rs20
-rw-r--r--components/script/dom/urlhelper.rs6
-rw-r--r--components/script/dom/urlsearchparams.rs7
-rw-r--r--components/script/dom/userscripts.rs12
-rwxr-xr-xcomponents/script/dom/validitystate.rs14
-rw-r--r--components/script/dom/vertexarrayobject.rs10
-rw-r--r--components/script/dom/videotrack.rs6
-rw-r--r--components/script/dom/videotracklist.rs6
-rw-r--r--components/script/dom/virtualmethods.rs16
-rw-r--r--components/script/dom/vttcue.rs8
-rw-r--r--components/script/dom/vttregion.rs8
-rw-r--r--components/script/dom/webgl2renderingcontext.rs65
-rw-r--r--components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs10
-rw-r--r--components/script/dom/webgl_extensions/ext/extblendminmax.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/extfragdepth.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/extshadertexturelod.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/oeselementindexuint.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturefloat.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs3
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs3
-rw-r--r--components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs10
-rw-r--r--components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs5
-rw-r--r--components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs5
-rw-r--r--components/script/dom/webgl_extensions/extension.rs3
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs18
-rw-r--r--components/script/dom/webgl_extensions/mod.rs3
-rw-r--r--components/script/dom/webgl_extensions/wrapper.rs10
-rw-r--r--components/script/dom/webgl_validations/tex_image_2d.rs10
-rw-r--r--components/script/dom/webgl_validations/types.rs3
-rw-r--r--components/script/dom/webglactiveinfo.rs3
-rw-r--r--components/script/dom/webglbuffer.rs11
-rw-r--r--components/script/dom/webglcontextevent.rs12
-rw-r--r--components/script/dom/webglframebuffer.rs18
-rw-r--r--components/script/dom/webglobject.rs3
-rw-r--r--components/script/dom/webglprogram.rs16
-rw-r--r--components/script/dom/webglquery.rs10
-rw-r--r--components/script/dom/webglrenderbuffer.rs14
-rw-r--r--components/script/dom/webglrenderingcontext.rs87
-rw-r--r--components/script/dom/webglsampler.rs10
-rw-r--r--components/script/dom/webglshader.rs19
-rw-r--r--components/script/dom/webglshaderprecisionformat.rs3
-rw-r--r--components/script/dom/webglsync.rs8
-rw-r--r--components/script/dom/webgltexture.rs20
-rw-r--r--components/script/dom/webgltransformfeedback.rs8
-rw-r--r--components/script/dom/webgluniformlocation.rs6
-rw-r--r--components/script/dom/webglvertexarrayobject.rs5
-rw-r--r--components/script/dom/webglvertexarrayobjectoes.rs5
-rw-r--r--components/script/dom/websocket.rs36
-rw-r--r--components/script/dom/wheelevent.rs8
-rw-r--r--components/script/dom/window.rs175
-rw-r--r--components/script/dom/windowproxy.rs73
-rw-r--r--components/script/dom/worker.rs29
-rw-r--r--components/script/dom/workerglobalscope.rs50
-rw-r--r--components/script/dom/workerlocation.rs5
-rw-r--r--components/script/dom/workernavigator.rs5
-rw-r--r--components/script/dom/worklet.rs66
-rw-r--r--components/script/dom/workletglobalscope.rs38
-rw-r--r--components/script/dom/xmldocument.rs14
-rw-r--r--components/script/dom/xmlhttprequest.rs83
-rw-r--r--components/script/dom/xmlhttprequesteventtarget.rs3
-rw-r--r--components/script/dom/xmlhttprequestupload.rs3
-rw-r--r--components/script/dom/xmlserializer.rs7
-rw-r--r--components/script/dom/xrcompositionlayer.rs3
-rw-r--r--components/script/dom/xrcubelayer.rs3
-rw-r--r--components/script/dom/xrcylinderlayer.rs3
-rw-r--r--components/script/dom/xrequirectlayer.rs3
-rw-r--r--components/script/dom/xrframe.rs10
-rw-r--r--components/script/dom/xrhand.rs5
-rw-r--r--components/script/dom/xrhittestresult.rs5
-rw-r--r--components/script/dom/xrhittestsource.rs5
-rw-r--r--components/script/dom/xrinputsource.rs11
-rw-r--r--components/script/dom/xrinputsourcearray.rs5
-rw-r--r--components/script/dom/xrinputsourceevent.rs7
-rw-r--r--components/script/dom/xrinputsourceschangeevent.rs13
-rw-r--r--components/script/dom/xrjointpose.rs3
-rw-r--r--components/script/dom/xrjointspace.rs7
-rw-r--r--components/script/dom/xrlayer.rs7
-rw-r--r--components/script/dom/xrlayerevent.rs15
-rw-r--r--components/script/dom/xrmediabinding.rs14
-rw-r--r--components/script/dom/xrpose.rs3
-rw-r--r--components/script/dom/xrprojectionlayer.rs3
-rw-r--r--components/script/dom/xrquadlayer.rs3
-rw-r--r--components/script/dom/xrray.rs14
-rw-r--r--components/script/dom/xrreferencespace.rs12
-rw-r--r--components/script/dom/xrrenderstate.rs13
-rw-r--r--components/script/dom/xrrigidtransform.rs18
-rw-r--r--components/script/dom/xrsession.rs53
-rw-r--r--components/script/dom/xrsessionevent.rs7
-rw-r--r--components/script/dom/xrspace.rs7
-rw-r--r--components/script/dom/xrsubimage.rs6
-rw-r--r--components/script/dom/xrsystem.rs25
-rw-r--r--components/script/dom/xrtest.rs14
-rw-r--r--components/script/dom/xrview.rs12
-rw-r--r--components/script/dom/xrviewerpose.rs13
-rw-r--r--components/script/dom/xrviewport.rs7
-rw-r--r--components/script/dom/xrwebglbinding.rs24
-rw-r--r--components/script/dom/xrwebgllayer.rs28
-rw-r--r--components/script/dom/xrwebglsubimage.rs10
-rw-r--r--components/script/fetch.rs34
-rw-r--r--components/script/image_listener.rs9
-rw-r--r--components/script/init.rs3
-rw-r--r--components/script/layout_dom/document.rs14
-rw-r--r--components/script/layout_dom/element.rs31
-rw-r--r--components/script/layout_dom/node.rs30
-rw-r--r--components/script/layout_dom/shadow_root.rs11
-rw-r--r--components/script/layout_image.rs20
-rw-r--r--components/script/mem.rs3
-rw-r--r--components/script/microtask.rs12
-rw-r--r--components/script/network_listener.rs12
-rw-r--r--components/script/realms.rs3
-rw-r--r--components/script/script_module.rs95
-rw-r--r--components/script/script_runtime.rs117
-rw-r--r--components/script/script_thread.rs180
-rw-r--r--components/script/serviceworker_manager.rs28
-rw-r--r--components/script/stylesheet_loader.rs51
-rw-r--r--components/script/task_manager.rs7
-rw-r--r--components/script/task_queue.rs12
-rw-r--r--components/script/task_source/dom_manipulation.rs10
-rw-r--r--components/script/task_source/file_reading.rs3
-rw-r--r--components/script/task_source/history_traversal.rs5
-rw-r--r--components/script/task_source/media_element.rs12
-rw-r--r--components/script/task_source/mod.rs6
-rw-r--r--components/script/task_source/networking.rs3
-rw-r--r--components/script/task_source/performance_timeline.rs8
-rw-r--r--components/script/task_source/port_message.rs6
-rw-r--r--components/script/task_source/remote_event.rs3
-rw-r--r--components/script/task_source/timer.rs6
-rw-r--r--components/script/task_source/user_interaction.rs12
-rw-r--r--components/script/task_source/websocket.rs3
-rw-r--r--components/script/test.rs8
-rw-r--r--components/script/textinput.rs12
-rw-r--r--components/script/timers.rs33
-rw-r--r--components/script/webdriver_handlers.rs52
-rw-r--r--components/script/window_named_properties.rs38
519 files changed, 4545 insertions, 4174 deletions
diff --git a/components/script/animations.rs b/components/script/animations.rs
index 752deb5c9b4..674ec7afcaa 100644
--- a/components/script/animations.rs
+++ b/components/script/animations.rs
@@ -4,6 +4,21 @@
//! The set of animations for a document.
+use std::cell::Cell;
+
+use cssparser::ToCss;
+use fxhash::{FxHashMap, FxHashSet};
+use libc::c_void;
+use msg::constellation_msg::PipelineId;
+use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg, UntrustedNodeAddress};
+use serde::{Deserialize, Serialize};
+use style::animation::{
+ Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
+ KeyframesIterationState, Transition,
+};
+use style::dom::OpaqueNode;
+use style::selector_parser::PseudoElement;
+
use crate::dom::animationevent::AnimationEvent;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AnimationEventBinding::AnimationEventInit;
@@ -18,19 +33,6 @@ use crate::dom::event::Event;
use crate::dom::node::{from_untrusted_node_address, window_from_node, Node, NodeDamage};
use crate::dom::transitionevent::TransitionEvent;
use crate::dom::window::Window;
-use cssparser::ToCss;
-use fxhash::{FxHashMap, FxHashSet};
-use libc::c_void;
-use msg::constellation_msg::PipelineId;
-use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg, UntrustedNodeAddress};
-use serde::{Deserialize, Serialize};
-use std::cell::Cell;
-use style::animation::{
- Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
- KeyframesIterationState, Transition,
-};
-use style::dom::OpaqueNode;
-use style::selector_parser::PseudoElement;
/// The set of animations for a document.
#[derive(Default, JSTraceable, MallocSizeOf)]
diff --git a/components/script/body.rs b/components/script/body.rs
index baa4011062e..b5072c10b26 100644
--- a/components/script/body.rs
+++ b/components/script/body.rs
@@ -2,6 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+use std::{ptr, str};
+
+use encoding_rs::UTF_8;
+use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::jsapi::{Heap, JSObject, JS_ClearPendingException, Value as JSValue};
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::wrappers::{JS_GetPendingException, JS_ParseJSON};
+use js::rust::HandleValue;
+use js::typedarray::{ArrayBuffer, CreateWith};
+use mime::{self, Mime};
+use net_traits::request::{
+ BodyChunkRequest, BodyChunkResponse, BodySource as NetBodySource, RequestBody,
+};
+use script_traits::serializable::BlobImpl;
+use url::form_urlencoded;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods;
@@ -24,30 +42,7 @@ use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext;
use crate::task::TaskCanceller;
use crate::task_source::networking::NetworkingTaskSource;
-use crate::task_source::TaskSource;
-use crate::task_source::TaskSourceName;
-use encoding_rs::UTF_8;
-use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
-use ipc_channel::router::ROUTER;
-use js::jsapi::Heap;
-use js::jsapi::JSObject;
-use js::jsapi::JS_ClearPendingException;
-use js::jsapi::Value as JSValue;
-use js::jsval::JSVal;
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::JS_GetPendingException;
-use js::rust::wrappers::JS_ParseJSON;
-use js::rust::HandleValue;
-use js::typedarray::{ArrayBuffer, CreateWith};
-use mime::{self, Mime};
-use net_traits::request::{
- BodyChunkRequest, BodyChunkResponse, BodySource as NetBodySource, RequestBody,
-};
-use script_traits::serializable::BlobImpl;
-use std::ptr;
-use std::rc::Rc;
-use std::str;
-use url::form_urlencoded;
+use crate::task_source::{TaskSource, TaskSourceName};
/// The Dom object, or ReadableStream, that is the source of a body.
/// <https://fetch.spec.whatwg.org/#concept-body-source>
diff --git a/components/script/build.rs b/components/script/build.rs
index ea39b698257..3fabbeee1fa 100644
--- a/components/script/build.rs
+++ b/components/script/build.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 https://mozilla.org/MPL/2.0/. */
-use phf_shared::{self, FmtConst};
-use serde_json::{self, Value};
-use std::env;
-use std::fmt;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
use std::time::Instant;
+use std::{env, fmt};
+
+use phf_shared::{self, FmtConst};
+use serde_json::{self, Value};
fn main() {
let start = Instant::now();
diff --git a/components/script/canvas_state.rs b/components/script/canvas_state.rs
index fc1eff7df8b..a376a56b737 100644
--- a/components/script/canvas_state.rs
+++ b/components/script/canvas_state.rs
@@ -2,14 +2,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::fmt;
+use std::str::FromStr;
+use std::sync::Arc;
+
+use canvas_traits::canvas::{
+ Canvas2dMsg, CanvasId, CanvasMsg, CompositionOrBlending, Direction, FillOrStrokeStyle,
+ FillRule, LineCapStyle, LineJoinStyle, LinearGradientStyle, RadialGradientStyle,
+ RepetitionStyle, TextAlign, TextBaseline,
+};
+use cssparser::{Color as CSSColor, Parser, ParserInput, RGBA};
+use euclid::default::{Point2D, Rect, Size2D, Transform2D};
+use euclid::vec2;
+use ipc_channel::ipc::{self, IpcSender};
+use net_traits::image_cache::{ImageCache, ImageResponse};
+use net_traits::request::CorsSettings;
+use pixels::PixelFormat;
+use profile_traits::ipc as profiled_ipc;
+use script_traits::ScriptMsg;
+use serde_bytes::ByteBuf;
+use servo_url::{ImmutableOrigin, ServoUrl};
+use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
+use style::properties::style_structs::Font;
+use style::values::computed::font::FontStyle;
+use style_traits::values::ToCss;
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasDirection;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextAlign;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextBaseline;
+use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
+ CanvasDirection, CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
+ CanvasTextAlign, CanvasTextBaseline,
+};
use crate::dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
use crate::dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -20,8 +43,7 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle};
use crate::dom::canvaspattern::CanvasPattern;
use crate::dom::dommatrix::DOMMatrix;
-use crate::dom::element::cors_setting_for_element;
-use crate::dom::element::Element;
+use crate::dom::element::{cors_setting_for_element, Element};
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement};
use crate::dom::imagedata::ImageData;
@@ -30,32 +52,6 @@ use crate::dom::offscreencanvas::{OffscreenCanvas, OffscreenCanvasContext};
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use crate::dom::textmetrics::TextMetrics;
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
-use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg, Direction, TextAlign, TextBaseline};
-use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
-use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
-use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
-use cssparser::Color as CSSColor;
-use cssparser::{Parser, ParserInput, RGBA};
-use euclid::{
- default::{Point2D, Rect, Size2D, Transform2D},
- vec2,
-};
-use ipc_channel::ipc::{self, IpcSender};
-use net_traits::image_cache::{ImageCache, ImageResponse};
-use net_traits::request::CorsSettings;
-use pixels::PixelFormat;
-use profile_traits::ipc as profiled_ipc;
-use script_traits::ScriptMsg;
-use serde_bytes::ByteBuf;
-use servo_url::{ImmutableOrigin, ServoUrl};
-use std::cell::Cell;
-use std::fmt;
-use std::str::FromStr;
-use std::sync::Arc;
-use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
-use style::properties::style_structs::Font;
-use style::values::computed::font::FontStyle;
-use style_traits::values::ToCss;
#[unrooted_must_root_lint::must_root]
#[derive(Clone, JSTraceable, MallocSizeOf)]
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 8ff911a6b78..b5b7afe598c 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+use std::str;
+
+use devtools_traits::{
+ AutoMargins, ComputedNodeLayout, EvaluateJSReply, Modification, NodeInfo, TimelineMarker,
+ TimelineMarkerType,
+};
+use ipc_channel::ipc::IpcSender;
+use js::jsval::UndefinedValue;
+use js::rust::ToString;
+use msg::constellation_msg::PipelineId;
+use uuid::Uuid;
+
use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
@@ -19,15 +32,6 @@ use crate::dom::node::{window_from_node, Node, ShadowIncluding};
use crate::realms::enter_realm;
use crate::script_module::ScriptFetchOptions;
use crate::script_thread::Documents;
-use devtools_traits::{AutoMargins, ComputedNodeLayout, TimelineMarkerType};
-use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker};
-use ipc_channel::ipc::IpcSender;
-use js::jsval::UndefinedValue;
-use js::rust::ToString;
-use msg::constellation_msg::PipelineId;
-use std::rc::Rc;
-use std::str;
-use uuid::Uuid;
#[allow(unsafe_code)]
pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<EvaluateJSReply>) {
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index 7dc2d6201fb..02a33a0ce74 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -6,15 +6,15 @@
//!
//! <https://html.spec.whatwg.org/multipage/#the-end>
-use crate::dom::bindings::root::Dom;
-use crate::dom::document::Document;
-use crate::fetch::FetchCanceller;
use ipc_channel::ipc::IpcSender;
use net_traits::request::RequestBuilder;
-use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseMsg};
-use net_traits::{IpcSend, ResourceThreads};
+use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseMsg, IpcSend, ResourceThreads};
use servo_url::ServoUrl;
+use crate::dom::bindings::root::Dom;
+use crate::dom::document::Document;
+use crate::fetch::FetchCanceller;
+
#[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum LoadType {
Image(#[no_trace] ServoUrl),
diff --git a/components/script/dom/abstractworker.rs b/components/script/dom/abstractworker.rs
index 36ff18fe01b..c3ef855599e 100644
--- a/components/script/dom/abstractworker.rs
+++ b/components/script/dom/abstractworker.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use script_traits::StructuredSerializedData;
+use servo_url::ImmutableOrigin;
+
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
use crate::script_runtime::CommonScriptMsg;
-use script_traits::StructuredSerializedData;
-use servo_url::ImmutableOrigin;
/// Messages used to control the worker event loops
pub enum WorkerScriptMsg {
diff --git a/components/script/dom/abstractworkerglobalscope.rs b/components/script/dom/abstractworkerglobalscope.rs
index 0261c82996c..b0c580df7e4 100644
--- a/components/script/dom/abstractworkerglobalscope.rs
+++ b/components/script/dom/abstractworkerglobalscope.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crossbeam_channel::{select, Receiver, Sender};
+use devtools_traits::DevtoolScriptControlMsg;
+
use crate::dom::abstractworker::WorkerScriptMsg;
use crate::dom::bindings::conversions::DerivedFrom;
use crate::dom::bindings::reflector::DomObject;
@@ -12,8 +15,6 @@ use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::realms::enter_realm;
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
use crate::task_queue::{QueuedTaskConversion, TaskQueue};
-use crossbeam_channel::{select, Receiver, Sender};
-use devtools_traits::DevtoolScriptControlMsg;
/// A ScriptChan that can be cloned freely and will silently send a TrustedWorkerAddress with
/// common event loop messages. While this SendableWorkerScriptChan is alive, the associated
diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs
index 4e6ac769885..0880d1fdb64 100644
--- a/components/script/dom/activation.rs
+++ b/components/script/dom/activation.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use script_layout_interface::message::ReflowGoal;
+
use crate::dom::element::Element;
use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlinputelement::InputActivationState;
use crate::dom::node::window_from_node;
use crate::dom::window::ReflowReason;
-use script_layout_interface::message::ReflowGoal;
/// Trait for elements with defined activation behavior
pub trait Activatable {
diff --git a/components/script/dom/analysernode.rs b/components/script/dom/analysernode.rs
index 7a83ca0052e..237a0e79fb6 100644
--- a/components/script/dom/analysernode.rs
+++ b/components/script/dom/analysernode.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use ipc_channel::ipc::{self, IpcReceiver};
+use ipc_channel::router::ROUTER;
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{Float32Array, Uint8Array};
+use servo_media::audio::analyser_node::AnalysisEngine;
+use servo_media::audio::block::Block;
+use servo_media::audio::node::AudioNodeInit;
+
use crate::dom::audionode::AudioNode;
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::cell::DomRefCell;
@@ -18,14 +27,6 @@ use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::{self, IpcReceiver};
-use ipc_channel::router::ROUTER;
-use js::rust::{CustomAutoRooterGuard, HandleObject};
-use js::typedarray::{Float32Array, Uint8Array};
-use servo_media::audio::analyser_node::AnalysisEngine;
-use servo_media::audio::block::Block;
-use servo_media::audio::node::AudioNodeInit;
#[dom_struct]
pub struct AnalyserNode {
diff --git a/components/script/dom/animationevent.rs b/components/script/dom/animationevent.rs
index 053801631c5..648ed52690f 100644
--- a/components/script/dom/animationevent.rs
+++ b/components/script/dom/animationevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::AnimationEventBinding::{
AnimationEventInit, AnimationEventMethods,
};
@@ -13,9 +17,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct AnimationEvent {
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index e8fce0493bc..976831d1cc6 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::mem;
+
+use devtools_traits::AttrInfo;
+use dom_struct::dom_struct;
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
+use servo_atoms::Atom;
+use style::attr::{AttrIdentifier, AttrValue};
+use style::values::GenericAtomIdent;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -14,14 +24,6 @@ use crate::dom::mutationobserver::{Mutation, MutationObserver};
use crate::dom::node::Node;
use crate::dom::virtualmethods::vtable_for;
use crate::script_thread::ScriptThread;
-use devtools_traits::AttrInfo;
-use dom_struct::dom_struct;
-use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
-use servo_atoms::Atom;
-use std::borrow::ToOwned;
-use std::mem;
-use style::attr::{AttrIdentifier, AttrValue};
-use style::values::GenericAtomIdent;
// https://dom.spec.whatwg.org/#interface-attr
#[dom_struct]
diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs
index 29623fee6a2..81943ca25f5 100644
--- a/components/script/dom/audiobuffer.rs
+++ b/components/script/dom/audiobuffer.rs
@@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cmp::min;
+use std::ptr::{self, NonNull};
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject, JS_GetArrayBufferViewBuffer};
+use js::rust::wrappers::DetachArrayBuffer;
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{CreateWith, Float32Array};
+use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer;
+
use crate::dom::audionode::MAX_CHANNEL_COUNT;
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{
@@ -15,16 +25,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::realms::enter_realm;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JS_GetArrayBufferViewBuffer;
-use js::jsapi::{Heap, JSObject};
-use js::rust::wrappers::DetachArrayBuffer;
-use js::rust::CustomAutoRooterGuard;
-use js::rust::HandleObject;
-use js::typedarray::{CreateWith, Float32Array};
-use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer;
-use std::cmp::min;
-use std::ptr::{self, NonNull};
// Spec mandates at least [8000, 96000], we use [8000, 192000] to match Firefox
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer
diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs
index ce1880bccd9..efa0008491f 100644
--- a/components/script/dom/audiobuffersourcenode.rs
+++ b/components/script/dom/audiobuffersourcenode.rs
@@ -2,12 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::buffer_source_node::{
+ AudioBufferSourceNodeMessage, AudioBufferSourceNodeOptions,
+};
+use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
+use servo_media::audio::param::ParamType;
+
use crate::dom::audiobuffer::AudioBuffer;
use crate::dom::audioparam::AudioParam;
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
use crate::dom::baseaudiocontext::BaseAudioContext;
-use crate::dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceNodeMethods;
-use crate::dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions;
+use crate::dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::{
+ AudioBufferSourceNodeMethods, AudioBufferSourceOptions,
+};
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
use crate::dom::bindings::error::{Error, Fallible};
@@ -16,14 +28,6 @@ use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage;
-use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions;
-use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
-use servo_media::audio::param::ParamType;
-use std::cell::Cell;
-use std::f32;
#[dom_struct]
pub struct AudioBufferSourceNode {
diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs
index 914323509a2..1c0c99c205a 100644
--- a/components/script/dom/audiocontext.rs
+++ b/components/script/dom/audiocontext.rs
@@ -2,12 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use msg::constellation_msg::PipelineId;
+use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions};
+
use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions};
use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{
- AudioContextLatencyCategory, AudioContextMethods,
-};
-use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{
- AudioContextOptions, AudioTimestamp,
+ AudioContextLatencyCategory, AudioContextMethods, AudioContextOptions, AudioTimestamp,
};
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState;
@@ -30,11 +34,6 @@ use crate::dom::promise::Promise;
use crate::dom::window::Window;
use crate::realms::InRealm;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use msg::constellation_msg::PipelineId;
-use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions};
-use std::rc::Rc;
#[dom_struct]
pub struct AudioContext {
diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs
index 7e820240b63..ec1beb116bb 100644
--- a/components/script/dom/audiodestinationnode.rs
+++ b/components/script/dom/audiodestinationnode.rs
@@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods;
-use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
- ChannelCountMode, ChannelInterpretation,
+ AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct AudioDestinationNode {
diff --git a/components/script/dom/audiolistener.rs b/components/script/dom/audiolistener.rs
index 2256efaf558..d6c7b8151c3 100644
--- a/components/script/dom/audiolistener.rs
+++ b/components/script/dom/audiolistener.rs
@@ -2,21 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::f32;
+
+use dom_struct::dom_struct;
+use servo_media::audio::param::{ParamDir, ParamType};
+
use crate::dom::audioparam::AudioParam;
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::AudioListenerMethods;
-use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
+use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{
+ AudioParamMethods, AutomationRate,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AudioParamMethods;
-use dom_struct::dom_struct;
-use servo_media::audio::param::{ParamDir, ParamType};
-use std::f32;
-
#[dom_struct]
pub struct AudioListener {
reflector_: Reflector,
diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs
index 5df6d7a76b1..65d1973ebab 100644
--- a/components/script/dom/audionode.rs
+++ b/components/script/dom/audionode.rs
@@ -2,13 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use servo_media::audio::graph::NodeId;
+use servo_media::audio::node::{
+ AudioNodeInit, AudioNodeMessage, ChannelCountMode as ServoMediaChannelCountMode, ChannelInfo,
+ ChannelInterpretation as ServoMediaChannelInterpretation,
+};
+
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,
+ AudioNodeMethods, AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::codegen::InheritTypes::{
AudioNodeTypeId, AudioScheduledSourceNodeTypeId, EventTargetTypeId,
@@ -17,12 +23,6 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
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::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
// createScriptProcessor() and matches what is used by Blink and Gecko.
diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs
index 99f64d765f6..3d1ca25c77f 100644
--- a/components/script/dom/audioparam.rs
+++ b/components/script/dom/audioparam.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::sync::mpsc;
+
+use dom_struct::dom_struct;
+use servo_media::audio::graph::NodeId;
+use servo_media::audio::node::AudioNodeMessage;
+use servo_media::audio::param::{ParamRate, ParamType, RampKind, UserAutomationEvent};
+
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{
AudioParamMethods, AutomationRate,
@@ -11,12 +19,6 @@ use crate::dom::bindings::num::Finite;
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::graph::NodeId;
-use servo_media::audio::node::AudioNodeMessage;
-use servo_media::audio::param::{ParamRate, ParamType, RampKind, UserAutomationEvent};
-use std::cell::Cell;
-use std::sync::mpsc;
#[dom_struct]
pub struct AudioParam {
diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs
index ab23b5660b7..3337bb4c5cb 100644
--- a/components/script/dom/audioscheduledsourcenode.rs
+++ b/components/script/dom/audioscheduledsourcenode.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use servo_media::audio::node::{
+ AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage, OnEndedCallback,
+};
+
use crate::dom::audionode::{AudioNode, UnwrappedAudioNodeOptions};
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
@@ -11,10 +18,6 @@ use crate::dom::bindings::num::Finite;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use servo_media::audio::node::OnEndedCallback;
-use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};
-use std::cell::Cell;
#[dom_struct]
pub struct AudioScheduledSourceNode {
diff --git a/components/script/dom/audiotrack.rs b/components/script/dom/audiotrack.rs
index 19bc6d0a6cd..829ed9b7207 100644
--- a/components/script/dom/audiotrack.rs
+++ b/components/script/dom/audiotrack.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::audiotracklist::AudioTrackList;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AudioTrackBinding::AudioTrackMethods;
@@ -9,8 +13,6 @@ 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::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct AudioTrack {
diff --git a/components/script/dom/audiotracklist.rs b/components/script/dom/audiotracklist.rs
index 6a7fd3b4ebb..27311de360b 100644
--- a/components/script/dom/audiotracklist.rs
+++ b/components/script/dom/audiotracklist.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::audiotrack::AudioTrack;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AudioTrackListBinding::AudioTrackListMethods;
@@ -14,7 +16,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct AudioTrackList {
diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs
index 20180d8a939..9e0581c48e3 100644
--- a/components/script/dom/baseaudiocontext.rs
+++ b/components/script/dom/baseaudiocontext.rs
@@ -2,6 +2,26 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::hash_map::Entry;
+use std::collections::{HashMap, VecDeque};
+use std::mem;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+
+use dom_struct::dom_struct;
+use js::rust::CustomAutoRooterGuard;
+use js::typedarray::ArrayBuffer;
+use msg::constellation_msg::PipelineId;
+use servo_media::audio::context::{
+ AudioContext, AudioContextOptions, OfflineAudioContextOptions, ProcessingState,
+ RealTimeAudioContextOptions,
+};
+use servo_media::audio::decoder::AudioDecoderCallbacks;
+use servo_media::audio::graph::NodeId;
+use servo_media::{ClientContextId, ServoMedia};
+use uuid::Uuid;
+
use crate::dom::analysernode::AnalyserNode;
use crate::dom::audiobuffer::AudioBuffer;
use crate::dom::audiobuffersourcenode::AudioBufferSourceNode;
@@ -12,14 +32,12 @@ 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::AudioNodeOptions;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
- ChannelCountMode, ChannelInterpretation,
+ AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
+};
+use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::{
+ AudioContextState, BaseAudioContextMethods, DecodeErrorCallback, DecodeSuccessCallback,
};
-use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState;
-use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods;
-use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeErrorCallback;
-use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeSuccessCallback;
use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterOptions;
use crate::dom::bindings::codegen::Bindings::ChannelMergerNodeBinding::ChannelMergerOptions;
use crate::dom::bindings::codegen::Bindings::ChannelSplitterNodeBinding::ChannelSplitterOptions;
@@ -48,22 +66,6 @@ use crate::dom::stereopannernode::StereoPannerNode;
use crate::dom::window::Window;
use crate::realms::InRealm;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use js::rust::CustomAutoRooterGuard;
-use js::typedarray::ArrayBuffer;
-use msg::constellation_msg::PipelineId;
-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::{ClientContextId, ServoMedia};
-use std::cell::Cell;
-use std::collections::hash_map::Entry;
-use std::collections::{HashMap, VecDeque};
-use std::mem;
-use std::rc::Rc;
-use std::sync::{Arc, Mutex};
-use uuid::Uuid;
#[allow(dead_code)]
pub enum BaseAudioContextOptions {
diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs
index d4e27e94b32..6a30336afe8 100644
--- a/components/script/dom/beforeunloadevent.rs
+++ b/components/script/dom/beforeunloadevent.rs
@@ -4,6 +4,9 @@
#![allow(dead_code)]
+use dom_struct::dom_struct;
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
@@ -13,8 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_atoms::Atom;
// https://html.spec.whatwg.org/multipage/#beforeunloadevent
#[dom_struct]
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index 9b14f3ced60..4389c9fc280 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -4,6 +4,20 @@
//! Base classes to work with IDL callbacks.
+use std::default::Default;
+use std::ffi::CString;
+use std::mem::drop;
+use std::ops::Deref;
+use std::ptr;
+use std::rc::Rc;
+
+use js::jsapi::{
+ AddRawValueRoot, EnterRealm, Heap, IsCallable, JSObject, LeaveRealm, Realm, RemoveRawValueRoot,
+};
+use js::jsval::{JSVal, ObjectValue, UndefinedValue};
+use js::rust::wrappers::{JS_GetProperty, JS_WrapObject};
+use js::rust::{MutableHandleObject, Runtime};
+
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -15,18 +29,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::realms::{enter_realm, InRealm};
use crate::script_runtime::JSContext;
-use js::jsapi::Heap;
-use js::jsapi::{AddRawValueRoot, IsCallable, JSObject};
-use js::jsapi::{EnterRealm, LeaveRealm, Realm, RemoveRawValueRoot};
-use js::jsval::{JSVal, ObjectValue, UndefinedValue};
-use js::rust::wrappers::{JS_GetProperty, JS_WrapObject};
-use js::rust::{MutableHandleObject, Runtime};
-use std::default::Default;
-use std::ffi::CString;
-use std::mem::drop;
-use std::ops::Deref;
-use std::ptr;
-use std::rc::Rc;
/// The exception handling used for a call.
#[derive(Clone, Copy, PartialEq)]
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index 7d567e04847..124240e311e 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -4,14 +4,16 @@
//! A shareable mutable container for the DOM.
-use crate::dom::bindings::root::{assert_in_layout, assert_in_script};
+use std::cell::{BorrowError, BorrowMutError};
+#[cfg(not(feature = "refcell_backtrace"))]
+pub use std::cell::{Ref, RefCell, RefMut};
+
#[cfg(feature = "refcell_backtrace")]
pub use accountable_refcell::{ref_filter_map, Ref, RefCell, RefMut};
#[cfg(not(feature = "refcell_backtrace"))]
pub use ref_filter_map::ref_filter_map;
-use std::cell::{BorrowError, BorrowMutError};
-#[cfg(not(feature = "refcell_backtrace"))]
-pub use std::cell::{Ref, RefCell, RefMut};
+
+use crate::dom::bindings::root::{assert_in_layout, assert_in_script};
/// A mutable field in the DOM.
///
diff --git a/components/script/dom/bindings/constant.rs b/components/script/dom/bindings/constant.rs
index bce6e3d7844..4bfa3c67338 100644
--- a/components/script/dom/bindings/constant.rs
+++ b/components/script/dom/bindings/constant.rs
@@ -4,13 +4,13 @@
//! WebIDL constants.
-use crate::script_runtime::JSContext;
-use js::jsapi::JSPROP_READONLY;
-use js::jsapi::{JSPROP_ENUMERATE, JSPROP_PERMANENT};
+use js::jsapi::{JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UInt32Value};
use js::rust::wrappers::JS_DefineProperty;
use js::rust::HandleObject;
+use crate::script_runtime::JSContext;
+
/// Representation of an IDL constant.
#[derive(Clone)]
pub struct ConstantSpec {
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 405789f294d..0c79b67134c 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -32,6 +32,28 @@
//! | sequences | `Vec<T>` | |
//! | union types | `T` | |
+use std::{char, ffi, ptr, slice};
+
+use js::conversions::latin1_to_string;
+pub use js::conversions::{
+ ConversionBehavior, ConversionResult, FromJSValConvertible, ToJSValConvertible,
+};
+use js::error::throw_type_error;
+use js::glue::{GetProxyReservedSlot, IsWrapper, JS_GetReservedSlot, UnwrapObjectDynamic};
+use js::jsapi::{
+ Heap, IsWindowProxy, JSContext, JSObject, JSString, JS_DeprecatedStringHasLatin1Chars,
+ JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength, JS_IsExceptionPending,
+ JS_NewStringCopyN,
+};
+use js::jsval::{ObjectValue, StringValue, UndefinedValue};
+use js::rust::wrappers::{IsArrayObject, JS_GetProperty, JS_HasProperty};
+use js::rust::{
+ get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, HandleId, HandleObject,
+ HandleValue, MutableHandleValue, ToString,
+};
+use num_traits::Float;
+use servo_config::opts;
+
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
@@ -46,25 +68,6 @@ use crate::dom::htmlformcontrolscollection::HTMLFormControlsCollection;
use crate::dom::htmloptionscollection::HTMLOptionsCollection;
use crate::dom::nodelist::NodeList;
use crate::dom::windowproxy::WindowProxy;
-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, UnwrapObjectDynamic};
-use js::jsapi::{Heap, JSContext, JSObject, JSString};
-use js::jsapi::{IsWindowProxy, JS_DeprecatedStringHasLatin1Chars, JS_NewStringCopyN};
-use js::jsapi::{
- JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength, JS_IsExceptionPending,
-};
-use js::jsval::{ObjectValue, StringValue, UndefinedValue};
-use js::rust::wrappers::{IsArrayObject, JS_GetProperty, JS_HasProperty};
-use js::rust::{get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, ToString};
-use js::rust::{HandleId, HandleObject, HandleValue, MutableHandleValue};
-use num_traits::Float;
-use servo_config::opts;
-use std::{char, ffi, ptr, slice};
/// A trait to check whether a given `JSObject` implements an IDL interface.
pub trait IDLInterface {
@@ -384,9 +387,10 @@ pub unsafe fn private_from_object(obj: *mut JSObject) -> *const libc::c_void {
/// Get the `DOMClass` from `obj`, or `Err(())` if `obj` is not a DOM object.
pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<&'static DOMClass, ()> {
- use crate::dom::bindings::utils::DOMJSClass;
use js::glue::GetProxyHandlerExtra;
+ use crate::dom::bindings::utils::DOMJSClass;
+
let clasp = get_object_class(obj);
if is_dom_class(&*clasp) {
trace!("plain old dom object");
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index 87df14d0544..2e578b4d2f3 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -4,34 +4,32 @@
//! Utilities to throw exceptions from Rust bindings.
+use std::slice::from_raw_parts;
+
+#[cfg(feature = "js_backtrace")]
+use backtrace::Backtrace;
+use js::error::{throw_range_error, throw_type_error};
+#[cfg(feature = "js_backtrace")]
+use js::jsapi::StackFormat as JSStackFormat;
+use js::jsapi::{
+ ExceptionStackBehavior, JSContext, JS_ClearPendingException, JS_IsExceptionPending,
+};
+use js::jsval::UndefinedValue;
+use js::rust::wrappers::{JS_ErrorFromException, JS_GetPendingException, JS_SetPendingException};
+use js::rust::{HandleObject, HandleValue, MutableHandleValue};
+use libc::c_uint;
+
#[cfg(feature = "js_backtrace")]
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name;
-use crate::dom::bindings::conversions::root_from_object;
use crate::dom::bindings::conversions::{
- ConversionResult, FromJSValConvertible, ToJSValConvertible,
+ root_from_object, ConversionResult, FromJSValConvertible, ToJSValConvertible,
};
use crate::dom::bindings::str::USVString;
use crate::dom::domexception::{DOMErrorName, DOMException};
use crate::dom::globalscope::GlobalScope;
use crate::realms::InRealm;
use crate::script_runtime::JSContext as SafeJSContext;
-#[cfg(feature = "js_backtrace")]
-use backtrace::Backtrace;
-use js::error::{throw_range_error, throw_type_error};
-use js::jsapi::ExceptionStackBehavior;
-use js::jsapi::JSContext;
-use js::jsapi::JS_ClearPendingException;
-use js::jsapi::JS_IsExceptionPending;
-#[cfg(feature = "js_backtrace")]
-use js::jsapi::StackFormat as JSStackFormat;
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::JS_ErrorFromException;
-use js::rust::wrappers::JS_GetPendingException;
-use js::rust::wrappers::JS_SetPendingException;
-use js::rust::{HandleObject, HandleValue, MutableHandleValue};
-use libc::c_uint;
-use std::slice::from_raw_parts;
#[cfg(feature = "js_backtrace")]
thread_local! {
diff --git a/components/script/dom/bindings/guard.rs b/components/script/dom/bindings/guard.rs
index 17f3a3d20bc..4702e0b71e6 100644
--- a/components/script/dom/bindings/guard.rs
+++ b/components/script/dom/bindings/guard.rs
@@ -4,14 +4,14 @@
//! Machinery to conditionally expose things.
+use js::rust::HandleObject;
+use servo_config::prefs;
+
use crate::dom::bindings::codegen::InterfaceObjectMap;
use crate::dom::bindings::interface::is_exposed_in;
use crate::dom::globalscope::GlobalScope;
-use crate::realms::AlreadyInRealm;
-use crate::realms::InRealm;
+use crate::realms::{AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext;
-use js::rust::HandleObject;
-use servo_config::prefs;
/// A container with a condition.
pub struct Guard<T: Clone + Copy> {
diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs
index 5eb79e28e1b..703bfeb7c70 100644
--- a/components/script/dom/bindings/htmlconstructor.rs
+++ b/components/script/dom/bindings/htmlconstructor.rs
@@ -2,74 +2,42 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::HTMLAnchorElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLAudioElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLBRElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLButtonElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDListElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDataElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDataListElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDetailsElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDialogElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDirectoryElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLDivElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLEmbedElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLFontElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLFormElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLFrameElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLHeadElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLHeadingElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLHtmlElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLImageElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLInputElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLLIElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLLabelElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLLegendElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLMapElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLMenuElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLMeterElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLModElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLOListElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLObjectElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLOutputElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLParagraphElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLParamElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLPictureElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLPreElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLProgressElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLQuoteElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLScriptElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLSelectElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLSpanElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableColElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTimeElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTitleElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLTrackElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLUListElementBinding;
-use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding;
+use std::ptr;
+
+use html5ever::interface::QualName;
+use html5ever::{local_name, namespace_url, ns, LocalName};
+use js::conversions::ToJSValConvertible;
+use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
+use js::jsapi::{CallArgs, CurrentGlobalOrNull, JSAutoRealm, JSObject};
+use js::jsval::UndefinedValue;
+use js::rust::wrappers::{JS_GetProperty, JS_SetPrototype, JS_WrapObject};
+use js::rust::{HandleObject, MutableHandleObject, MutableHandleValue};
+
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
+use crate::dom::bindings::codegen::Bindings::{
+ HTMLAnchorElementBinding, HTMLAreaElementBinding, HTMLAudioElementBinding,
+ HTMLBRElementBinding, HTMLBaseElementBinding, HTMLBodyElementBinding, HTMLButtonElementBinding,
+ HTMLCanvasElementBinding, HTMLDListElementBinding, HTMLDataElementBinding,
+ HTMLDataListElementBinding, HTMLDetailsElementBinding, HTMLDialogElementBinding,
+ HTMLDirectoryElementBinding, HTMLDivElementBinding, HTMLElementBinding,
+ HTMLEmbedElementBinding, HTMLFieldSetElementBinding, HTMLFontElementBinding,
+ HTMLFormElementBinding, HTMLFrameElementBinding, HTMLFrameSetElementBinding,
+ HTMLHRElementBinding, HTMLHeadElementBinding, HTMLHeadingElementBinding,
+ HTMLHtmlElementBinding, HTMLIFrameElementBinding, HTMLImageElementBinding,
+ HTMLInputElementBinding, HTMLLIElementBinding, HTMLLabelElementBinding,
+ HTMLLegendElementBinding, HTMLLinkElementBinding, HTMLMapElementBinding,
+ HTMLMenuElementBinding, HTMLMetaElementBinding, HTMLMeterElementBinding, HTMLModElementBinding,
+ HTMLOListElementBinding, HTMLObjectElementBinding, HTMLOptGroupElementBinding,
+ HTMLOptionElementBinding, HTMLOutputElementBinding, HTMLParagraphElementBinding,
+ HTMLParamElementBinding, HTMLPictureElementBinding, HTMLPreElementBinding,
+ HTMLProgressElementBinding, HTMLQuoteElementBinding, HTMLScriptElementBinding,
+ HTMLSelectElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
+ HTMLStyleElementBinding, HTMLTableCaptionElementBinding, HTMLTableCellElementBinding,
+ HTMLTableColElementBinding, HTMLTableElementBinding, HTMLTableRowElementBinding,
+ HTMLTableSectionElementBinding, HTMLTemplateElementBinding, HTMLTextAreaElementBinding,
+ HTMLTimeElementBinding, HTMLTitleElementBinding, HTMLTrackElementBinding,
+ HTMLUListElementBinding, HTMLVideoElementBinding,
+};
use crate::dom::bindings::conversions::DerivedFrom;
use crate::dom::bindings::error::{throw_dom_exception, Error};
use crate::dom::bindings::inheritance::Castable;
@@ -83,16 +51,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
use crate::script_thread::ScriptThread;
-use html5ever::interface::QualName;
-use html5ever::{local_name, namespace_url, ns, LocalName};
-use js::conversions::ToJSValConvertible;
-use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
-use js::jsapi::{CallArgs, CurrentGlobalOrNull};
-use js::jsapi::{JSAutoRealm, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::{JS_GetProperty, JS_SetPrototype, JS_WrapObject};
-use js::rust::{HandleObject, MutableHandleObject, MutableHandleValue};
-use std::ptr;
// https://html.spec.whatwg.org/multipage/#htmlconstructor
unsafe fn html_constructor(
diff --git a/components/script/dom/bindings/inheritance.rs b/components/script/dom/bindings/inheritance.rs
index b9091221221..9ef1f7ad0a1 100644
--- a/components/script/dom/bindings/inheritance.rs
+++ b/components/script/dom/bindings/inheritance.rs
@@ -4,12 +4,11 @@
//! The `Castable` trait.
-pub use crate::dom::bindings::codegen::InheritTypes::*;
+use std::mem;
-use crate::dom::bindings::conversions::get_dom_class;
-use crate::dom::bindings::conversions::{DerivedFrom, IDLInterface};
+pub use crate::dom::bindings::codegen::InheritTypes::*;
+use crate::dom::bindings::conversions::{get_dom_class, DerivedFrom, IDLInterface};
use crate::dom::bindings::reflector::DomObject;
-use std::mem;
/// A trait to hold the cast functions of IDL interfaces that either derive
/// or are derived from other interfaces.
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs
index 0874881deec..cbe67894170 100644
--- a/components/script/dom/bindings/interface.rs
+++ b/components/script/dom/bindings/interface.rs
@@ -4,6 +4,34 @@
//! Machinery to initialise interface prototype objects and interface objects.
+use std::convert::TryFrom;
+use std::ptr;
+
+use js::error::throw_type_error;
+use js::glue::UncheckedUnwrapObject;
+use js::jsapi::JS::CompartmentIterResult;
+use js::jsapi::{
+ jsid, CallArgs, CheckedUnwrapStatic, Compartment, CompartmentSpecifier, CurrentGlobalOrNull,
+ GetFunctionRealm, GetNonCCWObjectGlobal, GetRealmGlobalOrNull, GetWellKnownSymbol,
+ HandleObject as RawHandleObject, IsSharableCompartment, IsSystemCompartment, JSAutoRealm,
+ JSClass, JSClassOps, JSContext, JSFunctionSpec, JSObject, JSPropertySpec, JSString, JSTracer,
+ JS_AtomizeAndPinString, JS_GetFunctionObject, JS_GetProperty, JS_IterateCompartments,
+ JS_NewFunction, JS_NewGlobalObject, JS_NewObject, JS_NewPlainObject, JS_NewStringCopyN,
+ JS_SetReservedSlot, JS_WrapObject, ObjectOps, OnNewGlobalHookOption, SymbolCode,
+ TrueHandleValue, Value, JSFUN_CONSTRUCTOR, JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING,
+};
+use js::jsval::{JSVal, NullValue, PrivateValue};
+use js::rust::wrappers::{
+ JS_DefineProperty, JS_DefineProperty3, JS_DefineProperty4, JS_DefineProperty5,
+ JS_DefinePropertyById5, JS_FireOnNewGlobalObject, JS_LinkConstructorAndPrototype,
+ JS_NewObjectWithGivenProto, RUST_SYMBOL_TO_JSID,
+};
+use js::rust::{
+ define_methods, define_properties, get_object_class, is_dom_class, maybe_wrap_object,
+ HandleObject, HandleValue, MutableHandleObject, RealmOptions,
+};
+use servo_url::MutableOrigin;
+
use crate::dom::bindings::codegen::InterfaceObjectMap::Globals;
use crate::dom::bindings::codegen::PrototypeList;
use crate::dom::bindings::constant::{define_constants, ConstantSpec};
@@ -15,43 +43,6 @@ use crate::dom::bindings::utils::{
DOM_PROTOTYPE_SLOT, JSCLASS_DOM_GLOBAL,
};
use crate::script_runtime::JSContext as SafeJSContext;
-use js::error::throw_type_error;
-use js::glue::UncheckedUnwrapObject;
-use js::jsapi::CheckedUnwrapStatic;
-use js::jsapi::CurrentGlobalOrNull;
-use js::jsapi::GetFunctionRealm;
-use js::jsapi::GetNonCCWObjectGlobal;
-use js::jsapi::GetRealmGlobalOrNull;
-use js::jsapi::GetWellKnownSymbol;
-use js::jsapi::HandleObject as RawHandleObject;
-use js::jsapi::JS_GetProperty;
-use js::jsapi::JS_WrapObject;
-use js::jsapi::{jsid, JSClass, JSClassOps};
-use js::jsapi::{
- CallArgs, Compartment, CompartmentSpecifier, IsSharableCompartment, IsSystemCompartment,
- JS_IterateCompartments, JS::CompartmentIterResult,
-};
-use js::jsapi::{JSAutoRealm, 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::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING};
-use js::jsval::NullValue;
-use js::jsval::{JSVal, PrivateValue};
-use js::rust::is_dom_class;
-use js::rust::wrappers::JS_FireOnNewGlobalObject;
-use js::rust::wrappers::RUST_SYMBOL_TO_JSID;
-use js::rust::wrappers::{JS_DefineProperty, JS_DefineProperty5};
-use js::rust::wrappers::{JS_DefineProperty3, JS_DefineProperty4, JS_DefinePropertyById5};
-use js::rust::wrappers::{JS_LinkConstructorAndPrototype, JS_NewObjectWithGivenProto};
-use js::rust::{define_methods, define_properties, get_object_class, maybe_wrap_object};
-use js::rust::{HandleObject, HandleValue, MutableHandleObject, RealmOptions};
-use servo_url::MutableOrigin;
-use std::convert::TryFrom;
-use std::ptr;
/// The class of a non-callback interface object.
#[derive(Clone, Copy)]
diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs
index 566d53c584a..0a1bfa4f359 100644
--- a/components/script/dom/bindings/iterable.rs
+++ b/components/script/dom/bindings/iterable.rs
@@ -6,8 +6,19 @@
//! Implementation of `iterable<...>` and `iterable<..., ...>` WebIDL declarations.
-use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndValueResult;
-use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult;
+use std::cell::Cell;
+use std::ptr;
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::{Heap, JSObject};
+use js::jsval::UndefinedValue;
+use js::rust::{HandleObject, HandleValue, MutableHandleObject};
+
+use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::{
+ IterableKeyAndValueResult, IterableKeyOrValueResult,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{
reflect_dom_object, DomObjectIteratorWrap, DomObjectWrap, Reflector,
@@ -16,14 +27,6 @@ use crate::dom::bindings::root::{Dom, DomRoot, Root};
use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox};
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::{Heap, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::{HandleObject, HandleValue, MutableHandleObject};
-use std::cell::Cell;
-use std::ptr;
-use std::ptr::NonNull;
/// The values that an iterator will iterate over.
#[derive(JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/bindings/like.rs b/components/script/dom/bindings/like.rs
index ad14e453655..9aaefd48a53 100644
--- a/components/script/dom/bindings/like.rs
+++ b/components/script/dom/bindings/like.rs
@@ -6,13 +6,14 @@
//! Implementation of `setlike<...>` and `maplike<..., ...>` WebIDL declarations.
-use crate::dom::bindings::cell::DomRefCell;
-use indexmap::{IndexMap, IndexSet};
-use js::conversions::ToJSValConvertible;
use std::cmp::Eq;
use std::hash::Hash;
+use indexmap::{IndexMap, IndexSet};
+use js::conversions::ToJSValConvertible;
+
use super::iterable::Iterable;
+use crate::dom::bindings::cell::DomRefCell;
/// Every Setlike dom_struct must implement this to provide access to underlying storage
/// so codegen can automatically generate all setlike methods
diff --git a/components/script/dom/bindings/namespace.rs b/components/script/dom/bindings/namespace.rs
index 64b7b0b2626..e6c730907a5 100644
--- a/components/script/dom/bindings/namespace.rs
+++ b/components/script/dom/bindings/namespace.rs
@@ -4,12 +4,14 @@
//! Machinery to initialise namespace objects.
+use std::ptr;
+
+use js::jsapi::{JSClass, JSFunctionSpec};
+use js::rust::{HandleObject, MutableHandleObject};
+
use crate::dom::bindings::guard::Guard;
use crate::dom::bindings::interface::{create_object, define_on_global_object};
use crate::script_runtime::JSContext;
-use js::jsapi::{JSClass, JSFunctionSpec};
-use js::rust::{HandleObject, MutableHandleObject};
-use std::ptr;
/// The class of a namespace object.
#[derive(Clone, Copy)]
diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs
index c7f987e98ef..ba2162e96fc 100644
--- a/components/script/dom/bindings/num.rs
+++ b/components/script/dom/bindings/num.rs
@@ -4,11 +4,12 @@
//! The `Finite<T>` struct.
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use num_traits::Float;
use std::default::Default;
use std::ops::Deref;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+use num_traits::Float;
+
/// Encapsulates the IDL restricted float type.
#[derive(Clone, Copy, Eq, JSTraceable, PartialEq)]
pub struct Finite<T: Float>(T);
diff --git a/components/script/dom/bindings/principals.rs b/components/script/dom/bindings/principals.rs
index 079aff4892c..f408f92cbc7 100644
--- a/components/script/dom/bindings/principals.rs
+++ b/components/script/dom/bindings/principals.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 https://mozilla.org/MPL/2.0/. */
-use js::{
- glue::{
- CreateRustJSPrincipals, DestroyRustJSPrincipals, GetRustJSPrincipalsPrivate,
- JSPrincipalsCallbacks,
- },
- jsapi::{JSPrincipals, JS_DropPrincipals, JS_HoldPrincipals},
- rust::Runtime,
+use std::marker::PhantomData;
+use std::mem::ManuallyDrop;
+use std::ops::Deref;
+use std::ptr::NonNull;
+
+use js::glue::{
+ CreateRustJSPrincipals, DestroyRustJSPrincipals, GetRustJSPrincipalsPrivate,
+ JSPrincipalsCallbacks,
};
+use js::jsapi::{JSPrincipals, JS_DropPrincipals, JS_HoldPrincipals};
+use js::rust::Runtime;
use servo_url::MutableOrigin;
-use std::{marker::PhantomData, mem::ManuallyDrop, ops::Deref, ptr::NonNull};
/// An owned reference to Servo's `JSPrincipals` instance.
#[repr(transparent)]
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index 07e215b72c5..715896fe70d 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -6,6 +6,36 @@
#![deny(missing_docs)]
+use std::ffi::CStr;
+use std::os::raw::c_char;
+use std::ptr;
+
+use js::conversions::ToJSValConvertible;
+use js::glue::{
+ GetProxyHandler, GetProxyHandlerFamily, GetProxyPrivate, InvokeGetOwnPropertyDescriptor,
+ SetProxyPrivate,
+};
+use js::jsapi;
+use js::jsapi::{
+ jsid, DOMProxyShadowsResult, GetObjectRealmOrNull, GetRealmPrincipals, GetStaticPrototype,
+ GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId,
+ HandleObject as RawHandleObject, HandleValue as RawHandleValue, JSAutoRealm, JSContext,
+ JSErrNum, JSFunctionSpec, JSObject, JSPropertySpec, JS_AtomizeAndPinString,
+ JS_DefinePropertyById, JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending,
+ MutableHandle as RawMutableHandle, MutableHandleIdVector as RawMutableHandleIdVector,
+ MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
+ ObjectOpResult, PropertyDescriptor, SetDOMProxyInformation, SymbolCode,
+};
+use js::jsid::SymbolId;
+use js::jsval::{ObjectValue, UndefinedValue};
+use js::rust::wrappers::{
+ AppendToIdVector, JS_AlreadyHasOwnPropertyById, JS_NewObjectWithGivenProto,
+ SetDataPropertyDescriptor, RUST_INTERNED_STRING_TO_JSID,
+};
+use js::rust::{
+ get_context_realm, Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject,
+};
+
use crate::dom::bindings::conversions::{is_dom_proxy, jsid_to_string, jsstring_to_str};
use crate::dom::bindings::error::{throw_dom_exception, Error};
use crate::dom::bindings::principals::ServoJSPrincipalsRef;
@@ -15,41 +45,6 @@ use crate::dom::bindings::utils::delete_property_by_id;
use crate::dom::globalscope::GlobalScope;
use crate::realms::{AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
-use js::conversions::ToJSValConvertible;
-use js::glue::{GetProxyHandler, GetProxyHandlerFamily, InvokeGetOwnPropertyDescriptor};
-use js::glue::{GetProxyPrivate, SetProxyPrivate};
-use js::jsapi;
-use js::jsapi::GetStaticPrototype;
-use js::jsapi::Handle as RawHandle;
-use js::jsapi::HandleId as RawHandleId;
-use js::jsapi::HandleObject as RawHandleObject;
-use js::jsapi::HandleValue as RawHandleValue;
-use js::jsapi::JSAutoRealm;
-use js::jsapi::JS_AtomizeAndPinString;
-use js::jsapi::JS_DefinePropertyById;
-use js::jsapi::JS_GetOwnPropertyDescriptorById;
-use js::jsapi::JS_IsExceptionPending;
-use js::jsapi::MutableHandle as RawMutableHandle;
-use js::jsapi::MutableHandleIdVector as RawMutableHandleIdVector;
-use js::jsapi::MutableHandleObject as RawMutableHandleObject;
-use js::jsapi::MutableHandleValue as RawMutableHandleValue;
-use js::jsapi::ObjectOpResult;
-use js::jsapi::{jsid, GetObjectRealmOrNull, GetRealmPrincipals, JSFunctionSpec, JSPropertySpec};
-use js::jsapi::{DOMProxyShadowsResult, JSContext, JSObject, PropertyDescriptor};
-use js::jsapi::{GetWellKnownSymbol, SymbolCode};
-use js::jsapi::{JSErrNum, SetDOMProxyInformation};
-use js::jsid::SymbolId;
-use js::jsval::ObjectValue;
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::JS_AlreadyHasOwnPropertyById;
-use js::rust::wrappers::JS_NewObjectWithGivenProto;
-use js::rust::wrappers::{
- AppendToIdVector, SetDataPropertyDescriptor, RUST_INTERNED_STRING_TO_JSID,
-};
-use js::rust::{
- get_context_realm, Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject,
-};
-use std::{ffi::CStr, os::raw::c_char, ptr};
/// Determine if this id shadows any existing properties for this proxy.
pub unsafe extern "C" fn shadow_check_callback(
diff --git a/components/script/dom/bindings/record.rs b/components/script/dom/bindings/record.rs
index e5a796f5478..54c8dc96630 100644
--- a/components/script/dom/bindings/record.rs
+++ b/components/script/dom/bindings/record.rs
@@ -4,34 +4,25 @@
//! The `Record` (open-ended dictionary) type.
-use crate::dom::bindings::conversions::jsid_to_string;
-use crate::dom::bindings::str::{ByteString, DOMString, USVString};
-use indexmap::IndexMap;
-use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
-use js::jsapi::glue::JS_GetOwnPropertyDescriptorById;
-use js::jsapi::HandleId as RawHandleId;
-use js::jsapi::JSContext;
-use js::jsapi::JS_NewPlainObject;
-use js::jsapi::PropertyDescriptor;
-use js::jsapi::JSITER_HIDDEN;
-use js::jsapi::JSITER_OWNONLY;
-use js::jsapi::JSITER_SYMBOLS;
-use js::jsapi::JSPROP_ENUMERATE;
-use js::jsval::ObjectValue;
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::GetPropertyKeys;
-use js::rust::wrappers::JS_DefineUCProperty2;
-use js::rust::wrappers::JS_GetPropertyById;
-use js::rust::wrappers::JS_IdToValue;
-use js::rust::HandleId;
-use js::rust::HandleValue;
-use js::rust::IdVector;
-use js::rust::MutableHandleValue;
use std::cmp::Eq;
use std::hash::Hash;
use std::marker::Sized;
use std::ops::Deref;
+use indexmap::IndexMap;
+use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
+use js::jsapi::glue::JS_GetOwnPropertyDescriptorById;
+use js::jsapi::{
+ HandleId as RawHandleId, JSContext, JS_NewPlainObject, PropertyDescriptor, JSITER_HIDDEN,
+ JSITER_OWNONLY, JSITER_SYMBOLS, JSPROP_ENUMERATE,
+};
+use js::jsval::{ObjectValue, UndefinedValue};
+use js::rust::wrappers::{GetPropertyKeys, JS_DefineUCProperty2, JS_GetPropertyById, JS_IdToValue};
+use js::rust::{HandleId, HandleValue, IdVector, MutableHandleValue};
+
+use crate::dom::bindings::conversions::jsid_to_string;
+use crate::dom::bindings::str::{ByteString, DOMString, USVString};
+
pub trait RecordKey: Eq + Hash + Sized {
fn to_utf16_vec(&self) -> Vec<u16>;
unsafe fn from_id(cx: *mut JSContext, id: HandleId) -> Result<ConversionResult<Self>, ()>;
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs
index ab7aea3e922..0279e98b6ba 100644
--- a/components/script/dom/bindings/refcounted.rs
+++ b/components/script/dom/bindings/refcounted.rs
@@ -22,14 +22,6 @@
//! its hash table during the next GC. During GC, the entries of the hash table are counted
//! as JS roots.
-use crate::dom::bindings::conversions::ToJSValConvertible;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::reflector::{DomObject, Reflector};
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::bindings::trace::trace_reflector;
-use crate::dom::promise::Promise;
-use crate::task::TaskOnce;
-use js::jsapi::JSTracer;
use std::cell::RefCell;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::HashMap;
@@ -38,12 +30,23 @@ use std::marker::PhantomData;
use std::rc::Rc;
use std::sync::{Arc, Weak};
+use js::jsapi::JSTracer;
+
+use crate::dom::bindings::conversions::ToJSValConvertible;
+use crate::dom::bindings::error::Error;
+use crate::dom::bindings::reflector::{DomObject, Reflector};
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::trace::trace_reflector;
+use crate::dom::promise::Promise;
+use crate::task::TaskOnce;
+
#[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<RefCell<Option<LiveDOMReferences>>> =
Rc::new(RefCell::new(None)));
}
diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs
index c0f1305bf6c..4b1ba97c525 100644
--- a/components/script/dom/bindings/reflector.rs
+++ b/components/script/dom/bindings/reflector.rs
@@ -4,6 +4,11 @@
//! The `Reflector` struct.
+use std::default::Default;
+
+use js::jsapi::{Heap, JSObject};
+use js::rust::HandleObject;
+
use crate::dom::bindings::conversions::DerivedFrom;
use crate::dom::bindings::iterable::{Iterable, IterableIterator};
use crate::dom::bindings::root::{Dom, DomRoot, Root};
@@ -11,9 +16,6 @@ use crate::dom::bindings::trace::JSTraceable;
use crate::dom::globalscope::GlobalScope;
use crate::realms::AlreadyInRealm;
use crate::script_runtime::JSContext;
-use js::jsapi::{Heap, JSObject};
-use js::rust::HandleObject;
-use std::default::Default;
/// Create the reflector for a new DOM object and yield ownership to the
/// reflector.
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index b51730848b6..1e67474ea99 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -24,25 +24,25 @@
//! originating `DomRoot<T>`.
//!
-use crate::dom::bindings::conversions::DerivedFrom;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
-use crate::dom::bindings::trace::trace_reflector;
-use crate::dom::bindings::trace::JSTraceable;
-use crate::dom::node::Node;
-use js::jsapi::{Heap, JSObject, JSTracer};
-use js::rust::GCMethods;
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use script_layout_interface::TrustedNodeAddress;
use std::cell::{Cell, OnceCell, UnsafeCell};
use std::default::Default;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
-use std::mem;
use std::ops::Deref;
-use std::ptr;
+use std::{mem, ptr};
+
+use js::jsapi::{Heap, JSObject, JSTracer};
+use js::rust::GCMethods;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+use script_layout_interface::TrustedNodeAddress;
use style::thread_state;
+use crate::dom::bindings::conversions::DerivedFrom;
+use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
+use crate::dom::bindings::trace::{trace_reflector, JSTraceable};
+use crate::dom::node::Node;
+
/// A rooted value.
#[allow(unrooted_must_root)]
#[unrooted_must_root_lint::allow_unrooted_interior]
diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs
index 24b6175f159..6461a790025 100644
--- a/components/script/dom/bindings/settings_stack.rs
+++ b/components/script/dom/bindings/settings_stack.rs
@@ -2,16 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::RefCell;
+use std::thread;
+
+use js::jsapi::{GetScriptedCallerGlobal, HideScriptedCaller, JSTracer, UnhideScriptedCaller};
+use js::rust::Runtime;
+
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::globalscope::GlobalScope;
-use js::jsapi::GetScriptedCallerGlobal;
-use js::jsapi::HideScriptedCaller;
-use js::jsapi::JSTracer;
-use js::jsapi::UnhideScriptedCaller;
-use js::rust::Runtime;
-use std::cell::RefCell;
-use std::thread;
thread_local!(static STACK: RefCell<Vec<StackEntry>> = RefCell::new(Vec::new()));
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index ef772ce355c..6db9d0773ad 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -3,6 +3,14 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The `ByteString` struct.
+use std::borrow::{Borrow, Cow, ToOwned};
+use std::default::Default;
+use std::hash::{Hash, Hasher};
+use std::marker::PhantomData;
+use std::ops::{Deref, DerefMut};
+use std::str::FromStr;
+use std::{fmt, ops, str};
+
use chrono::prelude::{Utc, Weekday};
use chrono::{Datelike, TimeZone};
use cssparser::CowRcStr;
@@ -10,15 +18,6 @@ use html5ever::{LocalName, Namespace};
use lazy_static::lazy_static;
use regex::Regex;
use servo_atoms::Atom;
-use std::borrow::{Borrow, Cow, ToOwned};
-use std::default::Default;
-use std::fmt;
-use std::hash::{Hash, Hasher};
-use std::marker::PhantomData;
-use std::ops;
-use std::ops::{Deref, DerefMut};
-use std::str;
-use std::str::FromStr;
/// Encapsulates the IDL `ByteString` type.
#[derive(Clone, Debug, Default, Eq, JSTraceable, MallocSizeOf, PartialEq)]
diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs
index 85cb758e600..5de0569bcf7 100644
--- a/components/script/dom/bindings/structuredclone.rs
+++ b/components/script/dom/bindings/structuredclone.rs
@@ -5,6 +5,29 @@
//! This module implements structured cloning, as defined by [HTML]
//! (https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data).
+use std::collections::HashMap;
+use std::os::raw;
+use std::ptr;
+
+use js::glue::{
+ CopyJSStructuredCloneData, DeleteJSAutoStructuredCloneBuffer, GetLengthOfJSStructuredCloneData,
+ NewJSAutoStructuredCloneBuffer, WriteBytesToJSStructuredCloneData,
+};
+use js::jsapi::{
+ CloneDataPolicy, HandleObject as RawHandleObject, JSContext, JSObject,
+ JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter,
+ JS_ClearPendingException, JS_ReadUint32Pair, JS_WriteUint32Pair,
+ MutableHandleObject as RawMutableHandleObject, StructuredCloneScope, TransferableOwnership,
+ JS_STRUCTURED_CLONE_VERSION,
+};
+use js::jsval::UndefinedValue;
+use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone};
+use js::rust::{CustomAutoRooterGuard, HandleValue, MutableHandleValue};
+use msg::constellation_msg::{BlobId, MessagePortId};
+use script_traits::serializable::BlobImpl;
+use script_traits::transferable::MessagePortImpl;
+use script_traits::StructuredSerializedData;
+
use crate::dom::bindings::conversions::{root_from_object, ToJSValConvertible};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::DomObject;
@@ -16,31 +39,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::messageport::MessagePort;
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
-use js::glue::CopyJSStructuredCloneData;
-use js::glue::DeleteJSAutoStructuredCloneBuffer;
-use js::glue::GetLengthOfJSStructuredCloneData;
-use js::glue::NewJSAutoStructuredCloneBuffer;
-use js::glue::WriteBytesToJSStructuredCloneData;
-use js::jsapi::CloneDataPolicy;
-use js::jsapi::HandleObject as RawHandleObject;
-use js::jsapi::JSContext;
-use js::jsapi::MutableHandleObject as RawMutableHandleObject;
-use js::jsapi::StructuredCloneScope;
-use js::jsapi::TransferableOwnership;
-use js::jsapi::JS_STRUCTURED_CLONE_VERSION;
-use js::jsapi::{JSObject, JS_ClearPendingException};
-use js::jsapi::{JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter};
-use js::jsapi::{JS_ReadUint32Pair, JS_WriteUint32Pair};
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone};
-use js::rust::{CustomAutoRooterGuard, HandleValue, MutableHandleValue};
-use msg::constellation_msg::{BlobId, MessagePortId};
-use script_traits::serializable::BlobImpl;
-use script_traits::transferable::MessagePortImpl;
-use script_traits::StructuredSerializedData;
-use std::collections::HashMap;
-use std::os::raw;
-use std::ptr;
// TODO: Should we add Min and Max const to https://github.com/servo/rust-mozjs/blob/master/src/consts.rs?
// TODO: Determine for sure which value Min and Max should have.
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index e3c30c943ab..8d5f0db0c0e 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -29,40 +29,24 @@
//! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of
//! `JSTraceable` to a datatype.
-use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
-use crate::dom::bindings::reflector::{DomObject, Reflector};
-use crate::dom::bindings::root::{Dom, DomRoot};
-use crate::dom::bindings::str::{DOMString, USVString};
-use crate::dom::bindings::utils::WindowProxyHandler;
-use crate::dom::gpubuffer::GPUBufferState;
-use crate::dom::gpucanvascontext::WebGPUContextId;
-use crate::dom::gpucommandencoder::GPUCommandEncoderState;
-use crate::dom::htmlimageelement::SourceSet;
-use crate::dom::htmlmediaelement::HTMLMediaElementFetchContext;
-use crate::script_runtime::{ContextForRequestInterrupt, StreamConsumer};
-use crate::script_thread::IncompleteParserContexts;
-use crate::task::TaskBox;
+use std::collections::hash_map::RandomState;
+use std::collections::HashMap;
+use std::fmt::Display;
+use std::hash::{BuildHasher, Hash};
+use std::mem;
+use std::ops::{Deref, DerefMut};
+
use indexmap::IndexMap;
+/// A trait to allow tracing (only) DOM objects.
+pub use js::gc::Traceable as JSTraceable;
use js::glue::{CallObjectTracer, CallScriptTracer, CallStringTracer, CallValueTracer};
use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSScript, JSString, JSTracer, TraceKind};
use js::jsval::JSVal;
use js::rust::{GCMethods, Handle};
-
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use parking_lot::RwLock;
use servo_arc::Arc as ServoArc;
use smallvec::SmallVec;
-
-use std::collections::hash_map::RandomState;
-use std::collections::HashMap;
-use std::fmt::Display;
-use std::hash::{BuildHasher, Hash};
-use std::mem;
-
-use std::ops::{Deref, DerefMut};
-
use style::author_styles::AuthorStyles;
use style::stylesheet_set::{AuthorStylesheetSet, DocumentStylesheetSet};
use tendril::fmt::UTF8;
@@ -70,8 +54,21 @@ use tendril::stream::LossyDecoder;
use tendril::TendrilSink;
use webxr_api::{Finger, Hand};
-/// A trait to allow tracing (only) DOM objects.
-pub use js::gc::Traceable as JSTraceable;
+use crate::dom::bindings::cell::DomRefCell;
+use crate::dom::bindings::error::Error;
+use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
+use crate::dom::bindings::reflector::{DomObject, Reflector};
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::bindings::str::{DOMString, USVString};
+use crate::dom::bindings::utils::WindowProxyHandler;
+use crate::dom::gpubuffer::GPUBufferState;
+use crate::dom::gpucanvascontext::WebGPUContextId;
+use crate::dom::gpucommandencoder::GPUCommandEncoderState;
+use crate::dom::htmlimageelement::SourceSet;
+use crate::dom::htmlmediaelement::HTMLMediaElementFetchContext;
+use crate::script_runtime::{ContextForRequestInterrupt, StreamConsumer};
+use crate::script_thread::IncompleteParserContexts;
+use crate::task::TaskBox;
/// A trait to allow tracing only DOM sub-objects.
pub unsafe trait CustomTraceable {
diff --git a/components/script/dom/bindings/transferable.rs b/components/script/dom/bindings/transferable.rs
index 608988db35d..5e15ec785fa 100644
--- a/components/script/dom/bindings/transferable.rs
+++ b/components/script/dom/bindings/transferable.rs
@@ -5,10 +5,11 @@
//! Trait representing the concept of [transferable objects]
//! (https://html.spec.whatwg.org/multipage/#transferable-objects).
+use js::jsapi::MutableHandleObject;
+
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::structuredclone::StructuredDataHolder;
use crate::dom::globalscope::GlobalScope;
-use js::jsapi::MutableHandleObject;
pub trait Transferable: DomObject {
fn transfer(&self, sc_holder: &mut StructuredDataHolder) -> Result<u64, ()>;
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index d7d274dc701..af54544d3c5 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -4,9 +4,38 @@
//! Various utilities to glue JavaScript and the DOM implementation together.
-use crate::dom::bindings::codegen::InterfaceObjectMap;
-use crate::dom::bindings::codegen::PrototypeList;
+use std::ffi::CString;
+use std::os::raw::{c_char, c_void};
+use std::{ptr, slice, str};
+
+use js::conversions::ToJSValConvertible;
+use js::glue::{
+ CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper, JS_GetReservedSlot,
+ UnwrapObjectDynamic, UnwrapObjectStatic, RUST_FUNCTION_VALUE_TO_JITINFO,
+};
+use js::jsapi::{
+ AtomToLinearString, CallArgs, DOMCallbacks, GetLinearStringCharAt, GetLinearStringLength,
+ GetNonCCWObjectGlobal, HandleId as RawHandleId, HandleObject as RawHandleObject, Heap, JSAtom,
+ JSContext, JSJitInfo, JSObject, JSTracer, JS_DeprecatedStringHasLatin1Chars,
+ JS_EnumerateStandardClasses, JS_FreezeObject, JS_GetLatin1StringCharsAndLength,
+ JS_IsExceptionPending, JS_IsGlobalObject, JS_ResolveStandardClass,
+ MutableHandleIdVector as RawMutableHandleIdVector, ObjectOpResult, StringIsArrayIndex,
+};
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::wrappers::{
+ JS_DeletePropertyById, JS_ForwardGetPropertyTo, JS_GetProperty, JS_GetPrototype,
+ JS_HasProperty, JS_HasPropertyById, JS_SetProperty,
+};
+use js::rust::{
+ get_object_class, is_dom_class, GCMethods, Handle, HandleId, HandleObject, HandleValue,
+ MutableHandleValue, ToString,
+};
+use js::typedarray::{CreateWith, Float32Array};
+use js::JS_CALLEE;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+
use crate::dom::bindings::codegen::PrototypeList::{MAX_PROTO_CHAIN_LENGTH, PROTO_OR_IFACE_LENGTH};
+use crate::dom::bindings::codegen::{InterfaceObjectMap, PrototypeList};
use crate::dom::bindings::conversions::{
jsstring_to_str, private_from_proto_check, PrototypeCheck,
};
@@ -16,41 +45,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::bindings::trace::trace_object;
use crate::dom::windowproxy;
use crate::script_runtime::JSContext as SafeJSContext;
-use js::conversions::ToJSValConvertible;
-use js::glue::JS_GetReservedSlot;
-use js::glue::RUST_FUNCTION_VALUE_TO_JITINFO;
-use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
-use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
-use js::jsapi::HandleId as RawHandleId;
-use js::jsapi::HandleObject as RawHandleObject;
-use js::jsapi::MutableHandleIdVector as RawMutableHandleIdVector;
-use js::jsapi::{AtomToLinearString, GetLinearStringCharAt, GetLinearStringLength};
-use js::jsapi::{CallArgs, DOMCallbacks, GetNonCCWObjectGlobal};
-use js::jsapi::{Heap, JSContext, JS_FreezeObject};
-use js::jsapi::{JSAtom, JS_IsExceptionPending, JS_IsGlobalObject};
-use js::jsapi::{JSJitInfo, JSObject, JSTracer};
-use js::jsapi::{
- JS_DeprecatedStringHasLatin1Chars, JS_ResolveStandardClass, ObjectOpResult, StringIsArrayIndex,
-};
-use js::jsapi::{JS_EnumerateStandardClasses, JS_GetLatin1StringCharsAndLength};
-use js::jsval::{JSVal, UndefinedValue};
-use js::rust::wrappers::JS_DeletePropertyById;
-use js::rust::wrappers::JS_ForwardGetPropertyTo;
-use js::rust::wrappers::JS_GetProperty;
-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};
-use js::rust::{Handle, HandleId, HandleObject, HandleValue, MutableHandleValue};
-use js::typedarray::{CreateWith, Float32Array};
-use js::JS_CALLEE;
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use std::ffi::CString;
-use std::os::raw::{c_char, c_void};
-use std::ptr;
-use std::slice;
-use std::str;
/// Proxy handler for a WindowProxy.
pub struct WindowProxyHandler(pub *const libc::c_void);
diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs
index 5c74e111816..a0bd0ea362d 100644
--- a/components/script/dom/bindings/weakref.rs
+++ b/components/script/dom/bindings/weakref.rs
@@ -11,20 +11,20 @@
//! slot. When all associated `WeakRef` values are dropped, the
//! `WeakBox` itself is dropped too.
-use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::bindings::trace::JSTraceable;
+use std::cell::{Cell, UnsafeCell};
+use std::ops::{Deref, DerefMut, Drop};
+use std::{mem, ptr};
+
use js::glue::JS_GetReservedSlot;
use js::jsapi::{JSTracer, JS_SetReservedSlot};
-use js::jsval::PrivateValue;
-use js::jsval::UndefinedValue;
+use js::jsval::{PrivateValue, UndefinedValue};
use libc::c_void;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use std::cell::{Cell, UnsafeCell};
-use std::mem;
-use std::ops::{Deref, DerefMut, Drop};
-use std::ptr;
+
+use crate::dom::bindings::cell::DomRefCell;
+use crate::dom::bindings::reflector::DomObject;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::trace::JSTraceable;
/// The index of the slot wherein a pointer to the weak holder cell is
/// stored for weak-referenceable bindings. We use slot 1 for holding it,
diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs
index 672f8c522b3..30082c2d6e8 100644
--- a/components/script/dom/bindings/xmlname.rs
+++ b/components/script/dom/bindings/xmlname.rs
@@ -4,9 +4,10 @@
//! Functions for validating and extracting qualified XML names.
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
+
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::str::DOMString;
-use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
/// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details.
pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
diff --git a/components/script/dom/biquadfilternode.rs b/components/script/dom/biquadfilternode.rs
index 197afaef36b..f730da15651 100644
--- a/components/script/dom/biquadfilternode.rs
+++ b/components/script/dom/biquadfilternode.rs
@@ -2,6 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::biquad_filter_node::{
+ BiquadFilterNodeMessage, BiquadFilterNodeOptions, FilterType,
+};
+use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
+use servo_media::audio::param::ParamType;
+
use crate::dom::audionode::AudioNode;
use crate::dom::audioparam::AudioParam;
use crate::dom::baseaudiocontext::BaseAudioContext;
@@ -9,21 +20,13 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
-use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterNodeMethods;
-use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterOptions;
-use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterType;
+use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::{
+ BiquadFilterNodeMethods, BiquadFilterOptions, BiquadFilterType,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-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;
-use std::f32;
#[dom_struct]
pub struct BiquadFilterNode {
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index a6599d3ac99..1b710124368 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -2,6 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashMap;
+use std::num::NonZeroU32;
+use std::ptr::NonNull;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use encoding_rs::UTF_8;
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use msg::constellation_msg::{BlobId, BlobIndex, PipelineNamespaceId};
+use net_traits::filemanager_thread::RelativePos;
+use script_traits::serializable::BlobImpl;
+use uuid::Uuid;
+
use crate::body::{run_array_buffer_data_algorithm, FetchedData};
use crate::dom::bindings::codegen::Bindings::BlobBinding;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
@@ -17,18 +31,6 @@ use crate::dom::promise::Promise;
use crate::dom::readablestream::ReadableStream;
use crate::realms::{AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use encoding_rs::UTF_8;
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use msg::constellation_msg::{BlobId, BlobIndex, PipelineNamespaceId};
-use net_traits::filemanager_thread::RelativePos;
-use script_traits::serializable::BlobImpl;
-use std::collections::HashMap;
-use std::num::NonZeroU32;
-use std::ptr::NonNull;
-use std::rc::Rc;
-use uuid::Uuid;
// https://w3c.github.io/FileAPI/#blob
#[dom_struct]
diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs
index cc667e75a4b..09a9ff07d4f 100644
--- a/components/script/dom/bluetoothadvertisingevent.rs
+++ b/components/script/dom/bluetoothadvertisingevent.rs
@@ -2,8 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::BluetoothAdvertisingEventInit;
-use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::BluetoothAdvertisingEventMethods;
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
+use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::{
+ BluetoothAdvertisingEventInit, BluetoothAdvertisingEventMethods,
+};
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
@@ -14,9 +19,6 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingevent
#[dom_struct]
diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs
index f48eb52772c..3f1a765d234 100644
--- a/components/script/dom/bluetoothcharacteristicproperties.rs
+++ b/components/script/dom/bluetoothcharacteristicproperties.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties
#[dom_struct]
diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs
index 2d96efb3e05..a2b9ecc330e 100644
--- a/components/script/dom/bluetoothdevice.rs
+++ b/components/script/dom/bluetoothdevice.rs
@@ -2,11 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::HashMap;
+use std::rc::Rc;
+
+use bluetooth_traits::{
+ BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothRequest, BluetoothResponse,
+ BluetoothServiceMsg,
+};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use profile_traits::ipc;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::ErrorResult;
+use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
@@ -21,14 +32,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use profile_traits::ipc;
-use std::cell::Cell;
-use std::collections::HashMap;
-use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
#[dom_struct]
diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs
index 0f7266e0443..fb228033e0b 100644
--- a/components/script/dom/bluetoothpermissionresult.rs
+++ b/components/script/dom/bluetoothpermissionresult.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::BluetoothPermissionResultMethods;
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods;
@@ -19,10 +25,6 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::globalscope::GlobalScope;
use crate::dom::permissionstatus::PermissionStatus;
use crate::dom::promise::Promise;
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothpermissionresult
#[dom_struct]
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs
index a3c4b826bd7..71c54461b8a 100644
--- a/components/script/dom/bluetoothremotegattcharacteristic.rs
+++ b/components/script/dom/bluetoothremotegattcharacteristic.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
@@ -23,11 +30,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use std::rc::Rc;
// Maximum length of an attribute value.
// https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 2169)
diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs
index 0e60170857e..6134e42b6a0 100644
--- a/components/script/dom/bluetoothremotegattdescriptor.rs
+++ b/components/script/dom/bluetoothremotegattdescriptor.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::BluetoothRemoteGATTDescriptorMethods;
@@ -19,11 +26,6 @@ use crate::dom::bluetoothremotegattcharacteristic::{
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use std::rc::Rc;
// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattdescriptor
#[dom_struct]
diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs
index c5ffecb100b..79fa65bd35d 100644
--- a/components/script/dom/bluetoothremotegattserver.rs
+++ b/components/script/dom/bluetoothremotegattserver.rs
@@ -2,10 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::ErrorResult;
+use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bluetooth::{get_gatt_children, response_async, AsyncBluetoothListener};
@@ -14,11 +20,6 @@ use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use std::cell::Cell;
-use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattserver
#[dom_struct]
diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs
index 62b46a8b9bd..650ba5151d1 100644
--- a/components/script/dom/bluetoothremotegattservice.rs
+++ b/components/script/dom/bluetoothremotegattservice.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use bluetooth_traits::{BluetoothResponse, GATTType};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use crate::dom::bindings::error::Error;
@@ -14,9 +19,6 @@ use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUI
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
-use bluetooth_traits::{BluetoothResponse, GATTType};
-use dom_struct::dom_struct;
-use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattservice
#[dom_struct]
diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs
index 70c0c28550a..f37fa166032 100644
--- a/components/script/dom/bluetoothuuid.rs
+++ b/components/script/dom/bluetoothuuid.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use regex::Regex;
+
use crate::dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
use crate::dom::bindings::error::Error::Type;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::str::DOMString;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use regex::Regex;
pub type UUID = DOMString;
pub type BluetoothServiceUUID = StringOrUnsignedLong;
diff --git a/components/script/dom/broadcastchannel.rs b/components/script/dom/broadcastchannel.rs
index dd5149c1203..0140836fade 100644
--- a/components/script/dom/broadcastchannel.rs
+++ b/components/script/dom/broadcastchannel.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::{HandleObject, HandleValue};
+use script_traits::BroadcastMsg;
+use uuid::Uuid;
+
use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
@@ -11,11 +18,6 @@ use crate::dom::bindings::structuredclone;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext as SafeJSContext;
-use dom_struct::dom_struct;
-use js::rust::{HandleObject, HandleValue};
-use script_traits::BroadcastMsg;
-use std::cell::Cell;
-use uuid::Uuid;
#[dom_struct]
pub struct BroadcastChannel {
diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs
index e404998b004..f6a4a1a7bfd 100644
--- a/components/script/dom/canvasgradient.rs
+++ b/components/script/dom/canvasgradient.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::canvas::{
+ CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
+};
+use cssparser::{Color as CSSColor, Parser, ParserInput, RGBA};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
@@ -10,12 +16,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use canvas_traits::canvas::{
- CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
-};
-use cssparser::Color as CSSColor;
-use cssparser::{Parser, ParserInput, RGBA};
-use dom_struct::dom_struct;
// https://html.spec.whatwg.org/multipage/#canvasgradient
#[dom_struct]
diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs
index 5472598ea28..d63bc938d19 100644
--- a/components/script/dom/canvaspattern.rs
+++ b/components/script/dom/canvaspattern.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
+use dom_struct::dom_struct;
+use euclid::default::Size2D;
+
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
use crate::dom::globalscope::GlobalScope;
-use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
-use dom_struct::dom_struct;
-use euclid::default::Size2D;
// https://html.spec.whatwg.org/multipage/#canvaspattern
#[dom_struct]
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 3ebf8f130d9..d531826652d 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -2,15 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::mem;
+
+use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
+use dom_struct::dom_struct;
+use euclid::default::{Point2D, Rect, Size2D};
+use ipc_channel::ipc::IpcSender;
+use servo_url::ServoUrl;
+
use crate::canvas_state::CanvasState;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasDirection;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextAlign;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextBaseline;
+use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
+ CanvasDirection, CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
+ CanvasRenderingContext2DMethods, CanvasTextAlign, CanvasTextBaseline,
+};
use crate::dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
use crate::dom::bindings::error::{ErrorResult, Fallible};
use crate::dom::bindings::num::Finite;
@@ -24,12 +28,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
use crate::dom::imagedata::ImageData;
use crate::dom::textmetrics::TextMetrics;
-use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
-use dom_struct::dom_struct;
-use euclid::default::{Point2D, Rect, Size2D};
-use ipc_channel::ipc::IpcSender;
-use servo_url::ServoUrl;
-use std::mem;
// https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d
#[dom_struct]
diff --git a/components/script/dom/cdatasection.rs b/components/script/dom/cdatasection.rs
index 7e026bb7673..6fbe4d1e4b7 100644
--- a/components/script/dom/cdatasection.rs
+++ b/components/script/dom/cdatasection.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::node::Node;
use crate::dom::text::Text;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct CDATASection {
diff --git a/components/script/dom/channelmergernode.rs b/components/script/dom/channelmergernode.rs
index 7cafb8b44b6..241e711c290 100644
--- a/components/script/dom/channelmergernode.rs
+++ b/components/script/dom/channelmergernode.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::channel_node::ChannelNodeOptions;
+use servo_media::audio::node::AudioNodeInit;
+
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
@@ -12,10 +17,6 @@ use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::channel_node::ChannelNodeOptions;
-use servo_media::audio::node::AudioNodeInit;
#[dom_struct]
pub struct ChannelMergerNode {
diff --git a/components/script/dom/channelsplitternode.rs b/components/script/dom/channelsplitternode.rs
index 077b256ffd8..f6412242215 100644
--- a/components/script/dom/channelsplitternode.rs
+++ b/components/script/dom/channelsplitternode.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::AudioNodeInit;
+
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
@@ -12,9 +16,6 @@ use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::AudioNodeInit;
#[dom_struct]
pub struct ChannelSplitterNode {
diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs
index cbaa847e8ee..3ce66725c7f 100644
--- a/components/script/dom/characterdata.rs
+++ b/components/script/dom/characterdata.rs
@@ -4,6 +4,8 @@
//! DOM bindings for `CharacterData`.
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
@@ -23,7 +25,6 @@ use crate::dom::node::{ChildrenMutation, Node, NodeDamage};
use crate::dom::processinginstruction::ProcessingInstruction;
use crate::dom::text::Text;
use crate::dom::virtualmethods::vtable_for;
-use dom_struct::dom_struct;
// https://dom.spec.whatwg.org/#characterdata
#[dom_struct]
diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs
index 178f6bfba8c..d8e382e750d 100644
--- a/components/script/dom/client.rs
+++ b/components/script/dom/client.rs
@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::ClientBinding::ClientMethods;
-use crate::dom::bindings::codegen::Bindings::ClientBinding::FrameType;
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use servo_url::ServoUrl;
+use uuid::Uuid;
+
+use crate::dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, FrameType};
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::serviceworker::ServiceWorker;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_url::ServoUrl;
-use std::default::Default;
-use uuid::Uuid;
#[dom_struct]
pub struct Client {
diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs
index 62a0a066f61..4f136ebe905 100644
--- a/components/script/dom/closeevent.rs
+++ b/components/script/dom/closeevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::CloseEventBinding;
use crate::dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
@@ -12,9 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct CloseEvent {
diff --git a/components/script/dom/comment.rs b/components/script/dom/comment.rs
index 4c5ca9d488e..955b6bab6f6 100644
--- a/components/script/dom/comment.rs
+++ b/components/script/dom/comment.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::root::DomRoot;
@@ -10,8 +13,6 @@ use crate::dom::characterdata::CharacterData;
use crate::dom::document::Document;
use crate::dom::node::Node;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
/// An HTML comment.
#[dom_struct]
diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs
index 05058a3a0cf..0cf25b22e59 100644
--- a/components/script/dom/compositionevent.rs
+++ b/components/script/dom/compositionevent.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
self, CompositionEventMethods,
};
@@ -12,8 +15,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct CompositionEvent {
diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs
index 329e4c93c50..77000e25a34 100644
--- a/components/script/dom/console.rs
+++ b/components/script/dom/console.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 https://mozilla.org/MPL/2.0/. */
+use std::io;
+
+use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg};
+use js::rust::describe_scripted_caller;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::workerglobalscope::WorkerGlobalScope;
-use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg};
-use js::rust::describe_scripted_caller;
-use std::io;
// https://developer.mozilla.org/en-US/docs/Web/API/Console
pub struct Console(());
diff --git a/components/script/dom/constantsourcenode.rs b/components/script/dom/constantsourcenode.rs
index cbde279923d..4b9b8668706 100644
--- a/components/script/dom/constantsourcenode.rs
+++ b/components/script/dom/constantsourcenode.rs
@@ -2,22 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::constant_source_node::ConstantSourceNodeOptions as ServoMediaConstantSourceOptions;
+use servo_media::audio::node::AudioNodeInit;
+use servo_media::audio::param::ParamType;
+
use crate::dom::audioparam::AudioParam;
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
-use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceNodeMethods;
-use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceOptions;
+use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::{
+ ConstantSourceNodeMethods, ConstantSourceOptions,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::constant_source_node::ConstantSourceNodeOptions as ServoMediaConstantSourceOptions;
-use servo_media::audio::node::AudioNodeInit;
-use servo_media::audio::param::ParamType;
-use std::f32;
#[dom_struct]
pub struct ConstantSourceNode {
diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs
index 48064fe2f3e..c53bf3516cf 100644
--- a/components/script/dom/create.rs
+++ b/components/script/dom/create.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
+use js::rust::HandleObject;
+use servo_config::pref;
+
use crate::dom::bindings::error::{report_pending_exception, throw_dom_exception};
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
@@ -34,8 +38,7 @@ use crate::dom::htmlformelement::HTMLFormElement;
use crate::dom::htmlframeelement::HTMLFrameElement;
use crate::dom::htmlframesetelement::HTMLFrameSetElement;
use crate::dom::htmlheadelement::HTMLHeadElement;
-use crate::dom::htmlheadingelement::HTMLHeadingElement;
-use crate::dom::htmlheadingelement::HeadingLevel;
+use crate::dom::htmlheadingelement::{HTMLHeadingElement, HeadingLevel};
use crate::dom::htmlhrelement::HTMLHRElement;
use crate::dom::htmlhtmlelement::HTMLHtmlElement;
use crate::dom::htmliframeelement::HTMLIFrameElement;
@@ -84,9 +87,6 @@ use crate::dom::svgelement::SVGElement;
use crate::dom::svgsvgelement::SVGSVGElement;
use crate::realms::{enter_realm, InRealm};
use crate::script_thread::ScriptThread;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
-use js::rust::HandleObject;
-use servo_config::pref;
fn create_svg_element(
name: QualName,
diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs
index 3fdcb93a9ec..8005c9e7f7a 100644
--- a/components/script/dom/crypto.rs
+++ b/components/script/dom/crypto.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::{JSObject, Type};
+use js::rust::CustomAutoRooterGuard;
+use js::typedarray::ArrayBufferView;
+use servo_rand::{RngCore, ServoRng};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
use crate::dom::bindings::error::{Error, Fallible};
@@ -9,13 +17,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JSObject;
-use js::jsapi::Type;
-use js::rust::CustomAutoRooterGuard;
-use js::typedarray::ArrayBufferView;
-use servo_rand::{RngCore, ServoRng};
-use std::ptr::NonNull;
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto
#[dom_struct]
diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs
index 8c9600549c5..367f56a5656 100644
--- a/components/script/dom/css.rs
+++ b/components/script/dom/css.rs
@@ -2,13 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::Reflector;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::bindings::str::DOMString;
-use crate::dom::window::Window;
-use crate::dom::worklet::Worklet;
use cssparser::{serialize_identifier, Parser, ParserInput};
use dom_struct::dom_struct;
use style::context::QuirksMode;
@@ -17,6 +10,14 @@ use style::stylesheets::supports_rule::{parse_condition_or_declaration, Declarat
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ParsingMode;
+use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
+use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::reflector::Reflector;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::str::DOMString;
+use crate::dom::window::Window;
+use crate::dom::worklet::Worklet;
+
#[dom_struct]
pub struct CSS {
reflector_: Reflector,
diff --git a/components/script/dom/cssconditionrule.rs b/components/script/dom/cssconditionrule.rs
index 86010eba4e9..1a587c3f290 100644
--- a/components/script/dom/cssconditionrule.rs
+++ b/components/script/dom/cssconditionrule.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, SharedRwLock};
+use style::stylesheets::CssRules as StyleCssRules;
+
use crate::dom::bindings::codegen::Bindings::CSSConditionRuleBinding::CSSConditionRuleMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::str::DOMString;
@@ -9,10 +14,6 @@ use crate::dom::cssgroupingrule::CSSGroupingRule;
use crate::dom::cssmediarule::CSSMediaRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::csssupportsrule::CSSSupportsRule;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, SharedRwLock};
-use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]
pub struct CSSConditionRule {
diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs
index 679ec525383..edd175753c0 100644
--- a/components/script/dom/cssfontfacerule.rs
+++ b/components/script/dom/cssfontfacerule.rs
@@ -2,16 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::FontFaceRule;
+
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::FontFaceRule;
#[dom_struct]
pub struct CSSFontFaceRule {
diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs
index f89f58126de..c3fa70de189 100644
--- a/components/script/dom/cssgroupingrule.rs
+++ b/components/script/dom/cssgroupingrule.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, SharedRwLock};
+use style::stylesheets::CssRules as StyleCssRules;
+
use crate::dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
use crate::dom::bindings::error::{ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -11,10 +16,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::cssrule::CSSRule;
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
use crate::dom::cssstylesheet::CSSStyleSheet;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, SharedRwLock};
-use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]
pub struct CSSGroupingRule {
diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs
index e2da2a04378..857c5cd2909 100644
--- a/components/script/dom/cssimportrule.rs
+++ b/components/script/dom/cssimportrule.rs
@@ -2,16 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::ImportRule;
+
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::ImportRule;
#[dom_struct]
pub struct CSSImportRule {
diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs
index 9ab465e79a4..743df167b68 100644
--- a/components/script/dom/csskeyframerule.rs
+++ b/components/script/dom/csskeyframerule.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::keyframes_rule::Keyframe;
+
use crate::dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::CSSKeyframeRuleMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
@@ -11,10 +16,6 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::keyframes_rule::Keyframe;
#[dom_struct]
pub struct CSSKeyframeRule {
diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs
index 52a25a52dd0..51a63c557e8 100644
--- a/components/script/dom/csskeyframesrule.rs
+++ b/components/script/dom/csskeyframesrule.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::{Parser, ParserInput};
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesRule};
+use style::values::KeyframesName;
+
use crate::dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods;
use crate::dom::bindings::error::ErrorResult;
use crate::dom::bindings::inheritance::Castable;
@@ -13,12 +20,6 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::window::Window;
-use cssparser::{Parser, ParserInput};
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesRule};
-use style::values::KeyframesName;
#[dom_struct]
pub struct CSSKeyframesRule {
diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs
index cc18fc46797..79662f9c637 100644
--- a/components/script/dom/cssmediarule.rs
+++ b/components/script/dom/cssmediarule.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::{Parser, ParserInput};
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::media_queries::MediaList as StyleMediaList;
+use style::parser::ParserContext;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::{CssRuleType, MediaRule, Origin};
+use style_traits::{ParsingMode, ToCss};
+
use crate::dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
@@ -12,14 +21,6 @@ use crate::dom::cssrule::SpecificCSSRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::medialist::MediaList;
use crate::dom::window::Window;
-use cssparser::{Parser, ParserInput};
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::media_queries::MediaList as StyleMediaList;
-use style::parser::ParserContext;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::{CssRuleType, MediaRule, Origin};
-use style_traits::{ParsingMode, ToCss};
#[dom_struct]
pub struct CSSMediaRule {
diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs
index d03da04b116..173adc54a1a 100644
--- a/components/script/dom/cssnamespacerule.rs
+++ b/components/script/dom/cssnamespacerule.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::NamespaceRule;
+
use crate::dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding::CSSNamespaceRuleMethods;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
@@ -9,10 +14,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::{Locked, ToCssWithGuard};
-use style::stylesheets::NamespaceRule;
#[dom_struct]
pub struct CSSNamespaceRule {
diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs
index b9cc5c19dbd..7b2858e7986 100644
--- a/components/script/dom/cssrule.rs
+++ b/components/script/dom/cssrule.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use style::shared_lock::SharedRwLock;
+use style::stylesheets::CssRule as StyleCssRule;
+
use crate::dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::Reflector;
@@ -17,10 +23,6 @@ use crate::dom::cssstylerule::CSSStyleRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::csssupportsrule::CSSSupportsRule;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use style::shared_lock::SharedRwLock;
-use style::stylesheets::CssRule as StyleCssRule;
#[dom_struct]
pub struct CSSRule {
diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs
index df0ab6134e9..feaf9e819ba 100644
--- a/components/script/dom/cssrulelist.rs
+++ b/components/script/dom/cssrulelist.rs
@@ -4,6 +4,14 @@
#![allow(unsafe_code)]
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::Locked;
+use style::stylesheets::{
+ AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
+ StylesheetLoader as StyleStylesheetLoader,
+};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -15,13 +23,6 @@ use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::window::Window;
use crate::stylesheet_loader::StylesheetLoader;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::shared_lock::Locked;
-use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
-use style::stylesheets::{
- AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
-};
unsafe_no_jsmanaged_fields!(RulesSource);
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 0e4e541ecf2..c9bc453fe06 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -2,33 +2,32 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::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::{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::{document_from_node, stylesheets_owner_from_node, window_from_node, Node};
-use crate::dom::window::Window;
use dom_struct::dom_struct;
use html5ever::local_name;
use servo_arc::Arc;
use servo_url::ServoUrl;
use style::attr::AttrValue;
use style::properties::{
- parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration,
-};
-use style::properties::{
- Importance, LonghandId, PropertyDeclarationBlock, PropertyId, ShorthandId,
+ parse_one_declaration_into, parse_style_attribute, Importance, LonghandId,
+ PropertyDeclarationBlock, PropertyId, ShorthandId, SourcePropertyDeclaration,
};
use style::selector_parser::PseudoElement;
use style::shared_lock::Locked;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ParsingMode;
+use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::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::{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::{document_from_node, stylesheets_owner_from_node, window_from_node, Node};
+use crate::dom::window::Window;
+
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
#[dom_struct]
pub struct CSSStyleDeclaration {
diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs
index 007a98a7592..bf40c952e2f 100644
--- a/components/script/dom/cssstylerule.rs
+++ b/components/script/dom/cssstylerule.rs
@@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::mem;
+
+use cssparser::{Parser as CssParser, ParserInput as CssParserInput, ToCss};
+use dom_struct::dom_struct;
+use selectors::parser::SelectorList;
+use servo_arc::Arc;
+use style::selector_parser::SelectorParser;
+use style::shared_lock::{Locked, ToCssWithGuard};
+use style::stylesheets::{Origin, StyleRule};
+
use crate::dom::bindings::codegen::Bindings::CSSStyleRuleBinding::CSSStyleRuleMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
@@ -12,15 +22,6 @@ use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::node::{stylesheets_owner_from_node, Node};
use crate::dom::window::Window;
-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::{Origin, StyleRule};
#[dom_struct]
pub struct CSSStyleRule {
diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs
index e8de2ef3add..b7bf410ed36 100644
--- a/components/script/dom/cssstylesheet.rs
+++ b/components/script/dom/cssstylesheet.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::shared_lock::SharedRwLock;
+use style::stylesheets::Stylesheet as StyleStyleSheet;
+
use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -14,11 +21,6 @@ use crate::dom::medialist::MediaList;
use crate::dom::node::{stylesheets_owner_from_node, Node};
use crate::dom::stylesheet::StyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use std::cell::Cell;
-use style::shared_lock::SharedRwLock;
-use style::stylesheets::Stylesheet as StyleStyleSheet;
#[dom_struct]
pub struct CSSStyleSheet {
diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs
index f272b34e945..d440c055025 100644
--- a/components/script/dom/cssstylevalue.rs
+++ b/components/script/dom/cssstylevalue.rs
@@ -2,16 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::{Parser, ParserInput};
+use dom_struct::dom_struct;
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods;
-use crate::dom::bindings::reflector::reflect_dom_object;
-use crate::dom::bindings::reflector::Reflector;
+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;
-use cssparser::ParserInput;
-use dom_struct::dom_struct;
-use servo_url::ServoUrl;
#[dom_struct]
pub struct CSSStyleValue {
diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs
index 0eaa1f9d53a..c321ac88091 100644
--- a/components/script/dom/csssupportsrule.rs
+++ b/components/script/dom/csssupportsrule.rs
@@ -2,14 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-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;
-use crate::dom::cssrule::SpecificCSSRule;
-use crate::dom::cssstylesheet::CSSStyleSheet;
-use crate::dom::window::Window;
use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
use servo_arc::Arc;
@@ -19,6 +11,15 @@ use style::stylesheets::supports_rule::SupportsCondition;
use style::stylesheets::{CssRuleType, Origin, SupportsRule};
use style_traits::{ParsingMode, ToCss};
+use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
+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;
+use crate::dom::cssrule::SpecificCSSRule;
+use crate::dom::cssstylesheet::CSSStyleSheet;
+use crate::dom::window::Window;
+
#[dom_struct]
pub struct CSSSupportsRule {
cssconditionrule: CSSConditionRule,
diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs
index 9439e7e95bc..cc1afce2e48 100644
--- a/components/script/dom/customelementregistry.rs
+++ b/components/script/dom/customelementregistry.rs
@@ -2,11 +2,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::VecDeque;
+use std::ops::Deref;
+use std::rc::Rc;
+use std::{mem, ptr};
+
+use dom_struct::dom_struct;
+use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
+use js::conversions::ToJSValConvertible;
+use js::glue::UnwrapObjectStatic;
+use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor, JSAutoRealm, JSObject};
+use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
+use js::rust::wrappers::{Construct1, JS_GetProperty, SameValue};
+use js::rust::{HandleObject, HandleValue, MutableHandleValue};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::callback::{CallbackContainer, ExceptionHandling};
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::CustomElementRegistryBinding::CustomElementConstructor;
-use crate::dom::bindings::codegen::Bindings::CustomElementRegistryBinding::CustomElementRegistryMethods;
-use crate::dom::bindings::codegen::Bindings::CustomElementRegistryBinding::ElementDefinitionOptions;
+use crate::dom::bindings::codegen::Bindings::CustomElementRegistryBinding::{
+ CustomElementConstructor, CustomElementRegistryMethods, ElementDefinitionOptions,
+};
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;
@@ -33,23 +49,6 @@ use crate::microtask::Microtask;
use crate::realms::{enter_realm, InRealm};
use crate::script_runtime::JSContext;
use crate::script_thread::ScriptThread;
-use dom_struct::dom_struct;
-use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
-use js::conversions::ToJSValConvertible;
-use js::glue::UnwrapObjectStatic;
-use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor};
-use js::jsapi::{JSAutoRealm, JSObject};
-use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
-use js::rust::wrappers::{Construct1, JS_GetProperty, SameValue};
-use js::rust::{HandleObject, HandleValue, MutableHandleValue};
-use std::cell::Cell;
-use std::collections::VecDeque;
-use std::mem;
-use std::ops::Deref;
-use std::ptr;
-use std::rc::Rc;
-
-use super::bindings::trace::HashMapTracedValues;
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs
index 4004adebd82..312cfc399de 100644
--- a/components/script/dom/customevent.rs
+++ b/components/script/dom/customevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::CustomEventBinding;
use crate::dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
@@ -14,12 +20,6 @@ use crate::dom::bindings::trace::RootedTraceableBox;
use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::HandleObject;
-use js::rust::HandleValue;
-use servo_atoms::Atom;
// https://dom.spec.whatwg.org/#interface-customevent
#[dom_struct]
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 956634856ce..22bd6195389 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -2,10 +2,36 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::mem::replace;
+use std::sync::atomic::AtomicBool;
+use std::sync::Arc;
+use std::thread::{self, JoinHandle};
+
+use crossbeam_channel::{unbounded, Receiver, Sender};
+use devtools_traits::DevtoolScriptControlMsg;
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcReceiver;
+use ipc_channel::router::ROUTER;
+use js::jsapi::{Heap, JSContext, JSObject, JS_AddInterruptCallback};
+use js::jsval::UndefinedValue;
+use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
+use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
+use net_traits::image_cache::ImageCache;
+use net_traits::request::{
+ CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder, RequestMode,
+};
+use net_traits::IpcSend;
+use parking_lot::Mutex;
+use script_traits::{WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
+use servo_rand::random;
+use servo_url::{ImmutableOrigin, ServoUrl};
+use style::thread_state::{self, ThreadState};
+
use crate::devtools;
use crate::dom::abstractworker::{SimpleWorkerErrorHandler, WorkerScriptMsg};
-use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods};
-use crate::dom::abstractworkerglobalscope::{SendableWorkerScriptChan, WorkerThreadWorkerChan};
+use crate::dom::abstractworkerglobalscope::{
+ run_worker_event_loop, SendableWorkerScriptChan, WorkerEventLoopMethods, WorkerThreadWorkerChan,
+};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding;
use crate::dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::DedicatedWorkerGlobalScopeMethods;
@@ -36,29 +62,6 @@ use crate::script_runtime::{
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::TaskSourceName;
-use crossbeam_channel::{unbounded, Receiver, Sender};
-use devtools_traits::DevtoolScriptControlMsg;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcReceiver;
-use ipc_channel::router::ROUTER;
-use js::jsapi::JS_AddInterruptCallback;
-use js::jsapi::{Heap, JSContext, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
-use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
-use net_traits::image_cache::ImageCache;
-use net_traits::request::{CredentialsMode, Destination, ParserMetadata};
-use net_traits::request::{Referrer, RequestBuilder, RequestMode};
-use net_traits::IpcSend;
-use parking_lot::Mutex;
-use script_traits::{WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
-use servo_rand::random;
-use servo_url::{ImmutableOrigin, ServoUrl};
-use std::mem::replace;
-use std::sync::atomic::AtomicBool;
-use std::sync::Arc;
-use std::thread::{self, JoinHandle};
-use style::thread_state::{self, ThreadState};
/// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular
/// value for the duration of this object's lifetime. This ensures that the related Worker
diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs
index d1c466bb781..cae89941ce6 100644
--- a/components/script/dom/dissimilaroriginlocation.rs
+++ b/components/script/dom/dissimilaroriginlocation.rs
@@ -2,15 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::DissimilarOriginLocationMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
-use crate::dom::bindings::reflector::reflect_dom_object;
-use crate::dom::bindings::reflector::Reflector;
+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::str::USVString;
+use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow;
-use dom_struct::dom_struct;
/// Represents a dissimilar-origin `Location` that exists in another script thread.
///
diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs
index 13d836114c6..cd38216d0ca 100644
--- a/components/script/dom/dissimilaroriginwindow.rs
+++ b/components/script/dom/dissimilaroriginwindow.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
+use msg::constellation_msg::PipelineId;
+use script_traits::{ScriptMsg, StructuredSerializedData};
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding;
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowPostMessageOptions;
@@ -14,13 +22,6 @@ use crate::dom::dissimilaroriginlocation::DissimilarOriginLocation;
use crate::dom::globalscope::GlobalScope;
use crate::dom::windowproxy::WindowProxy;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use js::jsval::{JSVal, UndefinedValue};
-use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
-use msg::constellation_msg::PipelineId;
-use script_traits::{ScriptMsg, StructuredSerializedData};
-use servo_url::ServoUrl;
/// Represents a dissimilar-origin `Window` that exists in another script thread.
///
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index c34ed1128d0..070d8b0d906 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2,6 +2,75 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::cmp::Ordering;
+use std::collections::hash_map::Entry::{Occupied, Vacant};
+use std::collections::{HashMap, HashSet, VecDeque};
+use std::default::Default;
+use std::mem;
+use std::ptr::NonNull;
+use std::rc::Rc;
+use std::slice::from_ref;
+use std::time::{Duration, Instant};
+
+use canvas_traits::webgl::{self, WebGLContextId, WebGLMsg};
+use content_security_policy::{self as csp, CspList};
+use cookie::Cookie;
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
+use devtools_traits::ScriptToDevtoolsControlMsg;
+use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
+use encoding_rs::{Encoding, UTF_8};
+use euclid::default::{Point2D, Rect, Size2D};
+use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName};
+use hyper_serde::Serde;
+use ipc_channel::ipc::{self, IpcSender};
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use keyboard_types::{Code, Key, KeyState};
+use lazy_static::lazy_static;
+use metrics::{
+ InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
+ ProgressiveWebMetric,
+};
+use mime::{self, Mime};
+use msg::constellation_msg::BrowsingContextId;
+use net_traits::pub_domains::is_pub_domain;
+use net_traits::request::RequestBuilder;
+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 percent_encoding::percent_decode;
+use profile_traits::ipc as profile_ipc;
+use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType};
+use script_layout_interface::message::{Msg, PendingRestyle, ReflowGoal};
+use script_layout_interface::TrustedNodeAddress;
+use script_traits::{
+ AnimationState, DocumentActivity, MouseButton, MouseEventType, MsDuration, ScriptMsg,
+ TouchEventType, TouchId, UntrustedNodeAddress, WheelDelta,
+};
+use servo_arc::Arc;
+use servo_atoms::Atom;
+use servo_config::pref;
+use servo_media::{ClientContextId, ServoMedia};
+use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
+use style::attr::AttrValue;
+use style::context::QuirksMode;
+use style::invalidation::element::restyle_hints::RestyleHint;
+use style::media_queries::{Device, MediaType};
+use style::selector_parser::Snapshot;
+use style::shared_lock::SharedRwLock as StyleSharedRwLock;
+use style::str::{split_html_space_chars, str_join};
+use style::stylesheet_set::DocumentStylesheetSet;
+use style::stylesheets::{Origin, OriginSet, Stylesheet};
+use url::Host;
+use uuid::Uuid;
+use webrender_api::units::DeviceIntRect;
+
+use super::bindings::trace::{HashMapTracedValues, NoTrace};
use crate::animation_timeline::AnimationTimeline;
use crate::animations::Animations;
use crate::document_loader::{DocumentLoader, LoadType};
@@ -48,9 +117,9 @@ use crate::dom::documentfragment::DocumentFragment;
use crate::dom::documentorshadowroot::{DocumentOrShadowRoot, StyleSheetInDocument};
use crate::dom::documenttype::DocumentType;
use crate::dom::domimplementation::DOMImplementation;
-use crate::dom::element::CustomElementCreationMode;
use crate::dom::element::{
- Element, ElementCreator, ElementPerformFullscreenEnter, ElementPerformFullscreenExit,
+ CustomElementCreationMode, Element, ElementCreator, ElementPerformFullscreenEnter,
+ ElementPerformFullscreenExit,
};
use crate::dom::event::{Event, EventBubbles, EventCancelable, EventDefault, EventStatus};
use crate::dom::eventtarget::EventTarget;
@@ -78,8 +147,10 @@ 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, document_from_node, window_from_node, CloneChildrenFlag};
-use crate::dom::node::{Node, NodeDamage, NodeFlags, ShadowIncluding};
+use crate::dom::node::{
+ self, document_from_node, window_from_node, CloneChildrenFlag, Node, NodeDamage, NodeFlags,
+ ShadowIncluding,
+};
use crate::dom::nodeiterator::NodeIterator;
use crate::dom::nodelist::NodeList;
use crate::dom::pagetransitionevent::PageTransitionEvent;
@@ -104,81 +175,12 @@ use crate::dom::window::{ReflowReason, Window};
use crate::dom::windowproxy::WindowProxy;
use crate::fetch::FetchCanceller;
use crate::realms::{AlreadyInRealm, InRealm};
-use crate::script_runtime::JSContext;
-use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
+use crate::script_runtime::{CommonScriptMsg, JSContext, ScriptThreadEventCategory};
use crate::script_thread::{MainThreadScriptMsg, ScriptThread};
use crate::stylesheet_set::StylesheetSetRef;
use crate::task::TaskBox;
use crate::task_source::{TaskSource, TaskSourceName};
use crate::timers::OneshotTimerCallback;
-use canvas_traits::webgl::{self, WebGLContextId, WebGLMsg};
-use content_security_policy::{self as csp, CspList};
-use cookie::Cookie;
-use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
-use devtools_traits::ScriptToDevtoolsControlMsg;
-use dom_struct::dom_struct;
-use embedder_traits::EmbedderMsg;
-use encoding_rs::{Encoding, UTF_8};
-use euclid::default::{Point2D, Rect, Size2D};
-use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName};
-use hyper_serde::Serde;
-use ipc_channel::ipc::{self, IpcSender};
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use keyboard_types::{Code, Key, KeyState};
-use lazy_static::lazy_static;
-use metrics::{
- InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
- ProgressiveWebMetric,
-};
-use mime::{self, Mime};
-use msg::constellation_msg::BrowsingContextId;
-use net_traits::pub_domains::is_pub_domain;
-use net_traits::request::RequestBuilder;
-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 percent_encoding::percent_decode;
-use profile_traits::ipc as profile_ipc;
-use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType};
-use script_layout_interface::message::{Msg, PendingRestyle, ReflowGoal};
-use script_layout_interface::TrustedNodeAddress;
-use script_traits::{AnimationState, DocumentActivity, MouseButton, MouseEventType};
-use script_traits::{
- MsDuration, ScriptMsg, TouchEventType, TouchId, UntrustedNodeAddress, WheelDelta,
-};
-use servo_arc::Arc;
-use servo_atoms::Atom;
-use servo_config::pref;
-use servo_media::{ClientContextId, ServoMedia};
-use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::cmp::Ordering;
-use std::collections::hash_map::Entry::{Occupied, Vacant};
-use std::collections::{HashMap, HashSet, VecDeque};
-use std::default::Default;
-use std::mem;
-use std::ptr::NonNull;
-use std::rc::Rc;
-use std::slice::from_ref;
-use std::time::{Duration, Instant};
-use style::attr::AttrValue;
-use style::context::QuirksMode;
-use style::invalidation::element::restyle_hints::RestyleHint;
-use style::media_queries::{Device, MediaType};
-use style::selector_parser::Snapshot;
-use style::shared_lock::SharedRwLock as StyleSharedRwLock;
-use style::str::{split_html_space_chars, str_join};
-use style::stylesheet_set::DocumentStylesheetSet;
-use style::stylesheets::{Origin, OriginSet, Stylesheet};
-use url::Host;
-use uuid::Uuid;
-use webrender_api::units::DeviceIntRect;
-
-use super::bindings::trace::{HashMapTracedValues, NoTrace};
/// 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 f2455f61130..c9999ba4f44 100644
--- a/components/script/dom/documentfragment.rs
+++ b/components/script/dom/documentfragment.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DocumentFragmentBinding::DocumentFragmentMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@@ -16,11 +21,6 @@ use crate::dom::htmlcollection::HTMLCollection;
use crate::dom::node::{window_from_node, Node};
use crate::dom::nodelist::NodeList;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-
-use super::bindings::trace::HashMapTracedValues;
// https://dom.spec.whatwg.org/#documentfragment
#[dom_struct]
diff --git a/components/script/dom/documentorshadowroot.rs b/components/script/dom/documentorshadowroot.rs
index 14e4774c55b..3e87132f03e 100644
--- a/components/script/dom/documentorshadowroot.rs
+++ b/components/script/dom/documentorshadowroot.rs
@@ -2,28 +2,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::num::Finite;
-use crate::dom::bindings::root::{Dom, DomRoot};
-use crate::dom::element::Element;
-use crate::dom::htmlelement::HTMLElement;
-use crate::dom::node::{self, Node, VecPreOrderInsertionHelper};
-use crate::dom::window::Window;
-use crate::stylesheet_set::StylesheetSetRef;
+use std::fmt;
+
use euclid::default::Point2D;
use script_layout_interface::message::{NodesFromPointQueryType, QueryMsg};
use script_traits::UntrustedNodeAddress;
use servo_arc::Arc;
use servo_atoms::Atom;
-use std::fmt;
use style::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use style::media_queries::MediaList;
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
use style::stylesheets::{Stylesheet, StylesheetContents};
use super::bindings::trace::HashMapTracedValues;
+use crate::dom::bindings::cell::DomRefCell;
+use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
+use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::num::Finite;
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::element::Element;
+use crate::dom::htmlelement::HTMLElement;
+use crate::dom::node::{self, Node, VecPreOrderInsertionHelper};
+use crate::dom::window::Window;
+use crate::stylesheet_set::StylesheetSetRef;
#[derive(Clone, JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs
index f323cd63d63..f55eaac6c8f 100644
--- a/components/script/dom/documenttype.rs
+++ b/components/script/dom/documenttype.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::DocumentTypeBinding::DocumentTypeMethods;
use crate::dom::bindings::codegen::UnionTypes::NodeOrString;
use crate::dom::bindings::error::ErrorResult;
@@ -10,7 +12,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
// https://dom.spec.whatwg.org/#documenttype
/// The `DOCTYPE` tag.
diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs
index e5462fa4376..c058136a8b5 100644
--- a/components/script/dom/domexception.rs
+++ b/components/script/dom/domexception.rs
@@ -2,8 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants;
-use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
+use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::{
+ DOMExceptionConstants, DOMExceptionMethods,
+};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::reflector::{
reflect_dom_object, reflect_dom_object_with_proto, Reflector,
@@ -11,8 +15,6 @@ use crate::dom::bindings::reflector::{
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[repr(u16)]
#[derive(Clone, Copy, Debug, Eq, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs
index 95a62b19efa..37712dd3d05 100644
--- a/components/script/dom/domimplementation.rs
+++ b/components/script/dom/domimplementation.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns};
+use script_traits::DocumentActivity;
+
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementationMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
@@ -15,8 +19,7 @@ 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::DocumentSource;
-use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
+use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
use crate::dom::documenttype::DocumentType;
use crate::dom::htmlbodyelement::HTMLBodyElement;
use crate::dom::htmlheadelement::HTMLHeadElement;
@@ -25,9 +28,6 @@ use crate::dom::htmltitleelement::HTMLTitleElement;
use crate::dom::node::Node;
use crate::dom::text::Text;
use crate::dom::xmldocument::XMLDocument;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns};
-use script_traits::DocumentActivity;
// https://dom.spec.whatwg.org/#domimplementation
#[dom_struct]
diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs
index c37ba3dfc79..dd6aff6ea0f 100644
--- a/components/script/dom/dommatrix.rs
+++ b/components/script/dom/dommatrix.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::default::Transform3D;
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{Float32Array, Float64Array};
+
use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{DOMMatrixInit, DOMMatrixMethods};
use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnlyMethods;
use crate::dom::bindings::codegen::UnionTypes::StringOrUnrestrictedDoubleSequence;
@@ -15,10 +20,6 @@ use crate::dom::dommatrixreadonly::{
};
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use euclid::default::Transform3D;
-use js::rust::{CustomAutoRooterGuard, HandleObject};
-use js::typedarray::{Float32Array, Float64Array};
#[dom_struct]
pub struct DOMMatrix {
diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs
index f6cc458b618..a20c935ee89 100644
--- a/components/script/dom/dommatrixreadonly.rs
+++ b/components/script/dom/dommatrixreadonly.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::ptr::NonNull;
+use std::{f64, ptr};
+
+use cssparser::{Parser, ParserInput};
+use dom_struct::dom_struct;
+use euclid::default::Transform3D;
+use euclid::Angle;
+use js::jsapi::JSObject;
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{CreateWith, Float32Array, Float64Array};
+use style::parser::ParserContext;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{DOMMatrixInit, DOMMatrixMethods};
use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnlyMethods;
@@ -17,18 +30,6 @@ use crate::dom::dompoint::DOMPoint;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
-use cssparser::{Parser, ParserInput};
-use dom_struct::dom_struct;
-use euclid::{default::Transform3D, Angle};
-use js::jsapi::JSObject;
-use js::rust::{CustomAutoRooterGuard, HandleObject};
-use js::typedarray::CreateWith;
-use js::typedarray::{Float32Array, Float64Array};
-use std::cell::Cell;
-use std::f64;
-use std::ptr;
-use std::ptr::NonNull;
-use style::parser::ParserContext;
#[dom_struct]
#[allow(non_snake_case)]
diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs
index 9562a32d844..6bfb195ee46 100644
--- a/components/script/dom/domparser.rs
+++ b/components/script/dom/domparser.rs
@@ -2,26 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use script_traits::DocumentActivity;
+
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::codegen::Bindings::DOMParserBinding;
use crate::dom::bindings::codegen::Bindings::DOMParserBinding::DOMParserMethods;
-use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Application_xhtml_xml;
-use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Application_xml;
-use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Text_html;
-use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Text_xml;
+use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::{
+ Application_xhtml_xml, Application_xml, Text_html, Text_xml,
+};
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
-use crate::dom::document::DocumentSource;
-use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
+use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
use crate::dom::servoparser::ServoParser;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use script_traits::DocumentActivity;
#[dom_struct]
pub struct DOMParser {
diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs
index 1398712076b..31835f08cbd 100644
--- a/components/script/dom/dompoint.rs
+++ b/components/script/dom/dompoint.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods};
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
use crate::dom::bindings::error::Fallible;
@@ -9,8 +12,6 @@ use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::DomRoot;
use crate::dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
#[dom_struct]
diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs
index 2e5386a367d..a782d6b5180 100644
--- a/components/script/dom/dompointreadonly.rs
+++ b/components/script/dom/dompointreadonly.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 https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::cell::Cell;
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
#[dom_struct]
diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs
index f015b09ee1c..ce824911eb2 100644
--- a/components/script/dom/domquad.rs
+++ b/components/script/dom/domquad.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods};
use crate::dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods};
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit;
@@ -11,8 +14,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::dompoint::DOMPoint;
use crate::dom::domrect::DOMRect;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
// https://drafts.fxtf.org/geometry/#DOMQuad
#[dom_struct]
diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs
index 5fa5db8a606..86dc264a650 100644
--- a/components/script/dom/domrect.rs
+++ b/components/script/dom/domrect.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
use crate::dom::bindings::error::Fallible;
@@ -9,8 +12,6 @@ use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::DomRoot;
use crate::dom::domrectreadonly::DOMRectReadOnly;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct DOMRect {
diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs
index 09461954285..8deb6fd5c5c 100644
--- a/components/script/dom/domrectreadonly.rs
+++ b/components/script/dom/domrectreadonly.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::cell::Cell;
#[dom_struct]
pub struct DOMRectReadOnly {
diff --git a/components/script/dom/domstringlist.rs b/components/script/dom/domstringlist.rs
index a1592faca79..25c770f1e4d 100644
--- a/components/script/dom/domstringlist.rs
+++ b/components/script/dom/domstringlist.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::DOMStringListBinding::DOMStringListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct DOMStringList {
diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs
index 9ff1071e85b..28998e0ba01 100644
--- a/components/script/dom/domstringmap.rs
+++ b/components/script/dom/domstringmap.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods;
use crate::dom::bindings::error::ErrorResult;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,7 +11,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::window_from_node;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct DOMStringMap {
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index 0d8b4908f53..d448d3dce58 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{namespace_url, ns, LocalName};
+use servo_atoms::Atom;
+use style::str::HTML_SPACE_CHARACTERS;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -10,10 +15,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::element::Element;
use crate::dom::node::window_from_node;
-use dom_struct::dom_struct;
-use html5ever::{namespace_url, ns, LocalName};
-use servo_atoms::Atom;
-use style::str::HTML_SPACE_CHARACTERS;
#[dom_struct]
pub struct DOMTokenList {
diff --git a/components/script/dom/dynamicmoduleowner.rs b/components/script/dom/dynamicmoduleowner.rs
index 67f83442d8f..28bd0636d3a 100644
--- a/components/script/dom/dynamicmoduleowner.rs
+++ b/components/script/dom/dynamicmoduleowner.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use uuid::Uuid;
+
use crate::dom::bindings::codegen::Bindings::DynamicModuleOwnerBinding::DynamicModuleOwnerMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
-use dom_struct::dom_struct;
-use std::rc::Rc;
-use uuid::Uuid;
/// An unique id for dynamic module
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index ecbc3c8c097..31ea2701c82 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -4,6 +4,66 @@
//! Element nodes.
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::default::Default;
+use std::ops::Deref;
+use std::rc::Rc;
+use std::str::FromStr;
+use std::{fmt, mem};
+
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
+use devtools_traits::AttrInfo;
+use dom_struct::dom_struct;
+use euclid::default::{Rect, Size2D};
+use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
+use html5ever::serialize::{SerializeOpts, TraversalScope};
+use html5ever::{
+ local_name, namespace_prefix, namespace_url, ns, serialize, LocalName, Namespace, Prefix,
+ QualName,
+};
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::HandleObject;
+use msg::constellation_msg::InputMethodType;
+use net_traits::request::CorsSettings;
+use net_traits::ReferrerPolicy;
+use script_layout_interface::message::ReflowGoal;
+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 style::applicable_declarations::ApplicableDeclarationBlock;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
+use style::context::QuirksMode;
+use style::element_state::ElementState;
+use style::invalidation::element::restyle_hints::RestyleHint;
+use style::properties::longhands::{
+ self, background_image, border_spacing, font_family, font_size,
+};
+use style::properties::{
+ parse_style_attribute, ComputedValues, Importance, PropertyDeclaration,
+ PropertyDeclarationBlock,
+};
+use style::rule_tree::CascadeLevel;
+use style::selector_parser::{
+ extended_filtering, NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl,
+ SelectorParser,
+};
+use style::shared_lock::{Locked, SharedRwLock};
+use style::stylesheets::layer_rule::LayerOrder;
+use style::stylesheets::CssRuleType;
+use style::values::generics::NonNegative;
+use style::values::{computed, specified, AtomIdent, AtomString, CSSFloat};
+use style::{dom_apis, thread_state, CaseSensitivityExt};
+use xml5ever::serialize as xmlSerialize;
+use xml5ever::serialize::TraversalScope::{
+ ChildrenOnly as XmlChildrenOnly, IncludeNode as XmlIncludeNode,
+};
+use xml5ever::serialize::{SerializeOpts as XmlSerializeOpts, TraversalScope as XmlTraversalScope};
+
use crate::dom::activation::Activatable;
use crate::dom::attr::{Attr, AttrHelpersForLayout};
use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref, RefMut};
@@ -14,8 +74,9 @@ 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::ShadowRootBinding::ShadowRootBinding::ShadowRootMethods;
-use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
-use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
+use crate::dom::bindings::codegen::Bindings::WindowBinding::{
+ ScrollBehavior, ScrollToOptions, WindowMethods,
+};
use crate::dom::bindings::codegen::UnionTypes::NodeOrString;
use crate::dom::bindings::conversions::DerivedFrom;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -69,9 +130,10 @@ 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::{BindContext, NodeDamage, NodeFlags, UnbindContext};
-use crate::dom::node::{ChildrenMutation, LayoutNodeHelpers, Node, ShadowIncluding};
+use crate::dom::node::{
+ document_from_node, window_from_node, BindContext, ChildrenMutation, LayoutNodeHelpers, Node,
+ NodeDamage, NodeFlags, ShadowIncluding, UnbindContext,
+};
use crate::dom::nodelist::NodeList;
use crate::dom::promise::Promise;
use crate::dom::raredata::ElementRareData;
@@ -84,67 +146,6 @@ use crate::dom::window::ReflowReason;
use crate::script_thread::ScriptThread;
use crate::stylesheet_loader::StylesheetOwner;
use crate::task::TaskOnce;
-use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
-use devtools_traits::AttrInfo;
-use dom_struct::dom_struct;
-use euclid::default::Rect;
-use euclid::default::Size2D;
-use html5ever::serialize;
-use html5ever::serialize::SerializeOpts;
-use html5ever::serialize::TraversalScope;
-use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
-use html5ever::{
- local_name, namespace_prefix, namespace_url, ns, LocalName, Namespace, Prefix, QualName,
-};
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::HandleObject;
-use msg::constellation_msg::InputMethodType;
-use net_traits::request::CorsSettings;
-use net_traits::ReferrerPolicy;
-use script_layout_interface::message::ReflowGoal;
-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;
-use std::cell::Cell;
-use std::default::Default;
-use std::fmt;
-use std::mem;
-use std::ops::Deref;
-use std::rc::Rc;
-use std::str::FromStr;
-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::longhands::{
- self, background_image, border_spacing, font_family, font_size,
-};
-use style::properties::{parse_style_attribute, PropertyDeclarationBlock};
-use style::properties::{ComputedValues, Importance, PropertyDeclaration};
-use style::rule_tree::CascadeLevel;
-use style::selector_parser::extended_filtering;
-use style::selector_parser::{
- NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser,
-};
-use style::shared_lock::{Locked, SharedRwLock};
-use style::stylesheets::layer_rule::LayerOrder;
-use style::stylesheets::CssRuleType;
-use style::thread_state;
-use style::values::generics::NonNegative;
-use style::values::{computed, specified, AtomIdent, AtomString, CSSFloat};
-use style::CaseSensitivityExt;
-use xml5ever::serialize as xmlSerialize;
-use xml5ever::serialize::SerializeOpts as XmlSerializeOpts;
-use xml5ever::serialize::TraversalScope as XmlTraversalScope;
-use xml5ever::serialize::TraversalScope::ChildrenOnly as XmlChildrenOnly;
-use xml5ever::serialize::TraversalScope::IncludeNode as XmlIncludeNode;
// TODO: Update focus state when the top-level browsing context gains or loses system focus,
// and when the element enters or leaves a browsing context container.
diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs
index cc8664849df..c144ca258a7 100644
--- a/components/script/dom/errorevent.rs
+++ b/components/script/dom/errorevent.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ErrorEventBinding;
use crate::dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods;
@@ -15,12 +23,6 @@ use crate::dom::bindings::trace::RootedTraceableBox;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
-use std::cell::Cell;
#[dom_struct]
pub struct ErrorEvent {
diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs
index 78a409ce507..aaf913fea8e 100644
--- a/components/script/dom/event.rs
+++ b/components/script/dom/event.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::default::Default;
+
+use devtools_traits::{TimelineMarker, TimelineMarkerType};
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use metrics::ToMs;
+use servo_atoms::Atom;
+
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventBinding;
@@ -26,13 +35,6 @@ use crate::dom::performance::reduce_timing_resolution;
use crate::dom::virtualmethods::vtable_for;
use crate::dom::window::Window;
use crate::task::TaskOnce;
-use devtools_traits::{TimelineMarker, TimelineMarkerType};
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use metrics::ToMs;
-use servo_atoms::Atom;
-use std::cell::Cell;
-use std::default::Default;
#[dom_struct]
pub struct Event {
diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs
index 57d8a84df8b..7827175bb96 100644
--- a/components/script/dom/eventsource.rs
+++ b/components/script/dom/eventsource.rs
@@ -2,6 +2,30 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::mem;
+use std::str::{Chars, FromStr};
+use std::sync::{Arc, Mutex};
+
+use dom_struct::dom_struct;
+use euclid::Length;
+use headers::ContentType;
+use http::header::{self, HeaderName, HeaderValue};
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::conversions::ToJSValConvertible;
+use js::jsval::UndefinedValue;
+use js::rust::HandleObject;
+use mime::{self, Mime};
+use net_traits::request::{CacheMode, CorsSettings, Destination, RequestBuilder};
+use net_traits::{
+ CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, FetchResponseMsg,
+ FilteredMetadata, NetworkError, ResourceFetchTiming, ResourceTimingType,
+};
+use servo_atoms::Atom;
+use servo_url::ServoUrl;
+use utf8;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventSourceBinding::{
EventSourceInit, EventSourceMethods,
@@ -22,27 +46,6 @@ use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingLi
use crate::realms::enter_realm;
use crate::task_source::{TaskSource, TaskSourceName};
use crate::timers::OneshotTimerCallback;
-use dom_struct::dom_struct;
-use euclid::Length;
-use headers::ContentType;
-use http::header::{self, HeaderName, HeaderValue};
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::conversions::ToJSValConvertible;
-use js::jsval::UndefinedValue;
-use js::rust::HandleObject;
-use mime::{self, Mime};
-use net_traits::request::{CacheMode, CorsSettings, Destination, RequestBuilder};
-use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FilteredMetadata};
-use net_traits::{FetchResponseListener, FetchResponseMsg, NetworkError};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use servo_atoms::Atom;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::mem;
-use std::str::{Chars, FromStr};
-use std::sync::{Arc, Mutex};
-use utf8;
const DEFAULT_RECONNECTION_TIME: u64 = 5000;
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 83180485ec1..d291eaba747 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -2,23 +2,44 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::hash_map::Entry::{Occupied, Vacant};
+use std::default::Default;
+use std::ffi::CString;
+use std::hash::BuildHasherDefault;
+use std::mem;
+use std::ops::{Deref, DerefMut};
+use std::rc::Rc;
+
+use deny_public_fields::DenyPublicFields;
+use dom_struct::dom_struct;
+use fnv::FnvHasher;
+use js::jsapi::JS_GetFunctionObject;
+use js::rust::wrappers::CompileFunction;
+use js::rust::{
+ transform_u16_to_source_text, CompileOptionsWrapper, HandleObject, RootedObjectVectorWrapper,
+};
+use libc::c_char;
+use servo_atoms::Atom;
+use servo_url::ServoUrl;
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::beforeunloadevent::BeforeUnloadEvent;
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;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
-use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::OnBeforeUnloadEventHandlerNonNull;
-use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
+use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::{
+ EventHandlerNonNull, OnBeforeUnloadEventHandlerNonNull, OnErrorEventHandlerNonNull,
+};
use crate::dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
-use crate::dom::bindings::codegen::Bindings::EventTargetBinding::AddEventListenerOptions;
-use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventListenerOptions;
-use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods;
+use crate::dom::bindings::codegen::Bindings::EventTargetBinding::{
+ AddEventListenerOptions, EventListenerOptions, EventTargetMethods,
+};
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::codegen::UnionTypes::{
+ AddEventListenerOptionsOrBoolean, EventListenerOptionsOrBoolean, EventOrString,
+};
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
@@ -34,25 +55,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::Window;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::realms::{enter_realm, InRealm};
-use deny_public_fields::DenyPublicFields;
-use dom_struct::dom_struct;
-use fnv::FnvHasher;
-use js::jsapi::JS_GetFunctionObject;
-use js::rust::transform_u16_to_source_text;
-use js::rust::wrappers::CompileFunction;
-use js::rust::{CompileOptionsWrapper, HandleObject, RootedObjectVectorWrapper};
-use libc::c_char;
-use servo_atoms::Atom;
-use servo_url::ServoUrl;
-use std::collections::hash_map::Entry::{Occupied, Vacant};
-use std::default::Default;
-use std::ffi::CString;
-use std::hash::BuildHasherDefault;
-use std::mem;
-use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
-
-use super::bindings::trace::HashMapTracedValues;
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
pub enum CommonEventHandler {
diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs
index 2ba241a8b8a..fa9a570be83 100644
--- a/components/script/dom/extendableevent.rs
+++ b/components/script/dom/extendableevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
use crate::dom::bindings::codegen::Bindings::ExtendableEventBinding;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -12,9 +16,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
// https://w3c.github.io/ServiceWorker/#extendable-event
#[dom_struct]
diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs
index 8c5812f9d91..892769bf14b 100644
--- a/components/script/dom/extendablemessageevent.rs
+++ b/components/script/dom/extendablemessageevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ExtendableMessageEventBinding;
use crate::dom::bindings::codegen::Bindings::ExtendableMessageEventBinding::ExtendableMessageEventMethods;
@@ -19,11 +25,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::messageport::MessagePort;
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
#[dom_struct]
#[allow(non_snake_case)]
diff --git a/components/script/dom/fakexrdevice.rs b/components/script/dom/fakexrdevice.rs
index a1905965bc3..17d3a192fc3 100644
--- a/components/script/dom/fakexrdevice.rs
+++ b/components/script/dom/fakexrdevice.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use euclid::{Point2D, Point3D, Rect, RigidTransform3D, Rotation3D, Size2D, Transform3D, Vector3D};
+use ipc_channel::ipc::IpcSender;
+use ipc_channel::router::ROUTER;
+use profile_traits::ipc;
+use webxr_api::{
+ EntityType, Handedness, InputId, InputSource, MockDeviceMsg, MockInputInit, MockRegion,
+ MockViewInit, MockViewsInit, MockWorld, TargetRayMode, Triangle, Visibility,
+};
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::FakeXRDeviceBinding::{
FakeXRDeviceMethods, FakeXRRegionType, FakeXRRigidTransformInit, FakeXRViewInit,
@@ -21,18 +34,6 @@ use crate::dom::fakexrinputcontroller::FakeXRInputController;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use euclid::{Point2D, Rect, Size2D};
-use euclid::{Point3D, RigidTransform3D, Rotation3D, Transform3D, Vector3D};
-use ipc_channel::ipc::IpcSender;
-use ipc_channel::router::ROUTER;
-use profile_traits::ipc;
-use std::cell::Cell;
-use std::rc::Rc;
-use webxr_api::{
- EntityType, Handedness, InputId, InputSource, MockDeviceMsg, MockInputInit, MockRegion,
- MockViewInit, MockViewsInit, MockWorld, TargetRayMode, Triangle, Visibility,
-};
#[dom_struct]
pub struct FakeXRDevice {
diff --git a/components/script/dom/fakexrinputcontroller.rs b/components/script/dom/fakexrinputcontroller.rs
index 047729b96f6..bdeaefb450f 100644
--- a/components/script/dom/fakexrinputcontroller.rs
+++ b/components/script/dom/fakexrinputcontroller.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use webxr_api::{
+ Handedness, InputId, MockDeviceMsg, MockInputMsg, SelectEvent, SelectKind, TargetRayMode,
+};
+
use crate::dom::bindings::codegen::Bindings::FakeXRDeviceBinding::FakeXRRigidTransformInit;
use crate::dom::bindings::codegen::Bindings::FakeXRInputControllerBinding::FakeXRInputControllerMethods;
use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{
@@ -13,11 +19,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::fakexrdevice::get_origin;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use webxr_api::{
- Handedness, InputId, MockDeviceMsg, MockInputMsg, SelectEvent, SelectKind, TargetRayMode,
-};
#[dom_struct]
pub struct FakeXRInputController {
diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs
index 53ca5fafb02..2e041e2112c 100644
--- a/components/script/dom/file.rs
+++ b/components/script/dom/file.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use net_traits::filemanager_thread::SelectedFile;
+use script_traits::serializable::BlobImpl;
+
use crate::dom::bindings::codegen::Bindings::FileBinding;
use crate::dom::bindings::codegen::Bindings::FileBinding::FileMethods;
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString;
@@ -13,10 +18,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::blob::{blob_parts_to_bytes, normalize_type_string, Blob};
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use net_traits::filemanager_thread::SelectedFile;
-use script_traits::serializable::BlobImpl;
#[dom_struct]
pub struct File {
diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs
index de83ccb9db6..6b26bf2d722 100644
--- a/components/script/dom/filelist.rs
+++ b/components/script/dom/filelist.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 https://mozilla.org/MPL/2.0/. */
+use std::slice::Iter;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::FileListBinding::FileListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::file::File;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::slice::Iter;
// https://w3c.github.io/FileAPI/#dfn-filelist
#[dom_struct]
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index 5e0740c557f..37add7d61f4 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::ptr;
+
+use base64::Engine;
+use dom_struct::dom_struct;
+use encoding_rs::{Encoding, UTF_8};
+use js::jsapi::{Heap, JSObject};
+use js::jsval::{self, JSVal};
+use js::rust::HandleObject;
+use js::typedarray::{ArrayBuffer, CreateWith};
+use mime::{self, Mime};
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{
@@ -25,18 +38,6 @@ use crate::realms::enter_realm;
use crate::script_runtime::JSContext;
use crate::task_source::file_reading::FileReadingTask;
use crate::task_source::{TaskSource, TaskSourceName};
-use base64::Engine;
-use dom_struct::dom_struct;
-use encoding_rs::{Encoding, UTF_8};
-use js::jsapi::Heap;
-use js::jsapi::JSObject;
-use js::jsval::{self, JSVal};
-use js::rust::HandleObject;
-use js::typedarray::{ArrayBuffer, CreateWith};
-use mime::{self, Mime};
-use servo_atoms::Atom;
-use std::cell::Cell;
-use std::ptr;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub enum FileReaderFunction {
diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs
index a2f375ef80a..b8700173177 100644
--- a/components/script/dom/filereadersync.rs
+++ b/components/script/dom/filereadersync.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr;
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use js::typedarray::{ArrayBuffer, CreateWith};
+
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::FileReaderSyncMethods;
use crate::dom::bindings::error::{Error, Fallible};
@@ -12,12 +20,6 @@ use crate::dom::blob::Blob;
use crate::dom::filereader::FileReaderSharedFunctionality;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use js::typedarray::{ArrayBuffer, CreateWith};
-use std::ptr;
-use std::ptr::NonNull;
#[dom_struct]
pub struct FileReaderSync {
diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs
index d980ea6ed49..cb064b3fb1e 100644
--- a/components/script/dom/focusevent.rs
+++ b/components/script/dom/focusevent.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::FocusEventBinding;
use crate::dom::bindings::codegen::Bindings::FocusEventBinding::FocusEventMethods;
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
@@ -14,9 +19,6 @@ use crate::dom::event::{EventBubbles, EventCancelable};
use crate::dom::eventtarget::EventTarget;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::default::Default;
#[dom_struct]
pub struct FocusEvent {
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index aa889522f5e..f0283695825 100644
--- a/components/script/dom/formdata.rs
+++ b/components/script/dom/formdata.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::LocalName;
+use js::rust::HandleObject;
+use script_traits::serializable::BlobImpl;
+
+use super::bindings::trace::NoTrace;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods;
use crate::dom::bindings::codegen::UnionTypes::FileOrUSVString;
@@ -15,12 +21,6 @@ use crate::dom::blob::Blob;
use crate::dom::file::File;
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlformelement::{FormDatum, FormDatumValue, HTMLFormElement};
-use dom_struct::dom_struct;
-use html5ever::LocalName;
-use js::rust::HandleObject;
-use script_traits::serializable::BlobImpl;
-
-use super::bindings::trace::NoTrace;
#[dom_struct]
pub struct FormData {
diff --git a/components/script/dom/formdataevent.rs b/components/script/dom/formdataevent.rs
index 1b78bd1af9c..6a3317a9092 100644
--- a/components/script/dom/formdataevent.rs
+++ b/components/script/dom/formdataevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::FormDataEventBinding;
use crate::dom::bindings::codegen::Bindings::FormDataEventBinding::FormDataEventMethods;
@@ -10,14 +14,10 @@ use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
-use crate::dom::event::Event;
-use crate::dom::event::{EventBubbles, EventCancelable};
+use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::formdata::FormData;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct FormDataEvent {
diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs
index f5d8a8f793f..5bcb5cdff6f 100644
--- a/components/script/dom/gainnode.rs
+++ b/components/script/dom/gainnode.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::gain_node::GainNodeOptions;
+use servo_media::audio::node::AudioNodeInit;
+use servo_media::audio::param::ParamType;
+
use crate::dom::audionode::AudioNode;
use crate::dom::audioparam::AudioParam;
use crate::dom::baseaudiocontext::BaseAudioContext;
@@ -14,12 +22,6 @@ use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::gain_node::GainNodeOptions;
-use servo_media::audio::node::AudioNodeInit;
-use servo_media::audio::param::ParamType;
-use std::f32;
#[dom_struct]
pub struct GainNode {
diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs
index b81d6a7b228..e24f0848222 100644
--- a/components/script/dom/gamepad.rs
+++ b/components/script/dom/gamepad.rs
@@ -2,8 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::GamepadBinding::GamepadHand;
-use crate::dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods;
+use std::cell::Cell;
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+
+use crate::dom::bindings::codegen::Bindings::GamepadBinding::{GamepadHand, GamepadMethods};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{DomObject, Reflector};
@@ -15,10 +20,6 @@ use crate::dom::gamepadbuttonlist::GamepadButtonList;
use crate::dom::gamepadevent::{GamepadEvent, GamepadEventType};
use crate::dom::gamepadpose::GamepadPose;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use std::cell::Cell;
-use std::ptr::NonNull;
#[dom_struct]
pub struct Gamepad {
diff --git a/components/script/dom/gamepadbutton.rs b/components/script/dom/gamepadbutton.rs
index e40e7fb4f05..a739dbebcf4 100644
--- a/components/script/dom/gamepadbutton.rs
+++ b/components/script/dom/gamepadbutton.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 https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::GamepadButtonBinding::GamepadButtonMethods;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct GamepadButton {
diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs
index 4d9e86c45ef..07bf5118f51 100644
--- a/components/script/dom/gamepadbuttonlist.rs
+++ b/components/script/dom/gamepadbuttonlist.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::gamepadbutton::GamepadButton;
-use dom_struct::dom_struct;
// https://w3c.github.io/gamepad/#gamepadbutton-interface
#[dom_struct]
diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs
index ec6da6ba302..b71e9e01871 100644
--- a/components/script/dom/gamepadevent.rs
+++ b/components/script/dom/gamepadevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::GamepadEventBinding;
use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods;
@@ -14,9 +18,6 @@ use crate::dom::event::Event;
use crate::dom::gamepad::Gamepad;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct GamepadEvent {
diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs
index ed551df4c35..d293281389b 100644
--- a/components/script/dom/gamepadlist.rs
+++ b/components/script/dom/gamepadlist.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods;
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;
-use dom_struct::dom_struct;
// https://www.w3.org/TR/gamepad/
#[dom_struct]
diff --git a/components/script/dom/gamepadpose.rs b/components/script/dom/gamepadpose.rs
index 10d770ea68a..073a326dc0a 100644
--- a/components/script/dom/gamepadpose.rs
+++ b/components/script/dom/gamepadpose.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 https://mozilla.org/MPL/2.0/. */
+use std::ptr;
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+use js::typedarray::{CreateWith, Float32Array};
+
use crate::dom::bindings::codegen::Bindings::GamepadPoseBinding::GamepadPoseMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use js::typedarray::{CreateWith, Float32Array};
-use std::ptr;
-use std::ptr::NonNull;
#[dom_struct]
pub struct GamepadPose {
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index 2ac4aacd70f..be59afbf437 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -2,6 +2,64 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::collections::hash_map::Entry;
+use std::collections::{HashMap, VecDeque};
+use std::ops::Index;
+use std::rc::Rc;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+use std::thread::JoinHandle;
+use std::{mem, ptr};
+
+use content_security_policy::CspList;
+use crossbeam_channel::Sender;
+use devtools_traits::{PageError, ScriptToDevtoolsControlMsg};
+use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
+use ipc_channel::ipc::{self, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::glue::{IsWrapper, UnwrapObjectDynamic};
+use js::jsapi::{
+ Compile1, CurrentGlobalOrNull, GetNonCCWObjectGlobal, HandleObject, Heap,
+ InstantiateGlobalStencil, InstantiateOptions, JSContext, JSObject, JSScript, SetScriptPrivate,
+};
+use js::jsval::{JSVal, PrivateValue, UndefinedValue};
+use js::panic::maybe_resume_unwind;
+use js::rust::wrappers::{JS_ExecuteScript, JS_GetScriptPrivate};
+use js::rust::{
+ get_object_class, transform_str_to_source_text, CompileOptionsWrapper, HandleValue,
+ MutableHandleValue, ParentRuntime, Runtime,
+};
+use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
+use msg::constellation_msg::{
+ BlobId, BroadcastChannelRouterId, MessagePortId, MessagePortRouterId, PipelineId,
+ ServiceWorkerId, ServiceWorkerRegistrationId,
+};
+use net_traits::blob_url_store::{get_blob_origin, BlobBuf};
+use net_traits::filemanager_thread::{
+ FileManagerResult, FileManagerThreadMsg, ReadFileProgress, RelativePos,
+};
+use net_traits::image_cache::ImageCache;
+use net_traits::request::Referrer;
+use net_traits::response::HttpsState;
+use net_traits::{CoreResourceMsg, CoreResourceThread, IpcSend, ResourceThreads};
+use parking_lot::Mutex;
+use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time};
+use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
+use script_traits::transferable::MessagePortImpl;
+use script_traits::{
+ BroadcastMsg, MessagePortMsg, MsDuration, PortMessageTask, ScriptMsg,
+ ScriptToConstellationChan, TimerEvent, TimerEventId, TimerSchedulerMsg, TimerSource,
+};
+use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
+use time::{get_time, Timespec};
+use uuid::Uuid;
+use webgpu::identity::WebGPUOpResult;
+use webgpu::{ErrorScopeId, WebGPUDevice};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::cell::{DomRefCell, RefMut};
use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods;
use crate::dom::bindings::codegen::Bindings::EventSourceBinding::EventSourceBinding::EventSourceMethods;
@@ -52,8 +110,7 @@ use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::dom::workletglobalscope::WorkletGlobalScope;
use crate::microtask::{Microtask, MicrotaskQueue, UserMicrotask};
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
-use crate::script_module::{DynamicModuleList, ModuleTree};
-use crate::script_module::{ModuleScript, ScriptFetchOptions};
+use crate::script_module::{DynamicModuleList, ModuleScript, ModuleTree, ScriptFetchOptions};
use crate::script_runtime::{
CommonScriptMsg, ContextForRequestInterrupt, JSContext as SafeJSContext, ScriptChan, ScriptPort,
};
@@ -67,69 +124,10 @@ use crate::task_source::port_message::PortMessageQueue;
use crate::task_source::remote_event::RemoteEventTaskSource;
use crate::task_source::timer::TimerTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
-use crate::task_source::TaskSource;
-use crate::task_source::TaskSourceName;
-use crate::timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle};
-use crate::timers::{OneshotTimers, TimerCallback};
-use content_security_policy::CspList;
-use crossbeam_channel::Sender;
-use devtools_traits::{PageError, ScriptToDevtoolsControlMsg};
-use dom_struct::dom_struct;
-use embedder_traits::EmbedderMsg;
-use ipc_channel::ipc::{self, IpcSender};
-use ipc_channel::router::ROUTER;
-use js::glue::{IsWrapper, UnwrapObjectDynamic};
-use js::jsapi::Compile1;
-use js::jsapi::SetScriptPrivate;
-use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal};
-use js::jsapi::{HandleObject, Heap, InstantiateGlobalStencil, InstantiateOptions};
-use js::jsapi::{JSContext, JSObject, JSScript};
-use js::jsval::PrivateValue;
-use js::jsval::{JSVal, UndefinedValue};
-use js::panic::maybe_resume_unwind;
-use js::rust::transform_str_to_source_text;
-use js::rust::wrappers::{JS_ExecuteScript, JS_GetScriptPrivate};
-use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
-use js::rust::{HandleValue, MutableHandleValue};
-use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
-use msg::constellation_msg::{
- BlobId, BroadcastChannelRouterId, MessagePortId, MessagePortRouterId, PipelineId,
- ServiceWorkerId, ServiceWorkerRegistrationId,
+use crate::task_source::{TaskSource, TaskSourceName};
+use crate::timers::{
+ IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers, TimerCallback,
};
-use net_traits::blob_url_store::{get_blob_origin, BlobBuf};
-use net_traits::filemanager_thread::{
- FileManagerResult, FileManagerThreadMsg, ReadFileProgress, RelativePos,
-};
-use net_traits::image_cache::ImageCache;
-use net_traits::request::Referrer;
-use net_traits::response::HttpsState;
-use net_traits::{CoreResourceMsg, CoreResourceThread, IpcSend, ResourceThreads};
-use parking_lot::Mutex;
-use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time};
-use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
-use script_traits::transferable::MessagePortImpl;
-use script_traits::{
- BroadcastMsg, MessagePortMsg, MsDuration, PortMessageTask, ScriptMsg,
- ScriptToConstellationChan, TimerEvent,
-};
-use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
-use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::collections::hash_map::Entry;
-use std::collections::{HashMap, VecDeque};
-use std::mem;
-use std::ops::Index;
-use std::ptr;
-use std::rc::Rc;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use std::thread::JoinHandle;
-use time::{get_time, Timespec};
-use uuid::Uuid;
-use webgpu::{identity::WebGPUOpResult, ErrorScopeId, WebGPUDevice};
-
-use super::bindings::trace::HashMapTracedValues;
#[derive(JSTraceable)]
pub struct AutoCloseWorker {
diff --git a/components/script/dom/gpu.rs b/components/script/dom/gpu.rs
index 11f98909abe..0785ec47171 100644
--- a/components/script/dom/gpu.rs
+++ b/components/script/dom/gpu.rs
@@ -2,8 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::GPUBinding::GPURequestAdapterOptions;
-use crate::dom::bindings::codegen::Bindings::GPUBinding::{GPUMethods, GPUPowerPreference};
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc::{self, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::jsapi::Heap;
+use script_traits::ScriptMsg;
+use webgpu::wgt::PowerPreference;
+use webgpu::{wgpu, WebGPUResponse, WebGPUResponseResult};
+
+use super::bindings::codegen::Bindings::GPUTextureBinding::GPUTextureFormat;
+use crate::dom::bindings::codegen::Bindings::GPUBinding::{
+ GPUMethods, GPUPowerPreference, GPURequestAdapterOptions,
+};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
@@ -14,16 +26,6 @@ use crate::dom::gpuadapter::GPUAdapter;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
use crate::task_source::{TaskSource, TaskSourceName};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::{self, IpcSender};
-use ipc_channel::router::ROUTER;
-use js::jsapi::Heap;
-use script_traits::ScriptMsg;
-use std::rc::Rc;
-use webgpu::wgt::PowerPreference;
-use webgpu::{wgpu, WebGPUResponse, WebGPUResponseResult};
-
-use super::bindings::codegen::Bindings::GPUTextureBinding::GPUTextureFormat;
#[dom_struct]
pub struct GPU {
diff --git a/components/script/dom/gpuadapter.rs b/components/script/dom/gpuadapter.rs
index db5be259375..ae0eb83b397 100644
--- a/components/script/dom/gpuadapter.rs
+++ b/components/script/dom/gpuadapter.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::convert::TryFrom;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+use webgpu::{wgt, WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse, WebGPUResponseResult};
+
+use super::types::{GPUAdapterInfo, GPUSupportedLimits};
use crate::dom::bindings::codegen::Bindings::GPUAdapterBinding::{
GPUAdapterMethods, GPUDeviceDescriptor, GPUFeatureName,
};
@@ -10,18 +18,10 @@ 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 crate::dom::gpu::response_async;
-use crate::dom::gpu::AsyncWGPUListener;
+use crate::dom::gpu::{response_async, AsyncWGPUListener};
use crate::dom::gpudevice::GPUDevice;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use std::convert::TryFrom;
-use std::rc::Rc;
-use webgpu::{wgt, WebGPU, WebGPUAdapter, WebGPURequest, WebGPUResponse, WebGPUResponseResult};
-
-use super::types::{GPUAdapterInfo, GPUSupportedLimits};
#[dom_struct]
pub struct GPUAdapter {
diff --git a/components/script/dom/gpuadapterinfo.rs b/components/script/dom/gpuadapterinfo.rs
index b3fe29b10fa..01f878cc66a 100644
--- a/components/script/dom/gpuadapterinfo.rs
+++ b/components/script/dom/gpuadapterinfo.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::wgt::AdapterInfo;
+
use super::bindings::codegen::Bindings::GPUAdapterInfoBinding::GPUAdapterInfoMethods;
use super::bindings::reflector::reflect_dom_object;
use super::bindings::root::DomRoot;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::globalscope::GlobalScope;
use crate::test::DOMString;
-use dom_struct::dom_struct;
-use webgpu::wgt::AdapterInfo;
#[dom_struct]
pub struct GPUAdapterInfo {
diff --git a/components/script/dom/gpubindgroup.rs b/components/script/dom/gpubindgroup.rs
index 41f20999175..4b835c86049 100644
--- a/components/script/dom/gpubindgroup.rs
+++ b/components/script/dom/gpubindgroup.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::{WebGPUBindGroup, WebGPUDevice};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBindGroupBinding::GPUBindGroupMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,8 +12,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
-use dom_struct::dom_struct;
-use webgpu::{WebGPUBindGroup, WebGPUDevice};
#[dom_struct]
pub struct GPUBindGroup {
diff --git a/components/script/dom/gpubindgrouplayout.rs b/components/script/dom/gpubindgrouplayout.rs
index 89862358211..b9bc483450d 100644
--- a/components/script/dom/gpubindgrouplayout.rs
+++ b/components/script/dom/gpubindgrouplayout.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::WebGPUBindGroupLayout;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBindGroupLayoutBinding::GPUBindGroupLayoutMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::WebGPUBindGroupLayout;
#[dom_struct]
pub struct GPUBindGroupLayout {
diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs
index b1789405fa3..f57faac9ab6 100644
--- a/components/script/dom/gpubuffer.rs
+++ b/components/script/dom/gpubuffer.rs
@@ -2,6 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::{Cell, RefCell};
+use std::ffi::c_void;
+use std::ops::Range;
+use std::ptr::NonNull;
+use std::rc::Rc;
+use std::string::String;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSharedMemory;
+use js::jsapi::{DetachArrayBuffer, Heap, JSObject, NewExternalArrayBuffer};
+use webgpu::identity::WebGPUOpResult;
+use webgpu::wgpu::device::HostMap;
+use webgpu::{WebGPU, WebGPUBuffer, WebGPURequest, WebGPUResponse, WebGPUResponseResult};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBufferBinding::{GPUBufferMethods, GPUSize64};
use crate::dom::bindings::codegen::Bindings::GPUMapModeBinding::GPUMapModeConstants;
@@ -15,21 +29,6 @@ use crate::dom::gpudevice::GPUDevice;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSharedMemory;
-use js::jsapi::DetachArrayBuffer;
-use js::jsapi::NewExternalArrayBuffer;
-use js::jsapi::{Heap, JSObject};
-use std::cell::{Cell, RefCell};
-use std::ffi::c_void;
-use std::ops::Range;
-use std::ptr::NonNull;
-use std::rc::Rc;
-use std::string::String;
-use webgpu::{
- identity::WebGPUOpResult, wgpu::device::HostMap, WebGPU, WebGPUBuffer, WebGPURequest,
- WebGPUResponse, WebGPUResponseResult,
-};
const RANGE_OFFSET_ALIGN_MASK: u64 = 8;
const RANGE_SIZE_ALIGN_MASK: u64 = 4;
diff --git a/components/script/dom/gpubufferusage.rs b/components/script/dom/gpubufferusage.rs
index 9b3a97d26fd..b35768d25d5 100644
--- a/components/script/dom/gpubufferusage.rs
+++ b/components/script/dom/gpubufferusage.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
+use crate::dom::bindings::reflector::Reflector;
+
#[dom_struct]
pub struct GPUBufferUsage {
reflector_: Reflector,
diff --git a/components/script/dom/gpucanvascontext.rs b/components/script/dom/gpucanvascontext.rs
index 121a84f6473..a91f0f5a9bd 100644
--- a/components/script/dom/gpucanvascontext.rs
+++ b/components/script/dom/gpucanvascontext.rs
@@ -2,29 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::GPUCanvasContextBinding::{
- GPUCanvasConfiguration, GPUCanvasContextMethods,
-};
-use crate::dom::bindings::codegen::Bindings::GPUDeviceBinding::GPUDeviceBinding::GPUDeviceMethods;
-use crate::dom::bindings::codegen::Bindings::GPUObjectBaseBinding::GPUObjectDescriptorBase;
-use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::{
- GPUExtent3D, GPUExtent3DDict, GPUTextureDescriptor, GPUTextureDimension, GPUTextureFormat,
-};
-use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementBinding::HTMLCanvasElementMethods;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
-use crate::dom::bindings::root::{DomRoot, LayoutDom};
-use crate::dom::globalscope::GlobalScope;
-use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
-use crate::dom::node::{document_from_node, Node, NodeDamage};
+use std::cell::Cell;
+
use arrayvec::ArrayVec;
use dom_struct::dom_struct;
use euclid::default::Size2D;
use ipc_channel::ipc;
use script_layout_interface::HTMLCanvasDataSource;
-use std::cell::Cell;
-use webgpu::WebGPUTexture;
-use webgpu::{wgpu::id, wgt, WebGPU, WebGPURequest, PRESENTATION_BUFFER_COUNT};
+use webgpu::wgpu::id;
+use webgpu::{wgt, WebGPU, WebGPURequest, WebGPUTexture, PRESENTATION_BUFFER_COUNT};
use webrender_api::{
units, ExternalImageData, ExternalImageId, ExternalImageType, ImageData, ImageDescriptor,
ImageDescriptorFlags, ImageFormat, ImageKey,
@@ -35,6 +21,21 @@ use super::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
use super::bindings::error::{Error, Fallible};
use super::bindings::root::MutNullableDom;
use super::gputexture::GPUTexture;
+use crate::dom::bindings::codegen::Bindings::GPUCanvasContextBinding::{
+ GPUCanvasConfiguration, GPUCanvasContextMethods,
+};
+use crate::dom::bindings::codegen::Bindings::GPUDeviceBinding::GPUDeviceBinding::GPUDeviceMethods;
+use crate::dom::bindings::codegen::Bindings::GPUObjectBaseBinding::GPUObjectDescriptorBase;
+use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::{
+ GPUExtent3D, GPUExtent3DDict, GPUTextureDescriptor, GPUTextureDimension, GPUTextureFormat,
+};
+use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementBinding::HTMLCanvasElementMethods;
+use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
+use crate::dom::bindings::root::{DomRoot, LayoutDom};
+use crate::dom::globalscope::GlobalScope;
+use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
+use crate::dom::node::{document_from_node, Node, NodeDamage};
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct WebGPUContextId(pub u64);
diff --git a/components/script/dom/gpucolorwrite.rs b/components/script/dom/gpucolorwrite.rs
index c34799d9982..29e19826342 100644
--- a/components/script/dom/gpucolorwrite.rs
+++ b/components/script/dom/gpucolorwrite.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
+use crate::dom::bindings::reflector::Reflector;
+
#[dom_struct]
pub struct GPUColorWrite {
reflector_: Reflector,
diff --git a/components/script/dom/gpucommandbuffer.rs b/components/script/dom/gpucommandbuffer.rs
index babaf3cb089..32bc4fee487 100644
--- a/components/script/dom/gpucommandbuffer.rs
+++ b/components/script/dom/gpucommandbuffer.rs
@@ -2,18 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashSet;
+use std::hash::{Hash, Hasher};
+
+use dom_struct::dom_struct;
+use webgpu::{WebGPU, WebGPUCommandBuffer, WebGPURequest};
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::GPUCommandBufferBinding::GPUCommandBufferMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubuffer::GPUBuffer;
-use dom_struct::dom_struct;
-use std::collections::HashSet;
-use std::hash::{Hash, Hasher};
-use webgpu::{WebGPU, WebGPUCommandBuffer, WebGPURequest};
impl Eq for DomRoot<GPUBuffer> {}
impl Hash for DomRoot<GPUBuffer> {
diff --git a/components/script/dom/gpucommandencoder.rs b/components/script/dom/gpucommandencoder.rs
index 4e7102eec69..be8dbe73803 100644
--- a/components/script/dom/gpucommandencoder.rs
+++ b/components/script/dom/gpucommandencoder.rs
@@ -2,6 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::collections::HashSet;
+
+use dom_struct::dom_struct;
+use webgpu::wgpu::command as wgpu_com;
+use webgpu::{self, wgt, WebGPU, WebGPURequest};
+
+use super::bindings::codegen::Bindings::GPUCommandBufferBinding::GPUCommandBufferDescriptor;
+use super::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
+ GPUImageCopyBuffer, GPUImageCopyTexture, GPUImageDataLayout, GPULoadOp,
+};
+use super::bindings::codegen::Bindings::GPUTextureViewBinding::GPUTextureAspect;
+use super::bindings::codegen::UnionTypes::DoubleSequenceOrGPUColorDict;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBufferBinding::GPUSize64;
use crate::dom::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
@@ -10,8 +24,7 @@ use crate::dom::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
};
use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::GPUExtent3D;
use crate::dom::bindings::num::Finite;
-use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
@@ -20,19 +33,6 @@ use crate::dom::gpucommandbuffer::GPUCommandBuffer;
use crate::dom::gpucomputepassencoder::GPUComputePassEncoder;
use crate::dom::gpudevice::{convert_texture_size_to_dict, convert_texture_size_to_wgt, GPUDevice};
use crate::dom::gpurenderpassencoder::GPURenderPassEncoder;
-use dom_struct::dom_struct;
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::collections::HashSet;
-use webgpu::wgpu::command as wgpu_com;
-use webgpu::{self, wgt, WebGPU, WebGPURequest};
-
-use super::bindings::codegen::Bindings::GPUCommandBufferBinding::GPUCommandBufferDescriptor;
-use super::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
- GPUImageCopyBuffer, GPUImageCopyTexture, GPUImageDataLayout, GPULoadOp,
-};
-use super::bindings::codegen::Bindings::GPUTextureViewBinding::GPUTextureAspect;
-use super::bindings::codegen::UnionTypes::DoubleSequenceOrGPUColorDict;
// TODO(sagudev): this is different now
// https://gpuweb.github.io/gpuweb/#enumdef-encoder-state
diff --git a/components/script/dom/gpucompilationinfo.rs b/components/script/dom/gpucompilationinfo.rs
index e7cbb705b31..9e8d69df9c2 100644
--- a/components/script/dom/gpucompilationinfo.rs
+++ b/components/script/dom/gpucompilationinfo.rs
@@ -2,15 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
-use crate::script_runtime::JSContext;
use dom_struct::dom_struct;
-
use js::jsval::JSVal;
use super::bindings::codegen::Bindings::GPUCompilationInfoBinding::GPUCompilationInfoMethods;
use super::bindings::root::Dom;
use super::types::GPUCompilationMessage;
+use crate::dom::bindings::reflector::Reflector;
+use crate::script_runtime::JSContext;
#[dom_struct]
pub struct GPUCompilationInfo {
diff --git a/components/script/dom/gpucompilationmessage.rs b/components/script/dom/gpucompilationmessage.rs
index 83912e43ee1..5dab738439f 100644
--- a/components/script/dom/gpucompilationmessage.rs
+++ b/components/script/dom/gpucompilationmessage.rs
@@ -4,8 +4,6 @@
#![allow(dead_code)] // this file is stub as wgpu does not provide info
-use crate::dom::bindings::reflector::Reflector;
-use crate::test::DOMString;
use dom_struct::dom_struct;
use super::bindings::codegen::Bindings::GPUCompilationMessageBinding::{
@@ -13,7 +11,8 @@ use super::bindings::codegen::Bindings::GPUCompilationMessageBinding::{
};
use super::bindings::root::DomRoot;
use super::types::GlobalScope;
-use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::test::DOMString;
#[dom_struct]
pub struct GPUCompilationMessage {
diff --git a/components/script/dom/gpucomputepassencoder.rs b/components/script/dom/gpucomputepassencoder.rs
index e3b9383cfeb..e58193bcf40 100644
--- a/components/script/dom/gpucomputepassencoder.rs
+++ b/components/script/dom/gpucomputepassencoder.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::wgpu::command::{compute_ffi as wgpu_comp, ComputePass};
+use webgpu::{WebGPU, WebGPURequest};
+
+use super::bindings::error::Fallible;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUComputePassEncoderBinding::GPUComputePassEncoderMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -12,13 +17,6 @@ use crate::dom::gpubindgroup::GPUBindGroup;
use crate::dom::gpubuffer::GPUBuffer;
use crate::dom::gpucommandencoder::{GPUCommandEncoder, GPUCommandEncoderState};
use crate::dom::gpucomputepipeline::GPUComputePipeline;
-use dom_struct::dom_struct;
-use webgpu::{
- wgpu::command::{compute_ffi as wgpu_comp, ComputePass},
- WebGPU, WebGPURequest,
-};
-
-use super::bindings::error::Fallible;
#[dom_struct]
pub struct GPUComputePassEncoder {
diff --git a/components/script/dom/gpucomputepipeline.rs b/components/script/dom/gpucomputepipeline.rs
index 518e826a4af..2795e6fa253 100644
--- a/components/script/dom/gpucomputepipeline.rs
+++ b/components/script/dom/gpucomputepipeline.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::string::String;
+
+use dom_struct::dom_struct;
+use webgpu::{WebGPUBindGroupLayout, WebGPUComputePipeline};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUComputePipelineBinding::GPUComputePipelineMethods;
use crate::dom::bindings::error::{Error, Fallible};
@@ -11,9 +16,6 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::gpudevice::GPUDevice;
-use dom_struct::dom_struct;
-use std::string::String;
-use webgpu::{WebGPUBindGroupLayout, WebGPUComputePipeline};
#[dom_struct]
pub struct GPUComputePipeline {
diff --git a/components/script/dom/gpudevice.rs b/components/script/dom/gpudevice.rs
index 4668871a755..2678ad4fb3b 100644
--- a/components/script/dom/gpudevice.rs
+++ b/components/script/dom/gpudevice.rs
@@ -4,6 +4,32 @@
#![allow(unsafe_code)]
+use std::borrow::Cow;
+use std::cell::{Cell, RefCell};
+use std::collections::HashMap;
+use std::num::NonZeroU64;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+use webgpu::identity::WebGPUOpResult;
+use webgpu::wgpu::id::{BindGroupLayoutId, PipelineLayoutId};
+use webgpu::wgpu::{
+ binding_model as wgpu_bind, command as wgpu_com, pipeline as wgpu_pipe, resource as wgpu_res,
+};
+use webgpu::{self, wgt, ErrorScopeId, WebGPU, WebGPURequest};
+
+use super::bindings::codegen::Bindings::GPUBindGroupLayoutBinding::{
+ GPUBufferBindingType, GPUSamplerBindingType, GPUStorageTextureAccess, GPUTextureSampleType,
+};
+use super::bindings::codegen::Bindings::GPUDeviceLostInfoBinding::GPUDeviceLostReason;
+use super::bindings::codegen::Bindings::GPURenderPipelineBinding::{
+ GPUBlendComponent, GPUPrimitiveState, GPUVertexStepMode,
+};
+use super::bindings::codegen::UnionTypes::GPUPipelineLayoutOrGPUAutoLayoutMode;
+use super::bindings::error::Fallible;
+use super::gpudevicelostinfo::GPUDeviceLostInfo;
+use super::gpusupportedlimits::GPUSupportedLimits;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventInit;
use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods;
@@ -61,31 +87,6 @@ use crate::dom::gpuuncapturederrorevent::GPUUncapturedErrorEvent;
use crate::dom::gpuvalidationerror::GPUValidationError;
use crate::dom::promise::Promise;
use crate::realms::InRealm;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use std::borrow::Cow;
-use std::cell::{Cell, RefCell};
-use std::collections::HashMap;
-use std::num::NonZeroU64;
-use std::rc::Rc;
-use webgpu::wgpu::{
- binding_model as wgpu_bind, command as wgpu_com,
- id::{BindGroupLayoutId, PipelineLayoutId},
- pipeline as wgpu_pipe, resource as wgpu_res,
-};
-use webgpu::{self, identity::WebGPUOpResult, wgt, ErrorScopeId, WebGPU, WebGPURequest};
-
-use super::bindings::codegen::Bindings::GPUBindGroupLayoutBinding::{
- GPUBufferBindingType, GPUSamplerBindingType, GPUStorageTextureAccess, GPUTextureSampleType,
-};
-use super::bindings::codegen::Bindings::GPUDeviceLostInfoBinding::GPUDeviceLostReason;
-use super::bindings::codegen::Bindings::GPURenderPipelineBinding::{
- GPUBlendComponent, GPUPrimitiveState, GPUVertexStepMode,
-};
-use super::bindings::codegen::UnionTypes::GPUPipelineLayoutOrGPUAutoLayoutMode;
-use super::bindings::error::Fallible;
-use super::gpudevicelostinfo::GPUDeviceLostInfo;
-use super::gpusupportedlimits::GPUSupportedLimits;
#[derive(JSTraceable, MallocSizeOf)]
struct ErrorScopeInfo {
diff --git a/components/script/dom/gpudevicelostinfo.rs b/components/script/dom/gpudevicelostinfo.rs
index 40915bd1ebd..98dcc85d62f 100644
--- a/components/script/dom/gpudevicelostinfo.rs
+++ b/components/script/dom/gpudevicelostinfo.rs
@@ -4,14 +4,14 @@
#![allow(dead_code)]
+use dom_struct::dom_struct;
+
+use super::bindings::codegen::Bindings::GPUDeviceLostInfoBinding::GPUDeviceLostReason;
use crate::dom::bindings::codegen::Bindings::GPUDeviceLostInfoBinding::GPUDeviceLostInfoMethods;
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 dom_struct::dom_struct;
-
-use super::bindings::codegen::Bindings::GPUDeviceLostInfoBinding::GPUDeviceLostReason;
#[dom_struct]
pub struct GPUDeviceLostInfo {
diff --git a/components/script/dom/gpumapmode.rs b/components/script/dom/gpumapmode.rs
index b216d3f839d..4db3455483d 100644
--- a/components/script/dom/gpumapmode.rs
+++ b/components/script/dom/gpumapmode.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
+use crate::dom::bindings::reflector::Reflector;
+
#[dom_struct]
pub struct GPUMapMode {
reflector_: Reflector,
diff --git a/components/script/dom/gpuoutofmemoryerror.rs b/components/script/dom/gpuoutofmemoryerror.rs
index c7ba07b1e6e..539cbe59f57 100644
--- a/components/script/dom/gpuoutofmemoryerror.rs
+++ b/components/script/dom/gpuoutofmemoryerror.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct GPUOutOfMemoryError {
diff --git a/components/script/dom/gpupipelinelayout.rs b/components/script/dom/gpupipelinelayout.rs
index 8f8fc550151..88ef939f931 100644
--- a/components/script/dom/gpupipelinelayout.rs
+++ b/components/script/dom/gpupipelinelayout.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::{WebGPUBindGroupLayout, WebGPUPipelineLayout};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUPipelineLayoutBinding::GPUPipelineLayoutMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::{WebGPUBindGroupLayout, WebGPUPipelineLayout};
#[dom_struct]
pub struct GPUPipelineLayout {
diff --git a/components/script/dom/gpuqueryset.rs b/components/script/dom/gpuqueryset.rs
index 097d23ac5ea..e62d0ca4dcb 100644
--- a/components/script/dom/gpuqueryset.rs
+++ b/components/script/dom/gpuqueryset.rs
@@ -4,11 +4,11 @@
#![allow(dead_code)] // this file is stub
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
use super::bindings::codegen::Bindings::GPUQuerySetBinding::GPUQuerySetMethods;
use super::bindings::str::USVString;
+use crate::dom::bindings::reflector::Reflector;
#[dom_struct]
pub struct GPUQuerySet {
diff --git a/components/script/dom/gpuqueue.rs b/components/script/dom/gpuqueue.rs
index 04dee0821eb..3061211f20f 100644
--- a/components/script/dom/gpuqueue.rs
+++ b/components/script/dom/gpuqueue.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSharedMemory;
+use webgpu::identity::WebGPUOpResult;
+use webgpu::{wgt, WebGPU, WebGPUQueue, WebGPURequest};
+
+use super::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
+ GPUImageCopyTexture, GPUImageDataLayout,
+};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBufferBinding::GPUSize64;
use crate::dom::bindings::codegen::Bindings::GPUQueueBinding::GPUQueueMethods;
@@ -16,13 +24,6 @@ use crate::dom::gpubuffer::{GPUBuffer, GPUBufferState};
use crate::dom::gpucommandbuffer::GPUCommandBuffer;
use crate::dom::gpucommandencoder::{convert_ic_texture, convert_image_data_layout};
use crate::dom::gpudevice::{convert_texture_size_to_dict, convert_texture_size_to_wgt, GPUDevice};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSharedMemory;
-use webgpu::{identity::WebGPUOpResult, wgt, WebGPU, WebGPUQueue, WebGPURequest};
-
-use super::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
- GPUImageCopyTexture, GPUImageDataLayout,
-};
#[dom_struct]
pub struct GPUQueue {
diff --git a/components/script/dom/gpurenderbundle.rs b/components/script/dom/gpurenderbundle.rs
index 2b1a742f60e..17f72d41dd8 100644
--- a/components/script/dom/gpurenderbundle.rs
+++ b/components/script/dom/gpurenderbundle.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::{WebGPU, WebGPUDevice, WebGPURenderBundle};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPURenderBundleBinding::GPURenderBundleMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::{WebGPU, WebGPUDevice, WebGPURenderBundle};
#[dom_struct]
pub struct GPURenderBundle {
diff --git a/components/script/dom/gpurenderbundleencoder.rs b/components/script/dom/gpurenderbundleencoder.rs
index 0303a9c76c7..ab6f8aae3a4 100644
--- a/components/script/dom/gpurenderbundleencoder.rs
+++ b/components/script/dom/gpurenderbundleencoder.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::wgpu::command::{bundle_ffi as wgpu_bundle, RenderBundleEncoder};
+use webgpu::{wgt, WebGPU, WebGPURenderBundle, WebGPURequest};
+
+use super::bindings::codegen::Bindings::GPURenderPipelineBinding::GPUIndexFormat;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPURenderBundleBinding::GPURenderBundleDescriptor;
use crate::dom::bindings::codegen::Bindings::GPURenderBundleEncoderBinding::GPURenderBundleEncoderMethods;
@@ -14,13 +19,6 @@ use crate::dom::gpubuffer::GPUBuffer;
use crate::dom::gpudevice::{convert_label, GPUDevice};
use crate::dom::gpurenderbundle::GPURenderBundle;
use crate::dom::gpurenderpipeline::GPURenderPipeline;
-use dom_struct::dom_struct;
-use webgpu::{
- wgpu::command::{bundle_ffi as wgpu_bundle, RenderBundleEncoder},
- wgt, WebGPU, WebGPURenderBundle, WebGPURequest,
-};
-
-use super::bindings::codegen::Bindings::GPURenderPipelineBinding::GPUIndexFormat;
#[dom_struct]
pub struct GPURenderBundleEncoder {
diff --git a/components/script/dom/gpurenderpassencoder.rs b/components/script/dom/gpurenderpassencoder.rs
index 2a1f3d371ea..7827e090c10 100644
--- a/components/script/dom/gpurenderpassencoder.rs
+++ b/components/script/dom/gpurenderpassencoder.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::wgpu::command::{render_ffi as wgpu_render, RenderPass};
+use webgpu::{wgt, WebGPU, WebGPURequest};
+
+use super::bindings::codegen::Bindings::GPURenderPipelineBinding::GPUIndexFormat;
+use super::bindings::error::Fallible;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUCommandEncoderBinding::GPUColor;
use crate::dom::bindings::codegen::Bindings::GPURenderPassEncoderBinding::GPURenderPassEncoderMethods;
@@ -15,14 +21,6 @@ use crate::dom::gpubuffer::GPUBuffer;
use crate::dom::gpucommandencoder::{GPUCommandEncoder, GPUCommandEncoderState};
use crate::dom::gpurenderbundle::GPURenderBundle;
use crate::dom::gpurenderpipeline::GPURenderPipeline;
-use dom_struct::dom_struct;
-use webgpu::{
- wgpu::command::{render_ffi as wgpu_render, RenderPass},
- wgt, WebGPU, WebGPURequest,
-};
-
-use super::bindings::codegen::Bindings::GPURenderPipelineBinding::GPUIndexFormat;
-use super::bindings::error::Fallible;
#[dom_struct]
pub struct GPURenderPassEncoder {
diff --git a/components/script/dom/gpurenderpipeline.rs b/components/script/dom/gpurenderpipeline.rs
index c52ab141206..7cd11632707 100644
--- a/components/script/dom/gpurenderpipeline.rs
+++ b/components/script/dom/gpurenderpipeline.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::string::String;
+
+use dom_struct::dom_struct;
+use webgpu::{WebGPUBindGroupLayout, WebGPURenderPipeline};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPURenderPipelineBinding::GPURenderPipelineMethods;
use crate::dom::bindings::error::{Error, Fallible};
@@ -11,9 +16,6 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::gpudevice::GPUDevice;
-use dom_struct::dom_struct;
-use std::string::String;
-use webgpu::{WebGPUBindGroupLayout, WebGPURenderPipeline};
#[dom_struct]
pub struct GPURenderPipeline {
diff --git a/components/script/dom/gpusampler.rs b/components/script/dom/gpusampler.rs
index 9574be119bf..670d3fec896 100644
--- a/components/script/dom/gpusampler.rs
+++ b/components/script/dom/gpusampler.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::{WebGPUDevice, WebGPUSampler};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUSamplerBinding::GPUSamplerMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::{WebGPUDevice, WebGPUSampler};
#[dom_struct]
pub struct GPUSampler {
diff --git a/components/script/dom/gpushadermodule.rs b/components/script/dom/gpushadermodule.rs
index 05621688d16..28a0a885506 100644
--- a/components/script/dom/gpushadermodule.rs
+++ b/components/script/dom/gpushadermodule.rs
@@ -4,17 +4,17 @@
use std::rc::Rc;
+use dom_struct::dom_struct;
+use webgpu::WebGPUShaderModule;
+
+use super::bindings::error::Fallible;
+use super::promise::Promise;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUShaderModuleBinding::GPUShaderModuleMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::WebGPUShaderModule;
-
-use super::bindings::error::Fallible;
-use super::promise::Promise;
#[dom_struct]
pub struct GPUShaderModule {
diff --git a/components/script/dom/gpushaderstage.rs b/components/script/dom/gpushaderstage.rs
index a9cd1d90589..611ffb12283 100644
--- a/components/script/dom/gpushaderstage.rs
+++ b/components/script/dom/gpushaderstage.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
+use crate::dom::bindings::reflector::Reflector;
+
#[dom_struct]
pub struct GPUShaderStage {
reflector_: Reflector,
diff --git a/components/script/dom/gpusupportedlimits.rs b/components/script/dom/gpusupportedlimits.rs
index 72d36cb3c2d..163139c856b 100644
--- a/components/script/dom/gpusupportedlimits.rs
+++ b/components/script/dom/gpusupportedlimits.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::wgt::Limits;
+use GPUSupportedLimitsBinding::GPUSupportedLimitsMethods;
+
use super::bindings::codegen::Bindings::GPUSupportedLimitsBinding::GPUSupportedLimitsBinding;
use super::bindings::reflector::reflect_dom_object;
use super::bindings::root::DomRoot;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use webgpu::wgt::Limits;
-use GPUSupportedLimitsBinding::GPUSupportedLimitsMethods;
#[dom_struct]
pub struct GPUSupportedLimits {
diff --git a/components/script/dom/gputexture.rs b/components/script/dom/gputexture.rs
index 23f944dd2b1..5b420276d47 100644
--- a/components/script/dom/gputexture.rs
+++ b/components/script/dom/gputexture.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::string::String;
+
+use dom_struct::dom_struct;
+use webgpu::identity::WebGPUOpResult;
+use webgpu::wgpu::resource;
+use webgpu::{wgt, WebGPU, WebGPURequest, WebGPUTexture, WebGPUTextureView};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::{
GPUExtent3DDict, GPUTextureDimension, GPUTextureFormat, GPUTextureMethods,
@@ -17,13 +25,6 @@ use crate::dom::gpudevice::{
convert_label, convert_texture_format, convert_texture_view_dimension, GPUDevice,
};
use crate::dom::gputextureview::GPUTextureView;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::string::String;
-use webgpu::{
- identity::WebGPUOpResult, wgpu::resource, wgt, WebGPU, WebGPURequest, WebGPUTexture,
- WebGPUTextureView,
-};
#[dom_struct]
pub struct GPUTexture {
diff --git a/components/script/dom/gputextureusage.rs b/components/script/dom/gputextureusage.rs
index ae426bed3ba..f2d9645364b 100644
--- a/components/script/dom/gputextureusage.rs
+++ b/components/script/dom/gputextureusage.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::reflector::Reflector;
use dom_struct::dom_struct;
+use crate::dom::bindings::reflector::Reflector;
+
#[dom_struct]
pub struct GPUTextureUsage {
reflector_: Reflector,
diff --git a/components/script/dom/gputextureview.rs b/components/script/dom/gputextureview.rs
index a4b3b4e8f99..b18130f01d9 100644
--- a/components/script/dom/gputextureview.rs
+++ b/components/script/dom/gputextureview.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webgpu::WebGPUTextureView;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUTextureViewBinding::GPUTextureViewMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,8 +12,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gputexture::GPUTexture;
-use dom_struct::dom_struct;
-use webgpu::WebGPUTextureView;
#[dom_struct]
pub struct GPUTextureView {
diff --git a/components/script/dom/gpuuncapturederrorevent.rs b/components/script/dom/gpuuncapturederrorevent.rs
index e5c590fdd68..6989241d279 100644
--- a/components/script/dom/gpuuncapturederrorevent.rs
+++ b/components/script/dom/gpuuncapturederrorevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::GPUUncapturedErrorEventBinding::{
GPUUncapturedErrorEventInit, GPUUncapturedErrorEventMethods,
@@ -12,9 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct GPUUncapturedErrorEvent {
diff --git a/components/script/dom/gpuvalidationerror.rs b/components/script/dom/gpuvalidationerror.rs
index 4e139c85edb..0153399f449 100644
--- a/components/script/dom/gpuvalidationerror.rs
+++ b/components/script/dom/gpuvalidationerror.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 https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
+use super::bindings::error::Fallible;
use crate::dom::bindings::codegen::Bindings::GPUValidationErrorBinding::GPUValidationErrorMethods;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-
-use super::bindings::error::Fallible;
#[dom_struct]
pub struct GPUValidationError {
diff --git a/components/script/dom/hashchangeevent.rs b/components/script/dom/hashchangeevent.rs
index e93f8a94476..ca3b05a58d1 100644
--- a/components/script/dom/hashchangeevent.rs
+++ b/components/script/dom/hashchangeevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding;
use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods;
@@ -12,9 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::event::Event;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
// https://html.spec.whatwg.org/multipage/#hashchangeevent
#[dom_struct]
diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs
index 32d0ed36d40..11363e07638 100644
--- a/components/script/dom/headers.rs
+++ b/components/script/dom/headers.rs
@@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::str::{self, FromStr};
+
+use data_url::mime::Mime as DataUrlMime;
+use dom_struct::dom_struct;
+use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
+use js::rust::HandleObject;
+use net_traits::fetch::headers::get_value_from_header_list;
+use net_traits::request::is_cors_safelisted_request_header;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -10,15 +20,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::{is_token, ByteString};
use crate::dom::globalscope::GlobalScope;
-use data_url::mime::Mime as DataUrlMime;
-use dom_struct::dom_struct;
-use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
-use js::rust::HandleObject;
-use net_traits::{
- fetch::headers::get_value_from_header_list, request::is_cors_safelisted_request_header,
-};
-use std::cell::Cell;
-use std::str::{self, FromStr};
#[dom_struct]
pub struct Headers {
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index f527d38a915..dcb00c9430e 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::{JSVal, NullValue, UndefinedValue};
+use js::rust::HandleValue;
+use msg::constellation_msg::{HistoryStateId, TraversalDirection};
+use net_traits::{CoreResourceMsg, IpcSend};
+use profile_traits::ipc;
+use profile_traits::ipc::channel;
+use script_traits::{ScriptMsg, StructuredSerializedData};
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
use crate::dom::bindings::codegen::Bindings::LocationBinding::LocationBinding::LocationMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@@ -18,17 +31,6 @@ use crate::dom::hashchangeevent::HashChangeEvent;
use crate::dom::popstateevent::PopStateEvent;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::{JSVal, NullValue, UndefinedValue};
-use js::rust::HandleValue;
-use msg::constellation_msg::{HistoryStateId, TraversalDirection};
-use net_traits::{CoreResourceMsg, IpcSend};
-use profile_traits::ipc;
-use profile_traits::ipc::channel;
-use script_traits::{ScriptMsg, StructuredSerializedData};
-use servo_url::ServoUrl;
-use std::cell::Cell;
enum PushOrReplace {
Push,
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index c16b55b88fb..ecae87f2d07 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -2,6 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use net_traits::request::Referrer;
+use num_traits::ToPrimitive;
+use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
+use servo_atoms::Atom;
+use servo_url::ServoUrl;
+use style::attr::AttrValue;
+
use crate::dom::activation::Activatable;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
@@ -27,16 +39,6 @@ use crate::dom::node::{document_from_node, Node};
use crate::dom::urlhelper::UrlHelper;
use crate::dom::virtualmethods::VirtualMethods;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use net_traits::request::Referrer;
-use num_traits::ToPrimitive;
-use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
-use servo_atoms::Atom;
-use servo_url::ServoUrl;
-use std::default::Default;
-use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLAnchorElement {
diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs
index 5a3a3e645b4..3f6306812b4 100644
--- a/components/script/dom/htmlareaelement.rs
+++ b/components/script/dom/htmlareaelement.rs
@@ -2,6 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+use std::{f32, str};
+
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
+use dom_struct::dom_struct;
+use euclid::default::Point2D;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+use style::attr::AttrValue;
+
use crate::dom::activation::Activatable;
use crate::dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -16,16 +27,6 @@ use crate::dom::htmlanchorelement::follow_hyperlink;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
-use dom_struct::dom_struct;
-use euclid::default::Point2D;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-use std::default::Default;
-use std::f32;
-use std::str;
-use style::attr::AttrValue;
#[derive(Debug, PartialEq)]
pub enum Area {
diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs
index 7040dd80b59..e636df1da39 100644
--- a/components/script/dom/htmlaudioelement.rs
+++ b/components/script/dom/htmlaudioelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::error::Fallible;
@@ -13,9 +17,6 @@ use crate::dom::element::{CustomElementCreationMode, Element, ElementCreator};
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::node::Node;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLAudioElement {
diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs
index 72e8ab85a08..30e6ca7851a 100644
--- a/components/script/dom/htmlbaseelement.rs
+++ b/components/script/dom/htmlbaseelement.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use servo_url::ServoUrl;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLBaseElementBinding::HTMLBaseElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -12,10 +17,6 @@ use crate::dom::element::{AttributeMutation, Element};
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use servo_url::ServoUrl;
#[dom_struct]
pub struct HTMLBaseElement {
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index 28587611603..c70b716bbf4 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use servo_url::ServoUrl;
+use style::attr::AttrValue;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::HTMLBodyElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@@ -14,13 +22,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, window_from_node, BindContext, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use embedder_traits::EmbedderMsg;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use servo_url::ServoUrl;
-use style::attr::AttrValue;
/// How long we should wait before performing the initial reflow after `<body>` is parsed, in
/// nanoseconds.
diff --git a/components/script/dom/htmlbrelement.rs b/components/script/dom/htmlbrelement.rs
index 9e0d64dbc51..129aef7d4c3 100644
--- a/components/script/dom/htmlbrelement.rs
+++ b/components/script/dom/htmlbrelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLBRElement {
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs
index 59abe891603..d324c10a953 100755
--- a/components/script/dom/htmlbuttonelement.rs
+++ b/components/script/dom/htmlbuttonelement.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::element_state::ElementState;
+
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
@@ -14,20 +22,15 @@ 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::{
+ FormControl, FormDatum, FormDatumValue, FormSubmitter, HTMLFormElement, ResetFrom,
+ SubmittedFrom,
+};
use crate::dom::node::{window_from_node, BindContext, Node, UnbindContext};
use crate::dom::nodelist::NodeList;
use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable};
use crate::dom::validitystate::{ValidationFlags, ValidityState};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, LocalName, Prefix};
-use js::rust::HandleObject;
-use std::cell::Cell;
-use std::default::Default;
-use style::element_state::ElementState;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
enum ButtonType {
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 03c4061938e..4f82a54e5bd 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -2,6 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
+use canvas_traits::webgl::{GLContextAttributes, WebGLVersion};
+use dom_struct::dom_struct;
+use euclid::default::{Rect, Size2D};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use image::codecs::png::PngEncoder;
+use image::{ColorType, ImageEncoder};
+use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
+use js::error::throw_type_error;
+use js::rust::{HandleObject, HandleValue};
+use profile_traits::ipc;
+use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
+use script_traits::ScriptMsg;
+use servo_media::streams::registry::MediaStreamId;
+use servo_media::streams::MediaStreamType;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
+
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{
@@ -31,22 +48,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::script_runtime::JSContext;
-use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
-use canvas_traits::webgl::{GLContextAttributes, WebGLVersion};
-use dom_struct::dom_struct;
-use euclid::default::{Rect, Size2D};
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use image::codecs::png::PngEncoder;
-use image::{ColorType, ImageEncoder};
-use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
-use js::error::throw_type_error;
-use js::rust::{HandleObject, HandleValue};
-use profile_traits::ipc;
-use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
-use script_traits::ScriptMsg;
-use servo_media::streams::registry::MediaStreamId;
-use servo_media::streams::MediaStreamType;
-use style::attr::{AttrValue, LengthOrPercentageOrAuto};
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
@@ -486,11 +487,12 @@ impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
}
pub mod utils {
- use crate::dom::window::Window;
use net_traits::image_cache::ImageResponse;
use net_traits::request::CorsSettings;
use servo_url::ServoUrl;
+ use crate::dom::window::Window;
+
pub fn request_image_from_cache(
window: &Window,
url: ServoUrl,
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 8bf1135ed73..560ea052392 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, QualName};
+use servo_atoms::Atom;
+use style::str::split_html_space_chars;
+
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -12,11 +19,6 @@ use crate::dom::bindings::xmlname::namespace_from_domstring;
use crate::dom::element::Element;
use crate::dom::node::{document_from_node, Node};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, QualName};
-use servo_atoms::Atom;
-use std::cell::Cell;
-use style::str::split_html_space_chars;
pub trait CollectionFilter: JSTraceable {
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool;
diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs
index 70fdb2f95fd..725bdd4abcc 100644
--- a/components/script/dom/htmldataelement.rs
+++ b/components/script/dom/htmldataelement.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLDataElementBinding::HTMLDataElementMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDataElement {
diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs
index 9323a627c15..311d1909f17 100644
--- a/components/script/dom/htmldatalistelement.rs
+++ b/components/script/dom/htmldatalistelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
@@ -11,9 +15,6 @@ use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection};
use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmloptionelement::HTMLOptionElement;
use crate::dom::node::{window_from_node, Node};
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDataListElement {
diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs
index bec0e4dbbf6..7d10b1c91f3 100644
--- a/components/script/dom/htmldetailselement.rs
+++ b/components/script/dom/htmldetailselement.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -14,10 +20,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{window_from_node, Node, NodeDamage};
use crate::dom::virtualmethods::VirtualMethods;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use std::cell::Cell;
#[dom_struct]
pub struct HTMLDetailsElement {
diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs
index 88d4cc545f5..18d9eac65a0 100644
--- a/components/script/dom/htmldialogelement.rs
+++ b/components/script/dom/htmldialogelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -12,9 +16,6 @@ use crate::dom::element::Element;
use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{window_from_node, Node};
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDialogElement {
diff --git a/components/script/dom/htmldirectoryelement.rs b/components/script/dom/htmldirectoryelement.rs
index 697607e8336..552d5572728 100644
--- a/components/script/dom/htmldirectoryelement.rs
+++ b/components/script/dom/htmldirectoryelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDirectoryElement {
diff --git a/components/script/dom/htmldivelement.rs b/components/script/dom/htmldivelement.rs
index 284e1af3690..d16ac4c6057 100644
--- a/components/script/dom/htmldivelement.rs
+++ b/components/script/dom/htmldivelement.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLDivElementBinding::HTMLDivElementMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDivElement {
diff --git a/components/script/dom/htmldlistelement.rs b/components/script/dom/htmldlistelement.rs
index 1477c95668c..970db5a221b 100644
--- a/components/script/dom/htmldlistelement.rs
+++ b/components/script/dom/htmldlistelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLDListElement {
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index abfcb4f6151..03560848965 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -2,17 +2,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashSet;
+use std::default::Default;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use script_layout_interface::message::QueryMsg;
+use style::attr::AttrValue;
+use style::element_state::*;
+
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
-use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
-use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
+use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::{
+ EventHandlerNonNull, OnErrorEventHandlerNonNull,
+};
use crate::dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods;
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::Castable;
-use crate::dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId};
+use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
@@ -30,19 +41,9 @@ use crate::dom::htmlhtmlelement::HTMLHtmlElement;
use crate::dom::htmlinputelement::{HTMLInputElement, InputType};
use crate::dom::htmllabelelement::HTMLLabelElement;
use crate::dom::htmltextareaelement::HTMLTextAreaElement;
-use crate::dom::node::{document_from_node, window_from_node};
-use crate::dom::node::{Node, ShadowIncluding};
+use crate::dom::node::{document_from_node, window_from_node, Node, ShadowIncluding};
use crate::dom::text::Text;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use script_layout_interface::message::QueryMsg;
-use std::collections::HashSet;
-use std::default::Default;
-use std::rc::Rc;
-use style::attr::AttrValue;
-use style::element_state::*;
#[dom_struct]
pub struct HTMLElement {
diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs
index ac7097e0331..ddfbc8675cd 100644
--- a/components/script/dom/htmlembedelement.rs
+++ b/components/script/dom/htmlembedelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLEmbedElement {
diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs
index 881bf0d64b4..a0e95ed9ca0 100644
--- a/components/script/dom/htmlfieldsetelement.rs
+++ b/components/script/dom/htmlfieldsetelement.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::element_state::ElementState;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods;
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
@@ -17,11 +24,6 @@ use crate::dom::node::{window_from_node, Node, ShadowIncluding};
use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use std::default::Default;
-use style::element_state::ElementState;
#[dom_struct]
pub struct HTMLFieldSetElement {
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index 453a1d5c96f..9d228516d38 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+use style::attr::AttrValue;
+use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -12,13 +20,6 @@ use crate::dom::element::{Element, LayoutElementHelpers};
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-use style::attr::AttrValue;
-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 f687870b058..098ddf55465 100644
--- a/components/script/dom/htmlformcontrolscollection.rs
+++ b/components/script/dom/htmlformcontrolscollection.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use crate::dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, NodeMethods};
@@ -16,8 +19,6 @@ use crate::dom::htmlformelement::HTMLFormElement;
use crate::dom::node::Node;
use crate::dom::radionodelist::RadioNodeList;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_atoms::Atom;
#[dom_struct]
pub struct HTMLFormControlsCollection {
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 5ec6e76ae80..6003ae66b06 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -2,6 +2,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use encoding_rs::{Encoding, UTF_8};
+use headers::{ContentType, HeaderMapExt};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use http::Method;
+use js::rust::HandleObject;
+use mime::{self, Mime};
+use net_traits::http_percent_encode;
+use net_traits::request::Referrer;
+use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
+use servo_atoms::Atom;
+use servo_rand::random;
+use style::attr::AttrValue;
+use style::element_state::ElementState;
+use style::str::split_html_space_chars;
+use time::{now, Duration, Tm};
+
+use super::bindings::trace::{HashMapTracedValues, NoTrace};
use crate::body::Extractable;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrBinding::AttrMethods;
@@ -14,8 +35,10 @@ use crate::dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::
use crate::dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
+use crate::dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods};
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
+use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use crate::dom::bindings::refcounted::Trusted;
@@ -47,9 +70,10 @@ use crate::dom::htmlobjectelement::HTMLObjectElement;
use crate::dom::htmloutputelement::HTMLOutputElement;
use crate::dom::htmlselectelement::HTMLSelectElement;
use crate::dom::htmltextareaelement::HTMLTextAreaElement;
-use crate::dom::node::{document_from_node, window_from_node};
-use crate::dom::node::{Node, NodeFlags};
-use crate::dom::node::{UnbindContext, VecPreOrderInsertionHelper};
+use crate::dom::node::{
+ document_from_node, window_from_node, Node, NodeFlags, UnbindContext,
+ VecPreOrderInsertionHelper,
+};
use crate::dom::nodelist::{NodeList, RadioListMode};
use crate::dom::radionodelist::RadioNodeList;
use crate::dom::submitevent::SubmitEvent;
@@ -57,30 +81,6 @@ use crate::dom::validitystate::ValidationFlags;
use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use encoding_rs::{Encoding, UTF_8};
-use headers::{ContentType, HeaderMapExt};
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use http::Method;
-use js::rust::HandleObject;
-use mime::{self, Mime};
-use net_traits::http_percent_encode;
-use net_traits::request::Referrer;
-use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
-use servo_atoms::Atom;
-use servo_rand::random;
-use std::borrow::ToOwned;
-use std::cell::Cell;
-use style::attr::AttrValue;
-use style::element_state::ElementState;
-use style::str::split_html_space_chars;
-
-use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement;
-use time::{now, Duration, Tm};
-
-use crate::dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods};
-
-use super::bindings::trace::{HashMapTracedValues, NoTrace};
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct GenerationId(u32);
diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs
index 4128a50841c..8dae2d38ce5 100644
--- a/components/script/dom/htmlframeelement.rs
+++ b/components/script/dom/htmlframeelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLFrameElement {
diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs
index 0b7f209c677..db1ab1c314c 100644
--- a/components/script/dom/htmlframesetelement.rs
+++ b/components/script/dom/htmlframesetelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -9,9 +13,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, Node};
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLFrameSetElement {
diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs
index cbb22801fef..92e21e1efa5 100644
--- a/components/script/dom/htmlheadelement.rs
+++ b/components/script/dom/htmlheadelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
@@ -12,9 +16,6 @@ use crate::dom::htmlmetaelement::HTMLMetaElement;
use crate::dom::node::{document_from_node, BindContext, Node, ShadowIncluding};
use crate::dom::userscripts::load_script;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLHeadElement {
diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs
index f990883498e..b701b5d7d7f 100644
--- a/components/script/dom/htmlheadingelement.rs
+++ b/components/script/dom/htmlheadingelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[derive(JSTraceable, MallocSizeOf)]
pub enum HeadingLevel {
diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs
index 13ab5786be9..6bc4c4a73d7 100644
--- a/components/script/dom/htmlhrelement.rs
+++ b/components/script/dom/htmlhrelement.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
+
use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::HTMLHRElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{DomRoot, LayoutDom};
@@ -11,11 +17,6 @@ use crate::dom::element::{Element, LayoutElementHelpers};
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::{AttrValue, LengthOrPercentageOrAuto};
#[dom_struct]
pub struct HTMLHRElement {
diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs
index 171a071ee8d..c6c4566a605 100644
--- a/components/script/dom/htmlhtmlelement.rs
+++ b/components/script/dom/htmlhtmlelement.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLHtmlElement {
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index a16aaa9abfa..4c57c8523b0 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -2,6 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use bitflags::bitflags;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use ipc_channel::ipc;
+use js::rust::HandleObject;
+use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
+use profile_traits::ipc as ProfiledIpc;
+use script_layout_interface::message::ReflowGoal;
+use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
+use script_traits::{
+ HistoryEntryReplacement, IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData,
+ LoadOrigin, NewLayoutInfo, ScriptMsg, UpdatePipelineIdReason, WindowSizeData,
+};
+use servo_atoms::Atom;
+use servo_url::ServoUrl;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
+
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@@ -25,24 +44,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::ReflowReason;
use crate::dom::windowproxy::WindowProxy;
use crate::script_thread::ScriptThread;
-use bitflags::bitflags;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use ipc_channel::ipc;
-use js::rust::HandleObject;
-use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
-use profile_traits::ipc as ProfiledIpc;
-use script_layout_interface::message::ReflowGoal;
-use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
-use script_traits::{
- HistoryEntryReplacement, IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData,
- LoadOrigin, UpdatePipelineIdReason, WindowSizeData,
-};
-use script_traits::{NewLayoutInfo, ScriptMsg};
-use servo_atoms::Atom;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use style::attr::{AttrValue, LengthOrPercentageOrAuto};
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
struct SandboxAllowance(u8);
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index d02a850ccb8..65846d59ab4 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -2,6 +2,50 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::HashSet;
+use std::default::Default;
+use std::sync::{Arc, Mutex};
+use std::{char, i32, mem};
+
+use app_units::{Au, AU_PER_PX};
+use cssparser::{Parser, ParserInput};
+use dom_struct::dom_struct;
+use euclid::Point2D;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
+use ipc_channel::ipc;
+use ipc_channel::ipc::IpcSender;
+use ipc_channel::router::ROUTER;
+use js::jsapi::JSAutoRealm;
+use js::rust::HandleObject;
+use mime::{self, Mime};
+use msg::constellation_msg::PipelineId;
+use net_traits::image::base::{Image, ImageMetadata};
+use net_traits::image_cache::{
+ CorsStatus, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, ImageResponse,
+ PendingImageId, PendingImageResponse, UsePlaceholder,
+};
+use net_traits::request::{CorsSettings, Destination, Initiator, Referrer, RequestBuilder};
+use net_traits::{
+ FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError, ReferrerPolicy,
+ ResourceFetchTiming, ResourceTimingType,
+};
+use num_traits::ToPrimitive;
+use servo_url::origin::{ImmutableOrigin, MutableOrigin};
+use servo_url::ServoUrl;
+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::length::{Length, NoCalcLength};
+use style::values::specified::source_size_list::SourceSizeList;
+use style::values::specified::AbsoluteLength;
+use style_traits::ParsingMode;
+
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
@@ -19,10 +63,10 @@ use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom};
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::document::{determine_policy_for_token, Document};
-use crate::dom::element::{cors_setting_for_element, referrer_policy_for_element};
-use crate::dom::element::{reflect_cross_origin_attribute, set_cross_origin_attribute};
use crate::dom::element::{
- AttributeMutation, CustomElementCreationMode, Element, ElementCreator, LayoutElementHelpers,
+ cors_setting_for_element, referrer_policy_for_element, reflect_cross_origin_attribute,
+ set_cross_origin_attribute, AttributeMutation, CustomElementCreationMode, Element,
+ ElementCreator, LayoutElementHelpers,
};
use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
@@ -34,9 +78,9 @@ use crate::dom::htmlmapelement::HTMLMapElement;
use crate::dom::htmlpictureelement::HTMLPictureElement;
use crate::dom::htmlsourceelement::HTMLSourceElement;
use crate::dom::mouseevent::MouseEvent;
-use crate::dom::node::UnbindContext;
use crate::dom::node::{
document_from_node, window_from_node, BindContext, Node, NodeDamage, ShadowIncluding,
+ UnbindContext,
};
use crate::dom::performanceresourcetiming::InitiatorType;
use crate::dom::values::UNSIGNED_LONG_MAX;
@@ -49,48 +93,6 @@ use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingLi
use crate::realms::enter_realm;
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
-use app_units::{Au, AU_PER_PX};
-use cssparser::{Parser, ParserInput};
-use dom_struct::dom_struct;
-use euclid::Point2D;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
-use ipc_channel::ipc;
-use ipc_channel::ipc::IpcSender;
-use ipc_channel::router::ROUTER;
-use js::jsapi::JSAutoRealm;
-use js::rust::HandleObject;
-use mime::{self, Mime};
-use msg::constellation_msg::PipelineId;
-use net_traits::image::base::{Image, ImageMetadata};
-use net_traits::image_cache::{
- CorsStatus, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, ImageResponse,
- PendingImageId, PendingImageResponse, UsePlaceholder,
-};
-use net_traits::request::{CorsSettings, Destination, Initiator, Referrer, RequestBuilder};
-use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError};
-use net_traits::{ReferrerPolicy, ResourceFetchTiming, ResourceTimingType};
-use num_traits::ToPrimitive;
-use servo_url::origin::ImmutableOrigin;
-use servo_url::origin::MutableOrigin;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::char;
-use std::collections::HashSet;
-use std::default::Default;
-use std::i32;
-use std::mem;
-use std::sync::{Arc, Mutex};
-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::length::{Length, NoCalcLength};
-use style::values::specified::{source_size_list::SourceSizeList, AbsoluteLength};
-use style_traits::ParsingMode;
enum ParseState {
InDescriptor,
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 2e6911203ea..931882082ad 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -2,6 +2,39 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::ops::Range;
+use std::ptr::NonNull;
+use std::{f64, ptr};
+
+use chrono::naive::{NaiveDate, NaiveDateTime};
+use chrono::{Datelike, Weekday};
+use dom_struct::dom_struct;
+use embedder_traits::FilterPattern;
+use encoding_rs::Encoding;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::jsapi::{
+ ClippedTime, DateGetMsecSinceEpoch, Handle, JSObject, JS_ClearPendingException, NewDateObject,
+ NewUCRegExpObject, ObjectIsDate, RegExpFlag_Unicode, RegExpFlags,
+};
+use js::jsval::UndefinedValue;
+use js::rust::jsapi_wrapped::{ExecuteRegExpNoStatics, ObjectIsRegExp};
+use js::rust::{HandleObject, MutableHandleObject};
+use msg::constellation_msg::InputMethodType;
+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;
+use servo_atoms::Atom;
+use style::attr::AttrValue;
+use style::element_state::ElementState;
+use style::str::{split_commas, str_join};
+use unicode_bidi::{bidi_class, BidiClass};
+use url::Url;
+
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@@ -28,14 +61,14 @@ use crate::dom::htmldatalistelement::HTMLDataListElement;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::{
- FormControl, FormDatum, FormDatumValue, FormSubmitter, HTMLFormElement,
+ FormControl, FormDatum, FormDatumValue, FormSubmitter, HTMLFormElement, ResetFrom,
+ SubmittedFrom,
};
-use crate::dom::htmlformelement::{ResetFrom, SubmittedFrom};
use crate::dom::keyboardevent::KeyboardEvent;
use crate::dom::mouseevent::MouseEvent;
-use crate::dom::node::{document_from_node, window_from_node};
use crate::dom::node::{
- BindContext, CloneChildrenFlag, Node, NodeDamage, ShadowIncluding, UnbindContext,
+ document_from_node, window_from_node, BindContext, CloneChildrenFlag, Node, NodeDamage,
+ ShadowIncluding, UnbindContext,
};
use crate::dom::nodelist::NodeList;
use crate::dom::textcontrol::{TextControlElement, TextControlSelection};
@@ -49,38 +82,6 @@ use crate::textinput::KeyReaction::{
};
use crate::textinput::Lines::Single;
use crate::textinput::{Direction, SelectionDirection, TextInput, UTF16CodeUnits, UTF8Bytes};
-use chrono::naive::{NaiveDate, NaiveDateTime};
-use chrono::{Datelike, Weekday};
-use dom_struct::dom_struct;
-use embedder_traits::FilterPattern;
-use encoding_rs::Encoding;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::jsapi::{
- ClippedTime, DateGetMsecSinceEpoch, Handle, JSObject, JS_ClearPendingException, NewDateObject,
- NewUCRegExpObject, ObjectIsDate, RegExpFlag_Unicode, RegExpFlags,
-};
-use js::jsval::UndefinedValue;
-use js::rust::jsapi_wrapped::{ExecuteRegExpNoStatics, ObjectIsRegExp};
-use js::rust::{HandleObject, MutableHandleObject};
-use msg::constellation_msg::InputMethodType;
-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;
-use servo_atoms::Atom;
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::f64;
-use std::ops::Range;
-use std::ptr;
-use std::ptr::NonNull;
-use style::attr::AttrValue;
-use style::element_state::ElementState;
-use style::str::{split_commas, str_join};
-use unicode_bidi::{bidi_class, BidiClass};
-use url::Url;
const DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
const DEFAULT_RESET_VALUE: &'static str = "Reset";
diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs
index 07de5963ee1..40d871e3415 100644
--- a/components/script/dom/htmllabelelement.rs
+++ b/components/script/dom/htmllabelelement.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::AttrValue;
+
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
@@ -20,10 +25,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmlformelement::{FormControl, FormControlElementHelpers, HTMLFormElement};
use crate::dom::node::{Node, ShadowIncluding};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLLabelElement {
diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs
index 32fa5e88808..2fd26acec77 100644
--- a/components/script/dom/htmllegendelement.rs
+++ b/components/script/dom/htmllegendelement.rs
@@ -2,6 +2,10 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLLegendElementBinding::HTMLLegendElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -13,9 +17,6 @@ use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::{FormControl, HTMLFormElement};
use crate::dom::node::{BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLLegendElement {
diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs
index 1ba7237b76f..58219171d3c 100644
--- a/components/script/dom/htmllielement.rs
+++ b/components/script/dom/htmllielement.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::AttrValue;
+
use crate::dom::bindings::codegen::Bindings::HTMLLIElementBinding::HTMLLIElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
@@ -10,10 +15,6 @@ use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLLIElement {
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index c6d03721c46..c240f4da17c 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -2,6 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::cell::Cell;
+use std::default::Default;
+
+use cssparser::{Parser as CssParser, ParserInput};
+use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use net_traits::ReferrerPolicy;
+use servo_arc::Arc;
+use servo_atoms::Atom;
+use style::attr::AttrValue;
+use style::media_queries::MediaList;
+use style::parser::ParserContext as CssParserContext;
+use style::str::HTML_SPACE_CHARACTERS;
+use style::stylesheets::{CssRuleType, Origin, Stylesheet};
+use style_traits::ParsingMode;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding::DOMTokenListMethods;
@@ -14,9 +33,8 @@ use crate::dom::document::Document;
use crate::dom::domtokenlist::DOMTokenList;
use crate::dom::element::{
cors_setting_for_element, reflect_cross_origin_attribute, reflect_referrer_policy_attribute,
- set_cross_origin_attribute,
+ set_cross_origin_attribute, AttributeMutation, Element, ElementCreator,
};
-use crate::dom::element::{AttributeMutation, Element, ElementCreator};
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{
document_from_node, stylesheets_owner_from_node, window_from_node, BindContext, Node,
@@ -25,23 +43,6 @@ use crate::dom::node::{
use crate::dom::stylesheet::StyleSheet as DOMStyleSheet;
use crate::dom::virtualmethods::VirtualMethods;
use crate::stylesheet_loader::{StylesheetContextSource, StylesheetLoader, StylesheetOwner};
-use cssparser::{Parser as CssParser, ParserInput};
-use dom_struct::dom_struct;
-use embedder_traits::EmbedderMsg;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use net_traits::ReferrerPolicy;
-use servo_arc::Arc;
-use servo_atoms::Atom;
-use std::borrow::ToOwned;
-use std::cell::Cell;
-use std::default::Default;
-use style::attr::AttrValue;
-use style::media_queries::MediaList;
-use style::parser::ParserContext as CssParserContext;
-use style::str::HTML_SPACE_CHARACTERS;
-use style::stylesheets::{CssRuleType, Origin, Stylesheet};
-use style_traits::ParsingMode;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
pub struct RequestGenerationId(u32);
diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs
index 3e1b19be48a..7367f188de7 100644
--- a/components/script/dom/htmlmapelement.rs
+++ b/components/script/dom/htmlmapelement.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlareaelement::HTMLAreaElement;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{Node, ShadowIncluding};
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLMapElement {
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 90b9509f4f0..acd15800935 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -2,15 +2,52 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::VecDeque;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+use std::{f64, mem};
+
+use dom_struct::dom_struct;
+use embedder_traits::resources::{self, Resource as EmbedderResource};
+use embedder_traits::{MediaPositionState, MediaSessionEvent, MediaSessionPlaybackState};
+use euclid::default::Size2D;
+use headers::{ContentLength, ContentRange, HeaderMapExt};
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use http::header::{self, HeaderMap, HeaderValue};
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::jsapi::JSAutoRealm;
+use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
+use net_traits::image::base::Image;
+use net_traits::request::Destination;
+use net_traits::{
+ CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata, NetworkError,
+ ResourceFetchTiming, ResourceTimingType,
+};
+use script_layout_interface::HTMLMediaData;
+use script_traits::{ImageUpdate, WebrenderIpcSender};
+use servo_config::pref;
+use servo_media::player::audio::AudioRenderer;
+use servo_media::player::video::{VideoFrame, VideoFrameRenderer};
+use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, SeekLock, StreamType};
+use servo_media::{ClientContextId, ServoMedia, SupportsMediaType};
+use servo_url::ServoUrl;
+use time::{self, Duration, Timespec};
+use webrender_api::{
+ ExternalImageData, ExternalImageId, ExternalImageType, ImageBufferKind, ImageData,
+ ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey,
+};
+
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::attr::Attr;
use crate::dom::audiotrack::AudioTrack;
use crate::dom::audiotracklist::AudioTrackList;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
-use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::CanPlayTypeResult;
-use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementConstants;
-use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
+use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::{
+ CanPlayTypeResult, HTMLMediaElementConstants, HTMLMediaElementMethods,
+};
use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElementMethods;
use crate::dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*;
use crate::dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
@@ -18,8 +55,9 @@ use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding:
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
use crate::dom::bindings::codegen::Bindings::TextTrackBinding::{TextTrackKind, TextTrackMode};
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-use crate::dom::bindings::codegen::InheritTypes::{ElementTypeId, HTMLElementTypeId};
-use crate::dom::bindings::codegen::InheritTypes::{HTMLMediaElementTypeId, NodeTypeId};
+use crate::dom::bindings::codegen::InheritTypes::{
+ ElementTypeId, HTMLElementTypeId, HTMLMediaElementTypeId, NodeTypeId,
+};
use crate::dom::bindings::codegen::UnionTypes::{
MediaStreamOrBlob, VideoTrackOrAudioTrackOrTextTrack,
};
@@ -34,8 +72,8 @@ use crate::dom::blob::Blob;
use crate::dom::document::Document;
use crate::dom::element::{
cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute,
+ AttributeMutation, Element, ElementCreator,
};
-use crate::dom::element::{AttributeMutation, Element, ElementCreator};
use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
@@ -65,39 +103,6 @@ use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingLi
use crate::realms::{enter_realm, InRealm};
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use embedder_traits::resources::{self, Resource as EmbedderResource};
-use embedder_traits::{MediaPositionState, MediaSessionEvent, MediaSessionPlaybackState};
-use euclid::default::Size2D;
-use headers::{ContentLength, ContentRange, HeaderMapExt};
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use http::header::{self, HeaderMap, HeaderValue};
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::jsapi::JSAutoRealm;
-use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
-use net_traits::image::base::Image;
-use net_traits::request::Destination;
-use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata};
-use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
-use script_layout_interface::HTMLMediaData;
-use script_traits::{ImageUpdate, WebrenderIpcSender};
-use servo_config::pref;
-use servo_media::player::audio::AudioRenderer;
-use servo_media::player::video::{VideoFrame, VideoFrameRenderer};
-use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, SeekLock, StreamType};
-use servo_media::{ClientContextId, ServoMedia, SupportsMediaType};
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::collections::VecDeque;
-use std::f64;
-use std::mem;
-use std::rc::Rc;
-use std::sync::{Arc, Mutex};
-use time::{self, Duration, Timespec};
-use webrender_api::ImageKey;
-use webrender_api::{ExternalImageData, ExternalImageId, ExternalImageType, ImageBufferKind};
-use webrender_api::{ImageData, ImageDescriptor, ImageDescriptorFlags, ImageFormat};
#[derive(PartialEq)]
enum FrameStatus {
diff --git a/components/script/dom/htmlmenuelement.rs b/components/script/dom/htmlmenuelement.rs
index 9698a058fb1..10ab5116f75 100644
--- a/components/script/dom/htmlmenuelement.rs
+++ b/components/script/dom/htmlmenuelement.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLMenuElementBinding::HTMLMenuElementMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLMenuElement {
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index 204a67bf27c..4000035b0ca 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+use style::str::HTML_SPACE_CHARACTERS;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
@@ -14,10 +19,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmlheadelement::HTMLHeadElement;
use crate::dom::node::{BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
-use style::str::HTML_SPACE_CHARACTERS;
#[dom_struct]
pub struct HTMLMetaElement {
diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs
index 42fb531614c..03859ee9689 100644
--- a/components/script/dom/htmlmeterelement.rs
+++ b/components/script/dom/htmlmeterelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLMeterElementBinding::HTMLMeterElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -9,9 +13,6 @@ use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::nodelist::NodeList;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLMeterElement {
diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs
index f271c0e25d1..68c731c189e 100644
--- a/components/script/dom/htmlmodelement.rs
+++ b/components/script/dom/htmlmodelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLModElement {
diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs
index 447d40b6a78..06509e66497 100755
--- a/components/script/dom/htmlobjectelement.rs
+++ b/components/script/dom/htmlobjectelement.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use net_traits::image::base::Image;
+use servo_arc::Arc;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods;
@@ -16,12 +24,6 @@ use crate::dom::node::{window_from_node, Node};
use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use net_traits::image::base::Image;
-use servo_arc::Arc;
-use std::default::Default;
#[dom_struct]
pub struct HTMLObjectElement {
diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs
index 05f8bb69bba..cba1baad27d 100644
--- a/components/script/dom/htmlolistelement.rs
+++ b/components/script/dom/htmlolistelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLOListElement {
diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs
index 499f88aa93b..58c943a5fb3 100644
--- a/components/script/dom/htmloptgroupelement.rs
+++ b/components/script/dom/htmloptgroupelement.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::element_state::ElementState;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -15,10 +20,6 @@ use crate::dom::node::{BindContext, Node, ShadowIncluding, UnbindContext};
use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidationFlags;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::element_state::ElementState;
#[dom_struct]
pub struct HTMLOptGroupElement {
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index 3d5abc655c0..50cedb749da 100644
--- a/components/script/dom/htmloptionelement.rs
+++ b/components/script/dom/htmloptionelement.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::convert::TryInto;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
+use js::rust::HandleObject;
+use style::element_state::ElementState;
+use style::str::{split_html_space_chars, str_join};
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods;
@@ -26,13 +35,6 @@ use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidationFlags;
use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
-use js::rust::HandleObject;
-use std::cell::Cell;
-use std::convert::TryInto;
-use style::element_state::ElementState;
-use style::str::{split_html_space_chars, str_join};
#[dom_struct]
pub struct HTMLOptionElement {
diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs
index 4c826eb8ce4..8099c69e817 100644
--- a/components/script/dom/htmloptionscollection.rs
+++ b/components/script/dom/htmloptionscollection.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::local_name;
+
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use crate::dom::bindings::codegen::Bindings::HTMLOptionsCollectionBinding::HTMLOptionsCollectionMethods;
@@ -21,8 +24,6 @@ use crate::dom::htmloptionelement::HTMLOptionElement;
use crate::dom::htmlselectelement::HTMLSelectElement;
use crate::dom::node::{document_from_node, Node};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use html5ever::local_name;
#[dom_struct]
pub struct HTMLOptionsCollection {
diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs
index 6d8033fe299..e444a19c60d 100644
--- a/components/script/dom/htmloutputelement.rs
+++ b/components/script/dom/htmloutputelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods;
@@ -17,9 +21,6 @@ use crate::dom::nodelist::NodeList;
use crate::dom::validation::Validatable;
use crate::dom::validitystate::ValidityState;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLOutputElement {
diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs
index 82defe4113b..0609f355575 100644
--- a/components/script/dom/htmlparagraphelement.rs
+++ b/components/script/dom/htmlparagraphelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLParagraphElement {
diff --git a/components/script/dom/htmlparamelement.rs b/components/script/dom/htmlparamelement.rs
index a2b30e7ecd1..4b550346877 100644
--- a/components/script/dom/htmlparamelement.rs
+++ b/components/script/dom/htmlparamelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLParamElement {
diff --git a/components/script/dom/htmlpictureelement.rs b/components/script/dom/htmlpictureelement.rs
index 62de53ef704..51b93857bfe 100644
--- a/components/script/dom/htmlpictureelement.rs
+++ b/components/script/dom/htmlpictureelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLPictureElement {
diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs
index 0243be8d4ae..9eb27ebd820 100644
--- a/components/script/dom/htmlpreelement.rs
+++ b/components/script/dom/htmlpreelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLPreElement {
diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs
index dc19a7a63f9..79d73b2e338 100644
--- a/components/script/dom/htmlprogresselement.rs
+++ b/components/script/dom/htmlprogresselement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLProgressElementBinding::HTMLProgressElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
@@ -11,9 +15,6 @@ use crate::dom::element::Element;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::nodelist::NodeList;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLProgressElement {
diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs
index f6f42dc4231..acd8c3521be 100644
--- a/components/script/dom/htmlquoteelement.rs
+++ b/components/script/dom/htmlquoteelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLQuoteElement {
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 30c6ad7fb47..9f0ad234662 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -2,6 +2,43 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use core::ffi::c_void;
+use std::cell::Cell;
+use std::fs::{create_dir_all, read_to_string, File};
+use std::io::{Read, Seek, Write};
+use std::mem::replace;
+use std::path::PathBuf;
+use std::process::Command;
+use std::ptr;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+
+use content_security_policy as csp;
+use dom_struct::dom_struct;
+use encoding_rs::Encoding;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::jsapi::{CanCompileOffThread, CompileToStencilOffThread1, OffThreadToken};
+use js::jsval::UndefinedValue;
+use js::rust::{
+ transform_str_to_source_text, CompileOptionsWrapper, FinishOffThreadStencil, HandleObject,
+ Stencil,
+};
+use msg::constellation_msg::PipelineId;
+use net_traits::request::{
+ CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder,
+};
+use net_traits::{
+ FetchMetadata, FetchResponseListener, Metadata, NetworkError, ResourceFetchTiming,
+ ResourceTimingType,
+};
+use servo_atoms::Atom;
+use servo_config::pref;
+use servo_url::{ImmutableOrigin, ServoUrl};
+use style::str::{StaticStringVec, HTML_SPACE_CHARACTERS};
+use uuid::Uuid;
+
use crate::document_loader::LoadType;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
@@ -17,61 +54,26 @@ use crate::dom::bindings::trace::NoTrace;
use crate::dom::document::Document;
use crate::dom::element::{
cors_setting_for_element, referrer_policy_for_element, reflect_cross_origin_attribute,
- reflect_referrer_policy_attribute, set_cross_origin_attribute,
+ reflect_referrer_policy_attribute, set_cross_origin_attribute, AttributeMutation, Element,
+ ElementCreator,
};
-use crate::dom::element::{AttributeMutation, Element, ElementCreator};
use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlelement::HTMLElement;
-use crate::dom::node::{document_from_node, window_from_node};
-use crate::dom::node::{BindContext, ChildrenMutation, CloneChildrenFlag, Node};
+use crate::dom::node::{
+ document_from_node, window_from_node, BindContext, ChildrenMutation, CloneChildrenFlag, Node,
+};
use crate::dom::performanceresourcetiming::InitiatorType;
use crate::dom::virtualmethods::VirtualMethods;
use crate::fetch::create_a_potential_cors_request;
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use crate::realms::enter_realm;
-use crate::script_module::fetch_inline_module_script;
-use crate::script_module::{fetch_external_module_script, ModuleOwner, ScriptFetchOptions};
+use crate::script_module::{
+ fetch_external_module_script, fetch_inline_module_script, ModuleOwner, ScriptFetchOptions,
+};
use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
-use crate::task_source::TaskSource;
-use crate::task_source::TaskSourceName;
-use content_security_policy as csp;
-use core::ffi::c_void;
-use dom_struct::dom_struct;
-use encoding_rs::Encoding;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::jsapi::{CanCompileOffThread, CompileToStencilOffThread1, OffThreadToken};
-use js::jsval::UndefinedValue;
-use js::rust::{
- transform_str_to_source_text, CompileOptionsWrapper, FinishOffThreadStencil, HandleObject,
- Stencil,
-};
-use msg::constellation_msg::PipelineId;
-use net_traits::request::{
- CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder,
-};
-use net_traits::{
- FetchMetadata, FetchResponseListener, Metadata, NetworkError, ResourceFetchTiming,
- ResourceTimingType,
-};
-use servo_atoms::Atom;
-use servo_config::pref;
-use servo_url::ImmutableOrigin;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::fs::{create_dir_all, read_to_string, File};
-use std::io::{Read, Seek, Write};
-use std::mem::replace;
-use std::path::PathBuf;
-use std::process::Command;
-use std::ptr;
-use std::rc::Rc;
-use std::sync::{Arc, Mutex};
-use style::str::{StaticStringVec, HTML_SPACE_CHARACTERS};
-use uuid::Uuid;
+use crate::task_source::{TaskSource, TaskSourceName};
pub struct OffThreadCompilationContext {
script_element: Trusted<HTMLScriptElement>,
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs
index 04d52ae695d..a7eb1ea6060 100755
--- a/components/script/dom/htmlselectelement.rs
+++ b/components/script/dom/htmlselectelement.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+use std::iter;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::AttrValue;
+use style::element_state::ElementState;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
@@ -9,8 +18,9 @@ use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptio
use crate::dom::bindings::codegen::Bindings::HTMLOptionsCollectionBinding::HTMLOptionsCollectionMethods;
use crate::dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
-use crate::dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
-use crate::dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement;
+use crate::dom::bindings::codegen::UnionTypes::{
+ HTMLElementOrLong, HTMLOptionElementOrHTMLOptGroupElement,
+};
use crate::dom::bindings::error::ErrorResult;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -29,13 +39,6 @@ use crate::dom::nodelist::NodeList;
use crate::dom::validation::{is_barred_by_datalist_ancestor, Validatable};
use crate::dom::validitystate::{ValidationFlags, ValidityState};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
-use std::default::Default;
-use std::iter;
-use style::attr::AttrValue;
-use style::element_state::ElementState;
#[derive(JSTraceable, MallocSizeOf)]
struct OptionsFilter;
diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs
index 91e33e1ea9a..19a27837d87 100644
--- a/components/script/dom/htmlsourceelement.rs
+++ b/components/script/dom/htmlsourceelement.rs
@@ -2,12 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::attr::Attr;
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::DomRoot;
-use crate::dom::bindings::root::{Dom, Root};
+use crate::dom::bindings::root::{Dom, DomRoot, Root};
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::element::AttributeMutation;
@@ -16,9 +19,6 @@ use crate::dom::htmlimageelement::HTMLImageElement;
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::node::{BindContext, Node, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLSourceElement {
diff --git a/components/script/dom/htmlspanelement.rs b/components/script/dom/htmlspanelement.rs
index ac9a711d716..1d323a65556 100644
--- a/components/script/dom/htmlspanelement.rs
+++ b/components/script/dom/htmlspanelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLSpanElement {
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index 846c1ccf59e..8df9901eb1c 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -2,6 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use cssparser::{Parser as CssParser, ParserInput};
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use net_traits::ReferrerPolicy;
+use servo_arc::Arc;
+use style::media_queries::MediaList;
+use style::parser::ParserContext as CssParserContext;
+use style::stylesheets::{AllowImportRules, CssRuleType, Origin, Stylesheet};
+use style_traits::ParsingMode;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
@@ -18,17 +31,6 @@ use crate::dom::node::{
use crate::dom::stylesheet::StyleSheet as DOMStyleSheet;
use crate::dom::virtualmethods::VirtualMethods;
use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner};
-use cssparser::{Parser as CssParser, ParserInput};
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use net_traits::ReferrerPolicy;
-use servo_arc::Arc;
-use std::cell::Cell;
-use style::media_queries::MediaList;
-use style::parser::ParserContext as CssParserContext;
-use style::stylesheets::{AllowImportRules, CssRuleType, Origin, Stylesheet};
-use style_traits::ParsingMode;
#[dom_struct]
pub struct HTMLStyleElement {
diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs
index c7c91ae359e..c856c53c18a 100644
--- a/components/script/dom/htmltablecaptionelement.rs
+++ b/components/script/dom/htmltablecaptionelement.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLTableCaptionElement {
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index 9db63e6ffe0..a6ab78177dc 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -2,11 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::{AttrValue, LengthOrPercentageOrAuto};
+use style::context::QuirksMode;
+
use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::bindings::root::LayoutDom;
+use crate::dom::bindings::root::{DomRoot, LayoutDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::element::{Element, LayoutElementHelpers};
@@ -14,12 +20,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmltablerowelement::HTMLTableRowElement;
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::{AttrValue, LengthOrPercentageOrAuto};
-use style::context::QuirksMode;
const DEFAULT_COLSPAN: u32 = 1;
const DEFAULT_ROWSPAN: u32 = 1;
diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs
index 2700defb19a..d2b9e1f9421 100644
--- a/components/script/dom/htmltablecolelement.rs
+++ b/components/script/dom/htmltablecolelement.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLTableColElement {
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index 189eac21a17..25c75e1820f 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
@@ -20,12 +28,6 @@ use crate::dom::htmltablerowelement::HTMLTableRowElement;
use crate::dom::htmltablesectionelement::HTMLTableSectionElement;
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::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use std::cell::Cell;
-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 43006a85757..79f154c4256 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::AttrValue;
+
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::HTMLTableRowElementMethods;
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
@@ -19,11 +25,6 @@ use crate::dom::htmltableelement::HTMLTableElement;
use crate::dom::htmltablesectionelement::HTMLTableSectionElement;
use crate::dom::node::{window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::AttrValue;
#[derive(JSTraceable)]
struct CellsFilter;
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index ccaf409e10a..24a85fb1b1a 100644
--- a/components/script/dom/htmltablesectionelement.rs
+++ b/components/script/dom/htmltablesectionelement.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use cssparser::RGBA;
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::attr::AttrValue;
+
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::error::{ErrorResult, Fallible};
@@ -15,11 +21,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmltablerowelement::HTMLTableRowElement;
use crate::dom::node::{window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use cssparser::RGBA;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLTableSectionElement {
diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs
index 1a542171ef0..4938c25a14d 100644
--- a/components/script/dom/htmltemplateelement.rs
+++ b/components/script/dom/htmltemplateelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
@@ -12,9 +16,6 @@ use crate::dom::documentfragment::DocumentFragment;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, CloneChildrenFlag, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLTemplateElement {
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 2220058db98..93cc3c6d292 100755
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -2,6 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::default::Default;
+use std::ops::Range;
+
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use script_traits::ScriptToConstellationChan;
+use style::attr::AttrValue;
+use style::element_state::ElementState;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
@@ -14,8 +25,7 @@ use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::compositionevent::CompositionEvent;
use crate::dom::document::Document;
-use crate::dom::element::LayoutElementHelpers;
-use crate::dom::element::{AttributeMutation, Element};
+use crate::dom::element::{AttributeMutation, Element, LayoutElementHelpers};
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlelement::HTMLElement;
@@ -23,9 +33,9 @@ use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::{FormControl, HTMLFormElement};
use crate::dom::htmlinputelement::HTMLInputElement;
use crate::dom::keyboardevent::KeyboardEvent;
-use crate::dom::node::window_from_node;
use crate::dom::node::{
- BindContext, ChildrenMutation, CloneChildrenFlag, Node, NodeDamage, UnbindContext,
+ window_from_node, BindContext, ChildrenMutation, CloneChildrenFlag, Node, NodeDamage,
+ UnbindContext,
};
use crate::dom::nodelist::NodeList;
use crate::dom::textcontrol::{TextControlElement, TextControlSelection};
@@ -35,15 +45,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::textinput::{
Direction, KeyReaction, Lines, SelectionDirection, TextInput, UTF16CodeUnits, UTF8Bytes,
};
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use script_traits::ScriptToConstellationChan;
-use std::cell::Cell;
-use std::default::Default;
-use std::ops::Range;
-use style::attr::AttrValue;
-use style::element_state::ElementState;
#[dom_struct]
pub struct HTMLTextAreaElement {
diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs
index 712983f8460..4af4acfc888 100644
--- a/components/script/dom/htmltimeelement.rs
+++ b/components/script/dom/htmltimeelement.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLTimeElementBinding::HTMLTimeElementMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLTimeElement {
diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs
index 464bbaab2e0..24572c0f7e1 100644
--- a/components/script/dom/htmltitleelement.rs
+++ b/components/script/dom/htmltitleelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -11,9 +15,6 @@ use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{BindContext, ChildrenMutation, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLTitleElement {
diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs
index 08e450aea52..841ac42c1b0 100644
--- a/components/script/dom/htmltrackelement.rs
+++ b/components/script/dom/htmltrackelement.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::HTMLTrackElementBinding::{
HTMLTrackElementConstants, HTMLTrackElementMethods,
};
@@ -13,9 +17,6 @@ use crate::dom::element::Element;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
use crate::dom::texttrack::TextTrack;
-use dom_struct::dom_struct;
-use html5ever::{local_name, LocalName, Prefix};
-use js::rust::HandleObject;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
#[repr(u16)]
diff --git a/components/script/dom/htmlulistelement.rs b/components/script/dom/htmlulistelement.rs
index 73704e70418..f0820c0f3ae 100644
--- a/components/script/dom/htmlulistelement.rs
+++ b/components/script/dom/htmlulistelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLUListElement {
diff --git a/components/script/dom/htmlunknownelement.rs b/components/script/dom/htmlunknownelement.rs
index c59b4d81e8c..c87c104d66b 100644
--- a/components/script/dom/htmlunknownelement.rs
+++ b/components/script/dom/htmlunknownelement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use js::rust::HandleObject;
+
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use js::rust::HandleObject;
#[dom_struct]
pub struct HTMLUnknownElement {
diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs
index 828f8d6f4a8..39bfabfb6d0 100644
--- a/components/script/dom/htmlvideoelement.rs
+++ b/components/script/dom/htmlvideoelement.rs
@@ -2,6 +2,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::sync::{Arc, Mutex};
+
+use dom_struct::dom_struct;
+use euclid::default::Size2D;
+use html5ever::{local_name, LocalName, Prefix};
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::rust::HandleObject;
+use net_traits::image_cache::{
+ ImageCache, ImageCacheResult, ImageOrMetadataAvailable, ImageResponse, PendingImageId,
+ UsePlaceholder,
+};
+use net_traits::request::{CredentialsMode, Destination, RequestBuilder};
+use net_traits::{
+ CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, FetchResponseMsg,
+ NetworkError, ResourceFetchTiming, ResourceTimingType,
+};
+use servo_media::player::video::VideoFrame;
+use servo_url::ServoUrl;
+
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@@ -21,25 +42,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::fetch::FetchCanceller;
use crate::image_listener::{generate_cache_listener_for_element, ImageCacheListener};
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
-use dom_struct::dom_struct;
-use euclid::default::Size2D;
-use html5ever::{local_name, LocalName, Prefix};
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::rust::HandleObject;
-use net_traits::image_cache::{
- ImageCache, ImageCacheResult, ImageOrMetadataAvailable, ImageResponse, PendingImageId,
- UsePlaceholder,
-};
-use net_traits::request::{CredentialsMode, Destination, RequestBuilder};
-use net_traits::{
- CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, FetchResponseMsg,
-};
-use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
-use servo_media::player::video::VideoFrame;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::sync::{Arc, Mutex};
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs
index 49822b3d729..19890d56025 100644
--- a/components/script/dom/identityhub.rs
+++ b/components/script/dom/identityhub.rs
@@ -3,14 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use smallvec::SmallVec;
-use webgpu::wgpu::{
- id::{
- AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandEncoderId, ComputePipelineId,
- DeviceId, PipelineLayoutId, RenderBundleId, RenderPipelineId, SamplerId, ShaderModuleId,
- TextureId, TextureViewId,
- },
- identity::IdentityManager,
+use webgpu::wgpu::id::{
+ AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandEncoderId, ComputePipelineId,
+ DeviceId, PipelineLayoutId, RenderBundleId, RenderPipelineId, SamplerId, ShaderModuleId,
+ TextureId, TextureViewId,
};
+use webgpu::wgpu::identity::IdentityManager;
use webgpu::wgt::Backend;
#[derive(Debug)]
diff --git a/components/script/dom/imagebitmap.rs b/components/script/dom/imagebitmap.rs
index 72b4871490f..36b845b64e4 100644
--- a/components/script/dom/imagebitmap.rs
+++ b/components/script/dom/imagebitmap.rs
@@ -2,18 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::cell::DomRefCell;
+use std::cell::Cell;
+use std::vec::Vec;
-use crate::dom::bindings::codegen::Bindings::ImageBitmapBinding::ImageBitmapMethods;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+use crate::dom::bindings::cell::DomRefCell;
+use crate::dom::bindings::codegen::Bindings::ImageBitmapBinding::ImageBitmapMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
-use dom_struct::dom_struct;
-
-use std::cell::Cell;
-use std::vec::Vec;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
#[dom_struct]
pub struct ImageBitmap {
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs
index 434b2f20252..78d0b56546c 100644
--- a/components/script/dom/imagedata.rs
+++ b/components/script/dom/imagedata.rs
@@ -2,23 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
-use crate::dom::bindings::error::{Error, Fallible};
-use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::globalscope::GlobalScope;
-use crate::script_runtime::JSContext;
+use std::borrow::Cow;
+use std::default::Default;
+use std::ptr;
+use std::ptr::NonNull;
+use std::vec::Vec;
+
use dom_struct::dom_struct;
use euclid::default::{Rect, Size2D};
use ipc_channel::ipc::IpcSharedMemory;
use js::jsapi::{Heap, JSObject};
use js::rust::{HandleObject, Runtime};
use js::typedarray::{CreateWith, Uint8ClampedArray};
-use std::borrow::Cow;
-use std::default::Default;
-use std::ptr;
-use std::ptr::NonNull;
-use std::vec::Vec;
+
+use crate::dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
+use crate::dom::bindings::error::{Error, Fallible};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use crate::script_runtime::JSContext;
#[dom_struct]
pub struct ImageData {
diff --git a/components/script/dom/inputevent.rs b/components/script/dom/inputevent.rs
index d96f64327b6..4ba00220aef 100644
--- a/components/script/dom/inputevent.rs
+++ b/components/script/dom/inputevent.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::InputEventBinding::{self, InputEventMethods};
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
use crate::dom::bindings::error::Fallible;
@@ -10,8 +13,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct InputEvent {
diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs
index f2f8084ce1d..d973f78315c 100644
--- a/components/script/dom/keyboardevent.rs
+++ b/components/script/dom/keyboardevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use keyboard_types::{Key, Modifiers};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::KeyboardEventBinding;
use crate::dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods;
@@ -14,10 +20,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use keyboard_types::{Key, Modifiers};
-use std::cell::Cell;
#[dom_struct]
pub struct KeyboardEvent {
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs
index 6f1fc477f3a..70556eaa101 100644
--- a/components/script/dom/location.rs
+++ b/components/script/dom/location.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use net_traits::request::Referrer;
+use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
+use servo_url::{MutableOrigin, ServoUrl};
+
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};
@@ -12,10 +17,6 @@ use crate::dom::document::Document;
use crate::dom::globalscope::GlobalScope;
use crate::dom::urlhelper::UrlHelper;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use net_traits::request::Referrer;
-use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
-use servo_url::{MutableOrigin, ServoUrl};
#[derive(PartialEq)]
enum NavigationType {
diff --git a/components/script/dom/mediadeviceinfo.rs b/components/script/dom/mediadeviceinfo.rs
index 29d63027952..c07be051076 100644
--- a/components/script/dom/mediadeviceinfo.rs
+++ b/components/script/dom/mediadeviceinfo.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::MediaDeviceInfoBinding::MediaDeviceInfoMethods;
-use crate::dom::bindings::codegen::Bindings::MediaDeviceInfoBinding::MediaDeviceKind;
+use dom_struct::dom_struct;
+use servo_media::streams::device_monitor::MediaDeviceKind as ServoMediaDeviceKind;
+
+use crate::dom::bindings::codegen::Bindings::MediaDeviceInfoBinding::{
+ MediaDeviceInfoMethods, MediaDeviceKind,
+};
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 dom_struct::dom_struct;
-use servo_media::streams::device_monitor::MediaDeviceKind as ServoMediaDeviceKind;
#[dom_struct]
pub struct MediaDeviceInfo {
diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs
index 9a88ed2e3a2..dc7b6820448 100644
--- a/components/script/dom/mediadevices.rs
+++ b/components/script/dom/mediadevices.rs
@@ -2,13 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::MediaDevicesMethods;
-use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::MediaStreamConstraints;
-use crate::dom::bindings::codegen::UnionTypes::BooleanOrMediaTrackConstraints;
-use crate::dom::bindings::codegen::UnionTypes::ClampedUnsignedLongOrConstrainULongRange as ConstrainULong;
-use crate::dom::bindings::codegen::UnionTypes::DoubleOrConstrainDoubleRange as ConstrainDouble;
-use crate::dom::bindings::reflector::reflect_dom_object;
-use crate::dom::bindings::reflector::DomObject;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use servo_media::streams::capture::{Constrain, ConstrainRange, MediaTrackConstraintSet};
+use servo_media::streams::MediaStreamType;
+use servo_media::ServoMedia;
+
+use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::{
+ MediaDevicesMethods, MediaStreamConstraints,
+};
+use crate::dom::bindings::codegen::UnionTypes::{
+ BooleanOrMediaTrackConstraints, ClampedUnsignedLongOrConstrainULongRange as ConstrainULong,
+ DoubleOrConstrainDoubleRange as ConstrainDouble,
+};
+use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
@@ -17,11 +25,6 @@ use crate::dom::mediastream::MediaStream;
use crate::dom::mediastreamtrack::MediaStreamTrack;
use crate::dom::promise::Promise;
use crate::realms::{AlreadyInRealm, InRealm};
-use dom_struct::dom_struct;
-use servo_media::streams::capture::{Constrain, ConstrainRange, MediaTrackConstraintSet};
-use servo_media::streams::MediaStreamType;
-use servo_media::ServoMedia;
-use std::rc::Rc;
#[dom_struct]
pub struct MediaDevices {
diff --git a/components/script/dom/mediaelementaudiosourcenode.rs b/components/script/dom/mediaelementaudiosourcenode.rs
index 79746215559..4efc43e0418 100644
--- a/components/script/dom/mediaelementaudiosourcenode.rs
+++ b/components/script/dom/mediaelementaudiosourcenode.rs
@@ -2,20 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::sync::mpsc;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::media_element_source_node::MediaElementSourceNodeMessage;
+use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
+
use crate::dom::audiocontext::AudioContext;
use crate::dom::audionode::AudioNode;
-use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::MediaElementAudioSourceNodeMethods;
-use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::MediaElementAudioSourceOptions;
+use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::{
+ MediaElementAudioSourceNodeMethods, MediaElementAudioSourceOptions,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::media_element_source_node::MediaElementSourceNodeMessage;
-use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
-use std::sync::mpsc;
#[dom_struct]
pub struct MediaElementAudioSourceNode {
diff --git a/components/script/dom/mediaerror.rs b/components/script/dom/mediaerror.rs
index ace68e43583..d427d3846c7 100644
--- a/components/script/dom/mediaerror.rs
+++ b/components/script/dom/mediaerror.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct MediaError {
diff --git a/components/script/dom/mediafragmentparser.rs b/components/script/dom/mediafragmentparser.rs
index 2e9de4b0f8c..0f64a80fa4e 100644
--- a/components/script/dom/mediafragmentparser.rs
+++ b/components/script/dom/mediafragmentparser.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use chrono::NaiveDateTime;
-use servo_url::ServoUrl;
use std::borrow::Cow;
use std::collections::VecDeque;
use std::str::FromStr;
+
+use chrono::NaiveDateTime;
+use servo_url::ServoUrl;
use url::{form_urlencoded, Position, Url};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs
index 87a318ddbe2..208f3a7aed0 100644
--- a/components/script/dom/medialist.rs
+++ b/components/script/dom/medialist.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 https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods;
-use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-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;
-use crate::dom::window::Window;
use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
use servo_arc::Arc;
-use style::media_queries::MediaList as StyleMediaList;
-use style::media_queries::MediaQuery;
+use style::media_queries::{MediaList as StyleMediaList, MediaQuery};
use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::{CssRuleType, Origin};
use style_traits::{ParsingMode, ToCss};
+use crate::dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods;
+use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
+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;
+use crate::dom::window::Window;
+
#[dom_struct]
pub struct MediaList {
reflector_: Reflector,
diff --git a/components/script/dom/mediametadata.rs b/components/script/dom/mediametadata.rs
index 8e931dd0b4b..d5452680157 100644
--- a/components/script/dom/mediametadata.rs
+++ b/components/script/dom/mediametadata.rs
@@ -2,17 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataInit;
-use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataMethods;
+use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::{
+ MediaMetadataInit, MediaMetadataMethods,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::mediasession::MediaSession;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct MediaMetadata {
diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs
index 57140c8cb6f..a7ac80a395c 100644
--- a/components/script/dom/mediaquerylist.rs
+++ b/components/script/dom/mediaquerylist.rs
@@ -2,9 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use style::media_queries::MediaList;
+use style_traits::ToCss;
+
use crate::dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
-use crate::dom::bindings::codegen::Bindings::EventTargetBinding::AddEventListenerOptions;
-use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventListenerOptions;
+use crate::dom::bindings::codegen::Bindings::EventTargetBinding::{
+ AddEventListenerOptions, EventListenerOptions,
+};
use crate::dom::bindings::codegen::Bindings::MediaQueryListBinding::MediaQueryListMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::reflect_dom_object;
@@ -12,11 +20,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::eventtarget::EventTarget;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::rc::Rc;
-use style::media_queries::MediaList;
-use style_traits::ToCss;
pub enum MediaQueryListMatchState {
Same(bool),
diff --git a/components/script/dom/mediaquerylistevent.rs b/components/script/dom/mediaquerylistevent.rs
index c58dd3aee5c..9856cf8f39d 100644
--- a/components/script/dom/mediaquerylistevent.rs
+++ b/components/script/dom/mediaquerylistevent.rs
@@ -2,9 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::MediaQueryListEventBinding::MediaQueryListEventInit;
-use crate::dom::bindings::codegen::Bindings::MediaQueryListEventBinding::MediaQueryListEventMethods;
+use crate::dom::bindings::codegen::Bindings::MediaQueryListEventBinding::{
+ MediaQueryListEventInit, MediaQueryListEventMethods,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
@@ -13,10 +20,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-use std::cell::Cell;
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent
#[dom_struct]
diff --git a/components/script/dom/mediasession.rs b/components/script/dom/mediasession.rs
index edd73158acc..14ca4c14494 100644
--- a/components/script/dom/mediasession.rs
+++ b/components/script/dom/mediasession.rs
@@ -2,16 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use embedder_traits::{MediaMetadata as EmbedderMediaMetadata, MediaSessionEvent};
+use script_traits::{MediaSessionActionType, ScriptMsg};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
-use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataInit;
-use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataMethods;
-use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaPositionState;
-use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionAction;
-use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionActionHandler;
-use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionMethods;
-use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionPlaybackState;
+use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::{
+ MediaMetadataInit, MediaMetadataMethods,
+};
+use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::{
+ MediaPositionState, MediaSessionAction, MediaSessionActionHandler, MediaSessionMethods,
+ MediaSessionPlaybackState,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
@@ -21,14 +28,6 @@ use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::mediametadata::MediaMetadata;
use crate::dom::window::Window;
use crate::realms::{enter_realm, InRealm};
-use dom_struct::dom_struct;
-use embedder_traits::MediaMetadata as EmbedderMediaMetadata;
-use embedder_traits::MediaSessionEvent;
-use script_traits::MediaSessionActionType;
-use script_traits::ScriptMsg;
-use std::rc::Rc;
-
-use super::bindings::trace::HashMapTracedValues;
#[dom_struct]
pub struct MediaSession {
diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs
index 5e1b1dc5970..55da06cc74a 100644
--- a/components/script/dom/mediastream.rs
+++ b/components/script/dom/mediastream.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::streams::registry::MediaStreamId;
+use servo_media::streams::MediaStreamType;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::MediaStreamBinding::MediaStreamMethods;
use crate::dom::bindings::error::Fallible;
@@ -12,10 +17,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::mediastreamtrack::MediaStreamTrack;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::streams::registry::MediaStreamId;
-use servo_media::streams::MediaStreamType;
#[dom_struct]
pub struct MediaStream {
diff --git a/components/script/dom/mediastreamaudiodestinationnode.rs b/components/script/dom/mediastreamaudiodestinationnode.rs
index c7d060fb6a6..7409cfa98e2 100644
--- a/components/script/dom/mediastreamaudiodestinationnode.rs
+++ b/components/script/dom/mediastreamaudiodestinationnode.rs
@@ -2,11 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::AudioNodeInit;
+use servo_media::streams::MediaStreamType;
+use servo_media::ServoMedia;
+
use crate::dom::audiocontext::AudioContext;
use crate::dom::audionode::AudioNode;
-use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
- ChannelCountMode, ChannelInterpretation,
+ AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::codegen::Bindings::MediaStreamAudioDestinationNodeBinding::MediaStreamAudioDestinationNodeMethods;
use crate::dom::bindings::error::Fallible;
@@ -15,11 +20,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::mediastream::MediaStream;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::AudioNodeInit;
-use servo_media::streams::MediaStreamType;
-use servo_media::ServoMedia;
#[dom_struct]
pub struct MediaStreamAudioDestinationNode {
diff --git a/components/script/dom/mediastreamaudiosourcenode.rs b/components/script/dom/mediastreamaudiosourcenode.rs
index 4ac4e8cf9b4..c56851912db 100644
--- a/components/script/dom/mediastreamaudiosourcenode.rs
+++ b/components/script/dom/mediastreamaudiosourcenode.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::AudioNodeInit;
+use servo_media::streams::MediaStreamType;
+
use crate::dom::audiocontext::AudioContext;
use crate::dom::audionode::AudioNode;
use crate::dom::bindings::codegen::Bindings::MediaStreamAudioSourceNodeBinding::{
@@ -13,10 +18,6 @@ use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::mediastream::MediaStream;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::AudioNodeInit;
-use servo_media::streams::MediaStreamType;
#[dom_struct]
pub struct MediaStreamAudioSourceNode {
diff --git a/components/script/dom/mediastreamtrack.rs b/components/script/dom/mediastreamtrack.rs
index 729dbfc5cce..06950d5350e 100644
--- a/components/script/dom/mediastreamtrack.rs
+++ b/components/script/dom/mediastreamtrack.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_media::streams::registry::MediaStreamId;
+use servo_media::streams::MediaStreamType;
+
use crate::dom::bindings::codegen::Bindings::MediaStreamTrackBinding::MediaStreamTrackMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use servo_media::streams::registry::MediaStreamId;
-use servo_media::streams::MediaStreamType;
#[dom_struct]
pub struct MediaStreamTrack {
diff --git a/components/script/dom/mediastreamtrackaudiosourcenode.rs b/components/script/dom/mediastreamtrackaudiosourcenode.rs
index c5023d24abc..fa8b480764d 100644
--- a/components/script/dom/mediastreamtrackaudiosourcenode.rs
+++ b/components/script/dom/mediastreamtrackaudiosourcenode.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::AudioNodeInit;
+
use crate::dom::audiocontext::AudioContext;
use crate::dom::audionode::AudioNode;
use crate::dom::bindings::codegen::Bindings::MediaStreamTrackAudioSourceNodeBinding::MediaStreamTrackAudioSourceOptions;
@@ -11,9 +15,6 @@ use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::mediastreamtrack::MediaStreamTrack;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::AudioNodeInit;
#[dom_struct]
pub struct MediaStreamTrackAudioSourceNode {
diff --git a/components/script/dom/messagechannel.rs b/components/script/dom/messagechannel.rs
index 0b74c0e60d8..ca3d8738143 100644
--- a/components/script/dom/messagechannel.rs
+++ b/components/script/dom/messagechannel.rs
@@ -2,13 +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 dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::MessageChannelBinding::MessageChannelMethods;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::messageport::MessagePort;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct MessageChannel {
diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs
index 2e9f17cc31b..d398f67a309 100644
--- a/components/script/dom/messageevent.rs
+++ b/components/script/dom/messageevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::MessageEventBinding;
@@ -21,11 +27,6 @@ use crate::dom::messageport::MessagePort;
use crate::dom::serviceworker::ServiceWorker;
use crate::dom::windowproxy::WindowProxy;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
#[unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/messageport.rs b/components/script/dom/messageport.rs
index 3035cc5bcd4..f0de3a48e94 100644
--- a/components/script/dom/messageport.rs
+++ b/components/script/dom/messageport.rs
@@ -2,6 +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 std::cell::{Cell, RefCell};
+use std::collections::HashMap;
+use std::convert::TryInto;
+use std::num::NonZeroU32;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject, MutableHandleObject};
+use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
+use msg::constellation_msg::{MessagePortId, MessagePortIndex, PipelineNamespaceId};
+use script_traits::PortMessageTask;
+
use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use crate::dom::bindings::codegen::Bindings::MessagePortBinding::{
MessagePortMethods, PostMessageOptions,
@@ -17,17 +29,6 @@ use crate::dom::bindings::transferable::Transferable;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext as SafeJSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsapi::{JSObject, MutableHandleObject};
-use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
-use msg::constellation_msg::{MessagePortId, MessagePortIndex, PipelineNamespaceId};
-use script_traits::PortMessageTask;
-use std::cell::{Cell, RefCell};
-use std::collections::HashMap;
-use std::convert::TryInto;
-use std::num::NonZeroU32;
-use std::rc::Rc;
#[dom_struct]
/// The MessagePort used in the DOM.
diff --git a/components/script/dom/mimetype.rs b/components/script/dom/mimetype.rs
index 5e4db84fe27..437f2bd4fe9 100644
--- a/components/script/dom/mimetype.rs
+++ b/components/script/dom/mimetype.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::MimeTypeBinding::MimeTypeMethods;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::plugin::Plugin;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct MimeType {
diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs
index 9bbda92e231..0495a8d187e 100644
--- a/components/script/dom/mimetypearray.rs
+++ b/components/script/dom/mimetypearray.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::MimeTypeArrayBinding::MimeTypeArrayMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::mimetype::MimeType;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct MimeTypeArray {
diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs
index 670b058b0ba..ad8f9516fa4 100644
--- a/components/script/dom/mouseevent.rs
+++ b/components/script/dom/mouseevent.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use euclid::default::Point2D;
+use js::rust::HandleObject;
+use servo_config::pref;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::MouseEventBinding;
use crate::dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
@@ -16,12 +24,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::node::Node;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use euclid::default::Point2D;
-use js::rust::HandleObject;
-use servo_config::pref;
-use std::cell::Cell;
-use std::default::Default;
#[dom_struct]
pub struct MouseEvent {
diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs
index 8c558408d86..f52a80a6776 100644
--- a/components/script/dom/mutationobserver.rs
+++ b/components/script/dom/mutationobserver.rs
@@ -2,11 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use html5ever::{namespace_url, ns, LocalName, Namespace};
+use js::rust::HandleObject;
+
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCallback;
use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;
-use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;
+use crate::dom::bindings::codegen::Bindings::MutationObserverBinding::{
+ MutationCallback, MutationObserverInit,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
@@ -16,10 +23,6 @@ use crate::dom::node::{Node, ShadowIncluding};
use crate::dom::window::Window;
use crate::microtask::Microtask;
use crate::script_thread::ScriptThread;
-use dom_struct::dom_struct;
-use html5ever::{namespace_url, ns, LocalName, Namespace};
-use js::rust::HandleObject;
-use std::rc::Rc;
#[dom_struct]
pub struct MutationObserver {
diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs
index d880f44a8ae..4523958ae85 100644
--- a/components/script/dom/mutationrecord.rs
+++ b/components/script/dom/mutationrecord.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Namespace};
+
use crate::dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;
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::{window_from_node, Node};
use crate::dom::nodelist::NodeList;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Namespace};
#[dom_struct]
pub struct MutationRecord {
diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs
index a7c3e4fef86..d7121d2815d 100644
--- a/components/script/dom/namednodemap.rs
+++ b/components/script/dom/namednodemap.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::LocalName;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods;
@@ -12,8 +15,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::bindings::xmlname::namespace_from_domstring;
use crate::dom::element::Element;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use html5ever::LocalName;
#[dom_struct]
pub struct NamedNodeMap {
diff --git a/components/script/dom/navigationpreloadmanager.rs b/components/script/dom/navigationpreloadmanager.rs
index c8d74403fcd..011ad438f5c 100644
--- a/components/script/dom/navigationpreloadmanager.rs
+++ b/components/script/dom/navigationpreloadmanager.rs
@@ -2,8 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::NavigationPreloadManagerBinding::NavigationPreloadManagerMethods;
-use crate::dom::bindings::codegen::Bindings::NavigationPreloadManagerBinding::NavigationPreloadState;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsval::UndefinedValue;
+
+use crate::dom::bindings::codegen::Bindings::NavigationPreloadManagerBinding::{
+ NavigationPreloadManagerMethods, NavigationPreloadState,
+};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::ByteString;
@@ -12,9 +18,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::dom::serviceworkerregistration::ServiceWorkerRegistration;
use crate::realms::InRealm;
-use dom_struct::dom_struct;
-use js::jsval::UndefinedValue;
-use std::rc::Rc;
#[dom_struct]
pub struct NavigationPreloadManager {
diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs
index 07abebe667f..1271dd7bed3 100644
--- a/components/script/dom/navigator.rs
+++ b/components/script/dom/navigator.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsval::JSVal;
+
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -20,8 +23,6 @@ use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
use crate::dom::window::Window;
use crate::dom::xrsystem::XRSystem;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsval::JSVal;
#[dom_struct]
pub struct Navigator {
diff --git a/components/script/dom/navigatorinfo.rs b/components/script/dom/navigatorinfo.rs
index e674834f14b..5450677cb9b 100644
--- a/components/script/dom/navigatorinfo.rs
+++ b/components/script/dom/navigatorinfo.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::str::DOMString;
use std::borrow::Cow;
+use crate::dom::bindings::str::DOMString;
+
#[allow(non_snake_case)]
pub fn Product() -> DOMString {
DOMString::from("Gecko")
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 39655064bdd..4758c28717d 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -4,6 +4,46 @@
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
+use std::borrow::Cow;
+use std::cell::{Cell, UnsafeCell};
+use std::default::Default;
+use std::ops::Range;
+use std::slice::from_ref;
+use std::sync::Arc as StdArc;
+use std::{cmp, iter, mem};
+
+use app_units::Au;
+use bitflags::bitflags;
+use devtools_traits::NodeInfo;
+use dom_struct::dom_struct;
+use euclid::default::{Point2D, Rect, Size2D, Vector2D};
+use html5ever::{namespace_url, ns, Namespace, Prefix, QualName};
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use libc::{self, c_void, uintptr_t};
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use net_traits::image::base::{Image, ImageMetadata};
+use script_layout_interface::message::QueryMsg;
+use script_layout_interface::{
+ HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, SVGSVGData,
+ StyleAndOpaqueLayoutData, TrustedNodeAddress,
+};
+use script_traits::{DocumentActivity, UntrustedNodeAddress};
+use selectors::matching::{
+ matches_selector_list, MatchingContext, MatchingMode, NeedsSelectorFlags,
+};
+use selectors::parser::SelectorList;
+use servo_arc::Arc;
+use servo_url::ServoUrl;
+use smallvec::SmallVec;
+use style::context::QuirksMode;
+use style::dom::OpaqueNode;
+use style::properties::ComputedValues;
+use style::selector_parser::{SelectorImpl, SelectorParser};
+use style::stylesheets::Stylesheet;
+use uuid::Uuid;
+
use crate::document_loader::DocumentLoader;
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut};
@@ -23,9 +63,10 @@ use crate::dom::bindings::codegen::InheritTypes::DocumentFragmentTypeId;
use crate::dom::bindings::codegen::UnionTypes::NodeOrString;
use crate::dom::bindings::conversions::{self, DerivedFrom};
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, TextTypeId};
+use crate::dom::bindings::inheritance::{
+ Castable, CharacterDataTypeId, ElementTypeId, EventTargetTypeId, HTMLElementTypeId, NodeTypeId,
+ SVGElementTypeId, SVGGraphicsElementTypeId, TextTypeId,
+};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, DomObjectWrap};
use crate::dom::bindings::root::{Dom, DomRoot, DomSlice, LayoutDom, MutNullableDom};
use crate::dom::bindings::str::{DOMString, USVString};
@@ -63,46 +104,6 @@ use crate::dom::text::Text;
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
use crate::dom::window::Window;
use crate::script_thread::ScriptThread;
-use app_units::Au;
-use bitflags::bitflags;
-use devtools_traits::NodeInfo;
-use dom_struct::dom_struct;
-use euclid::default::{Point2D, Rect, Size2D, Vector2D};
-use html5ever::{namespace_url, ns, Namespace, Prefix, QualName};
-use js::jsapi::JSObject;
-
-use js::rust::HandleObject;
-use libc::{self, c_void, uintptr_t};
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use msg::constellation_msg::{BrowsingContextId, PipelineId};
-use net_traits::image::base::{Image, ImageMetadata};
-use script_layout_interface::message::QueryMsg;
-use script_layout_interface::{HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType};
-use script_layout_interface::{SVGSVGData, StyleAndOpaqueLayoutData, TrustedNodeAddress};
-use script_traits::DocumentActivity;
-use script_traits::UntrustedNodeAddress;
-use selectors::matching::{
- matches_selector_list, MatchingContext, MatchingMode, NeedsSelectorFlags,
-};
-use selectors::parser::SelectorList;
-use servo_arc::Arc;
-use servo_url::ServoUrl;
-use smallvec::SmallVec;
-use std::borrow::Cow;
-use std::cell::{Cell, UnsafeCell};
-use std::cmp;
-use std::default::Default;
-use std::iter;
-use std::mem;
-use std::ops::Range;
-use std::slice::from_ref;
-use std::sync::Arc as StdArc;
-use style::context::QuirksMode;
-use style::dom::OpaqueNode;
-use style::properties::ComputedValues;
-use style::selector_parser::{SelectorImpl, SelectorParser};
-use style::stylesheets::Stylesheet;
-use uuid::Uuid;
//
// The basic Node structure
diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs
index a141785a85d..1680a5dd3cd 100644
--- a/components/script/dom/nodeiterator.rs
+++ b/components/script/dom/nodeiterator.rs
@@ -2,19 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::callback::ExceptionHandling::Rethrow;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
-use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilter;
-use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
+use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::{NodeFilter, NodeFilterConstants};
use crate::dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, MutDom};
use crate::dom::document::Document;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::rc::Rc;
#[dom_struct]
pub struct NodeIterator {
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs
index b8286e5f0ea..64140f98222 100644
--- a/components/script/dom/nodelist.rs
+++ b/components/script/dom/nodelist.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -12,9 +17,6 @@ use crate::dom::htmlelement::HTMLElement;
use crate::dom::htmlformelement::HTMLFormElement;
use crate::dom::node::{ChildrenMutation, Node};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_atoms::Atom;
-use std::cell::Cell;
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
diff --git a/components/script/dom/offlineaudiocompletionevent.rs b/components/script/dom/offlineaudiocompletionevent.rs
index f5c39d5bfd4..2a3d9774b62 100644
--- a/components/script/dom/offlineaudiocompletionevent.rs
+++ b/components/script/dom/offlineaudiocompletionevent.rs
@@ -2,10 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::audiobuffer::AudioBuffer;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::OfflineAudioCompletionEventInit;
-use crate::dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::OfflineAudioCompletionEventMethods;
+use crate::dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::{
+ OfflineAudioCompletionEventInit, OfflineAudioCompletionEventMethods,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
@@ -13,9 +18,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct OfflineAudioCompletionEvent {
diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs
index 29e3335eeae..994e1f79adb 100644
--- a/components/script/dom/offlineaudiocontext.rs
+++ b/components/script/dom/offlineaudiocontext.rs
@@ -2,13 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+use std::sync::{mpsc, Arc, Mutex};
+use std::thread::Builder;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use msg::constellation_msg::PipelineId;
+use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions;
+
use crate::dom::audiobuffer::{AudioBuffer, MAX_SAMPLE_RATE, MIN_SAMPLE_RATE};
use crate::dom::audionode::MAX_CHANNEL_COUNT;
use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods;
-use crate::dom::bindings::codegen::Bindings::OfflineAudioContextBinding::OfflineAudioContextMethods;
-use crate::dom::bindings::codegen::Bindings::OfflineAudioContextBinding::OfflineAudioContextOptions;
+use crate::dom::bindings::codegen::Bindings::OfflineAudioContextBinding::{
+ OfflineAudioContextMethods, OfflineAudioContextOptions,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
@@ -21,15 +32,6 @@ use crate::dom::promise::Promise;
use crate::dom::window::Window;
use crate::realms::InRealm;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use msg::constellation_msg::PipelineId;
-use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions;
-use std::cell::Cell;
-use std::rc::Rc;
-use std::sync::mpsc;
-use std::sync::{Arc, Mutex};
-use std::thread::Builder;
#[dom_struct]
pub struct OfflineAudioContext {
diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs
index 0a03f91c4cc..9f1ce7333b6 100644
--- a/components/script/dom/offscreencanvas.rs
+++ b/components/script/dom/offscreencanvas.rs
@@ -2,13 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::canvas::{CanvasMsg, FromScriptMsg};
+use dom_struct::dom_struct;
+use euclid::default::Size2D;
+use ipc_channel::ipc::IpcSharedMemory;
+use js::rust::{HandleObject, HandleValue};
+use profile_traits::ipc;
+
use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::OffscreenCanvasBinding::{
OffscreenCanvasMethods, OffscreenRenderingContext,
};
use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::DomObject;
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::eventtarget::EventTarget;
@@ -16,13 +24,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
use crate::dom::offscreencanvasrenderingcontext2d::OffscreenCanvasRenderingContext2D;
use crate::script_runtime::JSContext;
-use canvas_traits::canvas::{CanvasMsg, FromScriptMsg};
-use dom_struct::dom_struct;
-use euclid::default::Size2D;
-use ipc_channel::ipc::IpcSharedMemory;
-use js::rust::{HandleObject, HandleValue};
-use profile_traits::ipc;
-use std::cell::Cell;
#[unrooted_must_root_lint::must_root]
#[derive(Clone, JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/offscreencanvasrenderingcontext2d.rs b/components/script/dom/offscreencanvasrenderingcontext2d.rs
index 8c3deb001f4..fe178fb462c 100644
--- a/components/script/dom/offscreencanvasrenderingcontext2d.rs
+++ b/components/script/dom/offscreencanvasrenderingcontext2d.rs
@@ -2,18 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
+use dom_struct::dom_struct;
+use euclid::default::Size2D;
+use ipc_channel::ipc::IpcSender;
+
use crate::canvas_state::CanvasState;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasDirection;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextAlign;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasTextBaseline;
+use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
+ CanvasDirection, CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
+ CanvasTextAlign, CanvasTextBaseline,
+};
use crate::dom::bindings::codegen::Bindings::OffscreenCanvasRenderingContext2DBinding::OffscreenCanvasRenderingContext2DMethods;
use crate::dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
-use crate::dom::bindings::error::ErrorResult;
-use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::error::{ErrorResult, Fallible};
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -26,10 +27,6 @@ use crate::dom::htmlcanvaselement::HTMLCanvasElement;
use crate::dom::imagedata::ImageData;
use crate::dom::offscreencanvas::OffscreenCanvas;
use crate::dom::textmetrics::TextMetrics;
-use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
-use dom_struct::dom_struct;
-use euclid::default::Size2D;
-use ipc_channel::ipc::IpcSender;
#[dom_struct]
pub struct OffscreenCanvasRenderingContext2D {
diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs
index 4f7c59a2e4d..15d6c875b1d 100644
--- a/components/script/dom/oscillatornode.rs
+++ b/components/script/dom/oscillatornode.rs
@@ -2,6 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
+use servo_media::audio::oscillator_node::{
+ OscillatorNodeMessage, OscillatorNodeOptions as ServoMediaOscillatorOptions,
+ OscillatorType as ServoMediaOscillatorType,
+};
+use servo_media::audio::param::ParamType;
+
use crate::dom::audioparam::AudioParam;
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
use crate::dom::baseaudiocontext::BaseAudioContext;
@@ -9,23 +21,13 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
-use crate::dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods;
use crate::dom::bindings::codegen::Bindings::OscillatorNodeBinding::{
- OscillatorOptions, OscillatorType,
+ OscillatorNodeMethods, OscillatorOptions, OscillatorType,
};
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
-use servo_media::audio::oscillator_node::OscillatorNodeMessage;
-use servo_media::audio::oscillator_node::OscillatorNodeOptions as ServoMediaOscillatorOptions;
-use servo_media::audio::oscillator_node::OscillatorType as ServoMediaOscillatorType;
-use servo_media::audio::param::ParamType;
-use std::cell::Cell;
-use std::f32;
#[dom_struct]
pub struct OscillatorNode {
diff --git a/components/script/dom/pagetransitionevent.rs b/components/script/dom/pagetransitionevent.rs
index c924c70c475..5eae74c24f6 100644
--- a/components/script/dom/pagetransitionevent.rs
+++ b/components/script/dom/pagetransitionevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::PageTransitionEventBinding;
use crate::dom::bindings::codegen::Bindings::PageTransitionEventBinding::PageTransitionEventMethods;
@@ -12,10 +18,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-use std::cell::Cell;
// https://html.spec.whatwg.org/multipage/#pagetransitionevent
#[dom_struct]
diff --git a/components/script/dom/paintrenderingcontext2d.rs b/components/script/dom/paintrenderingcontext2d.rs
index bdda5fc934e..316110b0fcd 100644
--- a/components/script/dom/paintrenderingcontext2d.rs
+++ b/components/script/dom/paintrenderingcontext2d.rs
@@ -2,15 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
-use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
+use std::cell::Cell;
+
+use canvas_traits::canvas::{CanvasImageData, CanvasMsg, FromLayoutMsg};
+use dom_struct::dom_struct;
+use euclid::{Scale, Size2D};
+use ipc_channel::ipc::IpcSender;
+use servo_url::ServoUrl;
+use style_traits::{CSSPixel, DevicePixel};
+
+use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
+ CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
+ CanvasRenderingContext2DMethods,
+};
use crate::dom::bindings::codegen::Bindings::PaintRenderingContext2DBinding::PaintRenderingContext2DMethods;
use crate::dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
-use crate::dom::bindings::error::ErrorResult;
-use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::error::{ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object;
@@ -21,16 +28,6 @@ use crate::dom::canvaspattern::CanvasPattern;
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
use crate::dom::dommatrix::DOMMatrix;
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
-use canvas_traits::canvas::CanvasImageData;
-use canvas_traits::canvas::CanvasMsg;
-use canvas_traits::canvas::FromLayoutMsg;
-use dom_struct::dom_struct;
-use euclid::{Scale, Size2D};
-use ipc_channel::ipc::IpcSender;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use style_traits::CSSPixel;
-use style_traits::DevicePixel;
#[dom_struct]
pub struct PaintRenderingContext2D {
diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs
index 5f6d0260096..900cfd8c6aa 100644
--- a/components/script/dom/paintsize.rs
+++ b/components/script/dom/paintsize.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 https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::Size2D;
+use style_traits::CSSPixel;
+
use crate::dom::bindings::codegen::Bindings::PaintSizeBinding::PaintSizeMethods;
use crate::dom::bindings::num::Finite;
-use crate::dom::bindings::reflector::reflect_dom_object;
-use crate::dom::bindings::reflector::Reflector;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
-use dom_struct::dom_struct;
-use euclid::Size2D;
-use style_traits::CSSPixel;
#[dom_struct]
pub struct PaintSize {
diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs
index ab16d75a672..bfd67470b19 100644
--- a/components/script/dom/paintworkletglobalscope.rs
+++ b/components/script/dom/paintworkletglobalscope.rs
@@ -2,15 +2,42 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::hash_map::Entry;
+use std::ptr::null_mut;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+use std::thread;
+use std::time::Duration;
+
+use crossbeam_channel::{unbounded, Sender};
+use dom_struct::dom_struct;
+use euclid::{Scale, Size2D};
+use js::jsapi::{
+ HandleValueArray, Heap, IsCallable, IsConstructor, JSAutoRealm, JSObject,
+ JS_ClearPendingException, JS_IsExceptionPending, NewArrayObject,
+};
+use js::jsval::{JSVal, ObjectValue, UndefinedValue};
+use js::rust::wrappers::{Call, Construct1};
+use js::rust::{HandleValue, Runtime};
+use msg::constellation_msg::PipelineId;
+use net_traits::image_cache::ImageCache;
+use pixels::PixelFormat;
+use profile_traits::ipc;
+use script_traits::{DrawAPaintImageResult, PaintWorkletError, Painter};
+use servo_atoms::Atom;
+use servo_config::pref;
+use servo_url::ServoUrl;
+use style_traits::{CSSPixel, DevicePixel, SpeculativePainter};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::callback::CallbackContainer;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PaintWorkletGlobalScopeBinding;
use crate::dom::bindings::codegen::Bindings::PaintWorkletGlobalScopeBinding::PaintWorkletGlobalScopeMethods;
use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction;
-use crate::dom::bindings::conversions::get_property;
-use crate::dom::bindings::conversions::get_property_jsval;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::conversions::{get_property, get_property_jsval};
+use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -20,52 +47,8 @@ use crate::dom::paintrenderingcontext2d::PaintRenderingContext2D;
use crate::dom::paintsize::PaintSize;
use crate::dom::stylepropertymapreadonly::StylePropertyMapReadOnly;
use crate::dom::worklet::WorkletExecutor;
-use crate::dom::workletglobalscope::WorkletGlobalScope;
-use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
-use crate::dom::workletglobalscope::WorkletTask;
+use crate::dom::workletglobalscope::{WorkletGlobalScope, WorkletGlobalScopeInit, WorkletTask};
use crate::script_runtime::JSContext;
-use crossbeam_channel::{unbounded, Sender};
-use dom_struct::dom_struct;
-use euclid::Scale;
-use euclid::Size2D;
-use js::jsapi::HandleValueArray;
-use js::jsapi::Heap;
-use js::jsapi::IsCallable;
-use js::jsapi::IsConstructor;
-use js::jsapi::JSAutoRealm;
-use js::jsapi::JSObject;
-use js::jsapi::JS_ClearPendingException;
-use js::jsapi::JS_IsExceptionPending;
-use js::jsapi::NewArrayObject;
-use js::jsval::JSVal;
-use js::jsval::ObjectValue;
-use js::jsval::UndefinedValue;
-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_cache::ImageCache;
-use pixels::PixelFormat;
-use profile_traits::ipc;
-use script_traits::Painter;
-use script_traits::{DrawAPaintImageResult, PaintWorkletError};
-use servo_atoms::Atom;
-use servo_config::pref;
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use std::collections::hash_map::Entry;
-use std::ptr::null_mut;
-use std::rc::Rc;
-use std::sync::Arc;
-use std::sync::Mutex;
-use std::thread;
-use std::time::Duration;
-use style_traits::CSSPixel;
-use style_traits::DevicePixel;
-use style_traits::SpeculativePainter;
-
-use super::bindings::trace::HashMapTracedValues;
/// <https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope>
#[dom_struct]
diff --git a/components/script/dom/pannernode.rs b/components/script/dom/pannernode.rs
index 48b572da260..3a617e50e70 100644
--- a/components/script/dom/pannernode.rs
+++ b/components/script/dom/pannernode.rs
@@ -2,6 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::f32;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
+use servo_media::audio::panner_node::{
+ DistanceModel, PannerNodeMessage, PannerNodeOptions, PanningModel,
+};
+use servo_media::audio::param::{ParamDir, ParamType};
+
use crate::dom::audionode::AudioNode;
use crate::dom::audioparam::AudioParam;
use crate::dom::baseaudiocontext::BaseAudioContext;
@@ -12,10 +23,7 @@ use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{
AudioParamMethods, AutomationRate,
};
use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{
- DistanceModelType, PanningModelType,
-};
-use crate::dom::bindings::codegen::Bindings::PannerNodeBinding::{
- PannerNodeMethods, PannerOptions,
+ DistanceModelType, PannerNodeMethods, PannerOptions, PanningModelType,
};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -23,14 +31,6 @@ use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
-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;
#[dom_struct]
pub struct PannerNode {
diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs
index c707160f66a..178f30a2a89 100644
--- a/components/script/dom/performance.rs
+++ b/components/script/dom/performance.rs
@@ -2,10 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::cmp::Ordering;
+use std::collections::VecDeque;
+
+use dom_struct::dom_struct;
+use metrics::ToMs;
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList;
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::{
- DOMHighResTimeStamp, PerformanceMethods,
+ DOMHighResTimeStamp, PerformanceEntryList as DOMPerformanceEntryList, PerformanceMethods,
};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -22,11 +28,6 @@ use crate::dom::performancenavigation::PerformanceNavigation;
use crate::dom::performancenavigationtiming::PerformanceNavigationTiming;
use crate::dom::performanceobserver::PerformanceObserver as DOMPerformanceObserver;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use metrics::ToMs;
-use std::cell::Cell;
-use std::cmp::Ordering;
-use std::collections::VecDeque;
const INVALID_ENTRY_NAMES: &'static [&'static str] = &[
"navigationStart",
diff --git a/components/script/dom/performanceentry.rs b/components/script/dom/performanceentry.rs
index 8197deb8976..326cc7f4311 100644
--- a/components/script/dom/performanceentry.rs
+++ b/components/script/dom/performanceentry.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::DOMHighResTimeStamp;
use crate::dom::bindings::codegen::Bindings::PerformanceEntryBinding::PerformanceEntryMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,7 +11,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::performance::reduce_timing_resolution;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct PerformanceEntry {
diff --git a/components/script/dom/performancenavigation.rs b/components/script/dom/performancenavigation.rs
index f52250b815c..9c07111d115 100644
--- a/components/script/dom/performancenavigation.rs
+++ b/components/script/dom/performancenavigation.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PerformanceNavigationBinding::{
PerformanceNavigationConstants, PerformanceNavigationMethods,
};
@@ -9,7 +11,6 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::Windo
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;
#[dom_struct]
pub struct PerformanceNavigation {
diff --git a/components/script/dom/performancenavigationtiming.rs b/components/script/dom/performancenavigationtiming.rs
index 5562427f1c9..631a711bbb5 100644
--- a/components/script/dom/performancenavigationtiming.rs
+++ b/components/script/dom/performancenavigationtiming.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 https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::DOMHighResTimeStamp;
-use crate::dom::bindings::codegen::Bindings::PerformanceNavigationTimingBinding::NavigationType;
-use crate::dom::bindings::codegen::Bindings::PerformanceNavigationTimingBinding::PerformanceNavigationTimingMethods;
+use crate::dom::bindings::codegen::Bindings::PerformanceNavigationTimingBinding::{
+ NavigationType, PerformanceNavigationTimingMethods,
+};
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::document::Document;
use crate::dom::globalscope::GlobalScope;
use crate::dom::performanceresourcetiming::{InitiatorType, PerformanceResourceTiming};
-use dom_struct::dom_struct;
#[dom_struct]
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming
diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs
index ca83fe7d361..067dd19a32a 100644
--- a/components/script/dom/performanceobserver.rs
+++ b/components/script/dom/performanceobserver.rs
@@ -2,12 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsval::JSVal;
+use js::rust::HandleObject;
+
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList;
-use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverCallback;
-use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverInit;
-use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverMethods;
+use crate::dom::bindings::codegen::Bindings::PerformanceObserverBinding::{
+ PerformanceObserverCallback, PerformanceObserverInit, PerformanceObserverMethods,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
@@ -18,11 +25,6 @@ use crate::dom::performance::PerformanceEntryList;
use crate::dom::performanceentry::PerformanceEntry;
use crate::dom::performanceobserverentrylist::PerformanceObserverEntryList;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsval::JSVal;
-use js::rust::HandleObject;
-use std::cell::Cell;
-use std::rc::Rc;
/// List of allowed performance entry types, in alphabetical order.
pub const VALID_ENTRY_TYPES: &'static [&'static str] = &[
diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs
index f96e063153e..913592b5ed4 100644
--- a/components/script/dom/performanceobserverentrylist.rs
+++ b/components/script/dom/performanceobserverentrylist.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -10,7 +12,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::performance::PerformanceEntryList;
use crate::dom::performanceentry::PerformanceEntry;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct PerformanceObserverEntryList {
diff --git a/components/script/dom/performancepainttiming.rs b/components/script/dom/performancepainttiming.rs
index 2dd3c27f1f1..a18a962b952 100644
--- a/components/script/dom/performancepainttiming.rs
+++ b/components/script/dom/performancepainttiming.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use metrics::ToMs;
+use script_traits::ProgressiveWebMetricType;
+
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::performanceentry::PerformanceEntry;
-use dom_struct::dom_struct;
-use metrics::ToMs;
-use script_traits::ProgressiveWebMetricType;
#[dom_struct]
pub struct PerformancePaintTiming {
diff --git a/components/script/dom/performanceresourcetiming.rs b/components/script/dom/performanceresourcetiming.rs
index c98b5140f60..4146528f185 100644
--- a/components/script/dom/performanceresourcetiming.rs
+++ b/components/script/dom/performanceresourcetiming.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use net_traits::ResourceFetchTiming;
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::DOMHighResTimeStamp;
use crate::dom::bindings::codegen::Bindings::PerformanceResourceTimingBinding::PerformanceResourceTimingMethods;
use crate::dom::bindings::reflector::reflect_dom_object;
@@ -10,9 +14,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::performance::reduce_timing_resolution;
use crate::dom::performanceentry::PerformanceEntry;
-use dom_struct::dom_struct;
-use net_traits::ResourceFetchTiming;
-use servo_url::ServoUrl;
// TODO UA may choose to limit how many resources are included as PerformanceResourceTiming objects
// recommended minimum is 150, can be changed by setResourceTimingBufferSize in performance
diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs
index 2d7cd549cc2..adf071e5f38 100644
--- a/components/script/dom/permissions.rs
+++ b/components/script/dom/permissions.rs
@@ -2,10 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionDescriptor;
-use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use embedder_traits::{self, EmbedderMsg, PermissionPrompt, PermissionRequest};
+use ipc_channel::ipc;
+use js::conversions::ConversionResult;
+use js::jsapi::JSObject;
+use js::jsval::{ObjectValue, UndefinedValue};
+use servo_config::pref;
+
use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{
- PermissionName, PermissionState,
+ PermissionDescriptor, PermissionName, PermissionState, PermissionStatusMethods,
};
use crate::dom::bindings::codegen::Bindings::PermissionsBinding::PermissionsMethods;
use crate::dom::bindings::error::Error;
@@ -18,14 +26,6 @@ use crate::dom::permissionstatus::PermissionStatus;
use crate::dom::promise::Promise;
use crate::realms::{AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use embedder_traits::{self, EmbedderMsg, PermissionPrompt, PermissionRequest};
-use ipc_channel::ipc;
-use js::conversions::ConversionResult;
-use js::jsapi::JSObject;
-use js::jsval::{ObjectValue, UndefinedValue};
-use servo_config::pref;
-use std::rc::Rc;
pub trait PermissionAlgorithm {
type Descriptor;
diff --git a/components/script/dom/permissionstatus.rs b/components/script/dom/permissionstatus.rs
index 8f8b96f23de..e210b5087fc 100644
--- a/components/script/dom/permissionstatus.rs
+++ b/components/script/dom/permissionstatus.rs
@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState;
-use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods;
+use std::cell::Cell;
+use std::fmt::{self, Display, Formatter};
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{
- PermissionDescriptor, PermissionName,
+ PermissionDescriptor, PermissionName, PermissionState, PermissionStatusMethods,
};
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::fmt::{self, Display, Formatter};
// https://w3c.github.io/permissions/#permissionstatus
#[dom_struct]
diff --git a/components/script/dom/plugin.rs b/components/script/dom/plugin.rs
index 83c8e252556..4b23191ff22 100644
--- a/components/script/dom/plugin.rs
+++ b/components/script/dom/plugin.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PluginBinding::PluginMethods;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::mimetype::MimeType;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct Plugin {
diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs
index b063d55fb02..a0afeb1f102 100644
--- a/components/script/dom/pluginarray.rs
+++ b/components/script/dom/pluginarray.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::plugin::Plugin;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct PluginArray {
diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs
index 9d6b2c24c7f..ca6363cdec1 100644
--- a/components/script/dom/popstateevent.rs
+++ b/components/script/dom/popstateevent.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::PopStateEventBinding;
use crate::dom::bindings::codegen::Bindings::PopStateEventBinding::PopStateEventMethods;
@@ -15,11 +21,6 @@ use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface
#[dom_struct]
diff --git a/components/script/dom/processinginstruction.rs b/components/script/dom/processinginstruction.rs
index 9edbf1a0a29..756335eb37c 100644
--- a/components/script/dom/processinginstruction.rs
+++ b/components/script/dom/processinginstruction.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::characterdata::CharacterData;
use crate::dom::document::Document;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
/// An HTML processing instruction node.
#[dom_struct]
diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs
index 93e687e53b3..edae658756b 100644
--- a/components/script/dom/progressevent.rs
+++ b/components/script/dom/progressevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::ProgressEventBinding;
use crate::dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods;
@@ -12,9 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct ProgressEvent {
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs
index 2ba29d20db6..ce84609f79a 100644
--- a/components/script/dom/promise.rs
+++ b/components/script/dom/promise.rs
@@ -11,6 +11,25 @@
//! native Promise values that refer to the same JS value yet are distinct native objects
//! (ie. address equality for the native objects is meaningless).
+use std::ptr;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::{
+ AddRawValueRoot, CallArgs, GetFunctionNativeReserved, Heap, JSAutoRealm, JSContext, JSObject,
+ JS_ClearPendingException, JS_GetFunctionObject, JS_NewFunction, NewFunctionWithReserved,
+ PromiseState, PromiseUserInputEventHandlingState, RemoveRawValueRoot,
+ SetFunctionNativeReserved,
+};
+use js::jsval::{Int32Value, JSVal, ObjectValue, UndefinedValue};
+use js::rust::wrappers::{
+ AddPromiseReactions, CallOriginalPromiseReject, CallOriginalPromiseResolve, GetPromiseState,
+ IsPromiseObject, NewPromiseObject, RejectPromise, ResolvePromise,
+ SetPromiseUserInputEventHandlingState,
+};
+use js::rust::{HandleObject, HandleValue, MutableHandleObject, Runtime};
+
use crate::dom::bindings::conversions::root_from_object;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
@@ -21,23 +40,6 @@ use crate::dom::promisenativehandler::PromiseNativeHandler;
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
use crate::script_thread::ScriptThread;
-use dom_struct::dom_struct;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::{AddRawValueRoot, CallArgs, GetFunctionNativeReserved};
-use js::jsapi::{Heap, JS_ClearPendingException};
-use js::jsapi::{JSAutoRealm, JSContext, JSObject, JS_GetFunctionObject};
-use js::jsapi::{JS_NewFunction, NewFunctionWithReserved};
-use js::jsapi::{PromiseState, PromiseUserInputEventHandlingState};
-use js::jsapi::{RemoveRawValueRoot, SetFunctionNativeReserved};
-use js::jsval::{Int32Value, JSVal, ObjectValue, UndefinedValue};
-use js::rust::wrappers::{
- AddPromiseReactions, CallOriginalPromiseReject, CallOriginalPromiseResolve,
-};
-use js::rust::wrappers::{GetPromiseState, IsPromiseObject, NewPromiseObject, RejectPromise};
-use js::rust::wrappers::{ResolvePromise, SetPromiseUserInputEventHandlingState};
-use js::rust::{HandleObject, HandleValue, MutableHandleObject, Runtime};
-use std::ptr;
-use std::rc::Rc;
#[dom_struct]
#[unrooted_must_root_lint::allow_unrooted_in_rc]
diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs
index a5039d1f0b6..16dd520137d 100644
--- a/components/script/dom/promisenativehandler.rs
+++ b/components/script/dom/promisenativehandler.rs
@@ -2,16 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsapi::JSContext;
+use js::rust::HandleValue;
+use malloc_size_of::MallocSizeOf;
+
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::globalscope::GlobalScope;
use crate::realms::InRealm;
use crate::script_runtime::JSContext as SafeJSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JSContext;
-use js::rust::HandleValue;
-use malloc_size_of::MallocSizeOf;
pub trait Callback: JSTraceable + MallocSizeOf {
fn callback(&self, cx: SafeJSContext, v: HandleValue, realm: InRealm);
diff --git a/components/script/dom/promiserejectionevent.rs b/components/script/dom/promiserejectionevent.rs
index 0ac02f8c439..334ed691b0a 100644
--- a/components/script/dom/promiserejectionevent.rs
+++ b/components/script/dom/promiserejectionevent.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsapi::Heap;
+use js::jsval::JSVal;
+use js::rust::{HandleObject, HandleValue};
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding;
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding::PromiseRejectionEventMethods;
@@ -15,12 +23,6 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::Heap;
-use js::jsval::JSVal;
-use js::rust::{HandleObject, HandleValue};
-use servo_atoms::Atom;
-use std::rc::Rc;
#[dom_struct]
pub struct PromiseRejectionEvent {
diff --git a/components/script/dom/radionodelist.rs b/components/script/dom/radionodelist.rs
index 958652da9f7..9ada855850a 100644
--- a/components/script/dom/radionodelist.rs
+++ b/components/script/dom/radionodelist.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use crate::dom::bindings::codegen::Bindings::RadioNodeListBinding::RadioNodeListMethods;
@@ -14,8 +17,6 @@ use crate::dom::htmlinputelement::{HTMLInputElement, InputType};
use crate::dom::node::Node;
use crate::dom::nodelist::{NodeList, NodeListType, RadioList, RadioListMode};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_atoms::Atom;
#[dom_struct]
pub struct RadioNodeList {
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index edcac751212..9e25ab29016 100644
--- a/components/script/dom/range.rs
+++ b/components/script/dom/range.rs
@@ -2,18 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::{Cell, UnsafeCell};
+use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
+
+use deny_public_fields::DenyPublicFields;
+use dom_struct::dom_struct;
+use js::jsapi::JSTracer;
+use js::rust::HandleObject;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
-use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeConstants;
-use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
+use crate::dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods};
use crate::dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
-use crate::dom::bindings::codegen::Bindings::RangeBinding::RangeConstants;
-use crate::dom::bindings::codegen::Bindings::RangeBinding::RangeMethods;
+use crate::dom::bindings::codegen::Bindings::RangeBinding::{RangeConstants, RangeMethods};
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::Castable;
-use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
+use crate::dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, MutDom};
use crate::dom::bindings::str::DOMString;
@@ -28,13 +34,6 @@ use crate::dom::node::{Node, ShadowIncluding, UnbindContext};
use crate::dom::selection::Selection;
use crate::dom::text::Text;
use crate::dom::window::Window;
-use deny_public_fields::DenyPublicFields;
-use dom_struct::dom_struct;
-use js::jsapi::JSTracer;
-use js::rust::HandleObject;
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use std::cell::{Cell, UnsafeCell};
-use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
#[dom_struct]
pub struct Range {
diff --git a/components/script/dom/raredata.rs b/components/script/dom/raredata.rs
index 1a4916f1694..54f46250530 100644
--- a/components/script/dom/raredata.rs
+++ b/components/script/dom/raredata.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use euclid::default::Rect;
+use servo_atoms::Atom;
+
use crate::dom::bindings::root::Dom;
use crate::dom::customelementregistry::{
CustomElementDefinition, CustomElementReaction, CustomElementState,
@@ -10,9 +15,6 @@ use crate::dom::mutationobserver::RegisteredObserver;
use crate::dom::node::UniqueId;
use crate::dom::shadowroot::ShadowRoot;
use crate::dom::window::LayoutValue;
-use euclid::default::Rect;
-use servo_atoms::Atom;
-use std::rc::Rc;
//XXX(ferjm) Ideally merge NodeRareData and ElementRareData so they share
// storage.
diff --git a/components/script/dom/readablestream.rs b/components/script/dom/readablestream.rs
index 746f094045c..563ba5ce977 100644
--- a/components/script/dom/readablestream.rs
+++ b/components/script/dom/readablestream.rs
@@ -2,6 +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 std::cell::{Cell, RefCell};
+use std::os::raw::c_void;
+use std::ptr::{self, NonNull};
+use std::rc::Rc;
+use std::slice;
+
+use dom_struct::dom_struct;
+use js::glue::{
+ CreateReadableStreamUnderlyingSource, DeleteReadableStreamUnderlyingSource,
+ ReadableStreamUnderlyingSourceTraps,
+};
+use js::jsapi::{
+ AutoRequireNoGC, HandleObject, HandleValue, Heap, IsReadableStream, JSContext, JSObject,
+ JS_GetArrayBufferViewData, NewReadableExternalSourceStreamObject, ReadableStreamClose,
+ ReadableStreamDefaultReaderRead, ReadableStreamError, ReadableStreamGetReader,
+ ReadableStreamIsDisturbed, ReadableStreamIsLocked, ReadableStreamIsReadable,
+ ReadableStreamReaderMode, ReadableStreamReaderReleaseLock, ReadableStreamUnderlyingSource,
+ ReadableStreamUpdateDataAvailableFromSource, UnwrapReadableStream,
+};
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::{HandleValue as SafeHandleValue, IntoHandle};
+
use crate::dom::bindings::conversions::{ConversionBehavior, ConversionResult};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
@@ -13,29 +35,6 @@ use crate::dom::promise::Promise;
use crate::js::conversions::FromJSValConvertible;
use crate::realms::{enter_realm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
-use dom_struct::dom_struct;
-use js::glue::{
- CreateReadableStreamUnderlyingSource, DeleteReadableStreamUnderlyingSource,
- ReadableStreamUnderlyingSourceTraps,
-};
-use js::jsapi::{
- AutoRequireNoGC, IsReadableStream, JS_GetArrayBufferViewData,
- NewReadableExternalSourceStreamObject, ReadableStreamClose, ReadableStreamDefaultReaderRead,
- ReadableStreamError, ReadableStreamGetReader, ReadableStreamIsDisturbed,
- ReadableStreamIsLocked, ReadableStreamIsReadable, ReadableStreamReaderMode,
- ReadableStreamReaderReleaseLock, ReadableStreamUnderlyingSource,
- ReadableStreamUpdateDataAvailableFromSource, UnwrapReadableStream,
-};
-use js::jsapi::{HandleObject, HandleValue, Heap, JSContext, JSObject};
-use js::jsval::JSVal;
-use js::jsval::UndefinedValue;
-use js::rust::HandleValue as SafeHandleValue;
-use js::rust::IntoHandle;
-use std::cell::{Cell, RefCell};
-use std::os::raw::c_void;
-use std::ptr::{self, NonNull};
-use std::rc::Rc;
-use std::slice;
static UNDERLYING_SOURCE_TRAPS: ReadableStreamUnderlyingSourceTraps =
ReadableStreamUnderlyingSourceTraps {
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index a2699351674..dbbfad8af1a 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -2,19 +2,33 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::body::Extractable;
-use crate::body::{consume_body, BodyMixin, BodyType};
+use std::ptr::NonNull;
+use std::rc::Rc;
+use std::str::FromStr;
+
+use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
+use dom_struct::dom_struct;
+use http::header::{HeaderName, HeaderValue};
+use http::method::InvalidMethod;
+use http::Method as HttpMethod;
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use net_traits::request::{
+ CacheMode as NetTraitsRequestCache, CredentialsMode as NetTraitsRequestCredentials,
+ Destination as NetTraitsRequestDestination, Origin, RedirectMode as NetTraitsRequestRedirect,
+ Referrer as NetTraitsRequestReferrer, Request as NetTraitsRequest,
+ RequestMode as NetTraitsRequestMode, Window,
+};
+use net_traits::ReferrerPolicy as MsgReferrerPolicy;
+use servo_url::ServoUrl;
+
+use crate::body::{consume_body, BodyMixin, BodyType, Extractable};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
-use crate::dom::bindings::codegen::Bindings::RequestBinding::ReferrerPolicy;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCache;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentials;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestDestination;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
-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::codegen::Bindings::RequestBinding::{
+ ReferrerPolicy, RequestCache, RequestCredentials, RequestDestination, RequestInfo, RequestInit,
+ RequestMethods, RequestMode, RequestRedirect,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -25,26 +39,6 @@ use crate::dom::headers::{Guard, Headers};
use crate::dom::promise::Promise;
use crate::dom::readablestream::ReadableStream;
use crate::script_runtime::JSContext as SafeJSContext;
-use cssparser::{_cssparser_internal_to_lowercase, match_ignore_ascii_case};
-use dom_struct::dom_struct;
-use http::header::{HeaderName, HeaderValue};
-use http::method::InvalidMethod;
-use http::Method as HttpMethod;
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use net_traits::request::CacheMode as NetTraitsRequestCache;
-use net_traits::request::CredentialsMode as NetTraitsRequestCredentials;
-use net_traits::request::Destination as NetTraitsRequestDestination;
-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::ptr::NonNull;
-use std::rc::Rc;
-use std::str::FromStr;
#[dom_struct]
pub struct Request {
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs
index bf4d858c9c3..068729c9509 100644
--- a/components/script/dom/response.rs
+++ b/components/script/dom/response.rs
@@ -2,8 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::body::{consume_body, BodyMixin, BodyType};
-use crate::body::{Extractable, ExtractedBody};
+use std::ptr::NonNull;
+use std::rc::Rc;
+use std::str::FromStr;
+
+use dom_struct::dom_struct;
+use http::header::HeaderMap as HyperHeaders;
+use http::StatusCode;
+use hyper_serde::Serde;
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use servo_url::ServoUrl;
+use url::Position;
+
+use crate::body::{consume_body, BodyMixin, BodyType, Extractable, ExtractedBody};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
use crate::dom::bindings::codegen::Bindings::ResponseBinding;
@@ -16,23 +28,10 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject,
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::str::{ByteString, USVString};
use crate::dom::globalscope::GlobalScope;
-use crate::dom::headers::{is_obs_text, is_vchar};
-use crate::dom::headers::{Guard, Headers};
+use crate::dom::headers::{is_obs_text, is_vchar, Guard, Headers};
use crate::dom::promise::Promise;
use crate::dom::readablestream::{ExternalUnderlyingSource, ReadableStream};
-use crate::script_runtime::JSContext as SafeJSContext;
-use crate::script_runtime::StreamConsumer;
-use dom_struct::dom_struct;
-use http::header::HeaderMap as HyperHeaders;
-use http::StatusCode;
-use hyper_serde::Serde;
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use servo_url::ServoUrl;
-use std::ptr::NonNull;
-use std::rc::Rc;
-use std::str::FromStr;
-use url::Position;
+use crate::script_runtime::{JSContext as SafeJSContext, StreamConsumer};
#[dom_struct]
pub struct Response {
diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs
index 6fefea60812..50be50a573b 100644
--- a/components/script/dom/rtcdatachannel.rs
+++ b/components/script/dom/rtcdatachannel.rs
@@ -2,10 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::ptr;
+
+use dom_struct::dom_struct;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::{JSAutoRealm, JSObject};
+use js::jsval::UndefinedValue;
+use js::rust::CustomAutoRooterGuard;
+use js::typedarray::{ArrayBuffer, ArrayBufferView, CreateWith};
+use script_traits::serializable::BlobImpl;
+use servo_media::webrtc::{
+ DataChannelId, DataChannelInit, DataChannelMessage, DataChannelState, WebRtcError,
+};
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::RTCDataChannelInit;
-use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::RTCDataChannelMethods;
-use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::RTCDataChannelState;
+use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::{
+ RTCDataChannelInit, RTCDataChannelMethods, RTCDataChannelState,
+};
use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::{RTCErrorDetailType, RTCErrorInit};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -20,18 +34,6 @@ use crate::dom::messageevent::MessageEvent;
use crate::dom::rtcerror::RTCError;
use crate::dom::rtcerrorevent::RTCErrorEvent;
use crate::dom::rtcpeerconnection::RTCPeerConnection;
-use dom_struct::dom_struct;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::{JSAutoRealm, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::CustomAutoRooterGuard;
-use js::typedarray::{ArrayBuffer, ArrayBufferView, CreateWith};
-use script_traits::serializable::BlobImpl;
-use servo_media::webrtc::{
- DataChannelId, DataChannelInit, DataChannelMessage, DataChannelState, WebRtcError,
-};
-use std::cell::Cell;
-use std::ptr;
#[dom_struct]
pub struct RTCDataChannel {
diff --git a/components/script/dom/rtcdatachannelevent.rs b/components/script/dom/rtcdatachannelevent.rs
index 7008f4f630e..d104315d103 100644
--- a/components/script/dom/rtcdatachannelevent.rs
+++ b/components/script/dom/rtcdatachannelevent.rs
@@ -2,9 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::RTCDataChannelEventBinding::RTCDataChannelEventInit;
-use crate::dom::bindings::codegen::Bindings::RTCDataChannelEventBinding::RTCDataChannelEventMethods;
+use crate::dom::bindings::codegen::Bindings::RTCDataChannelEventBinding::{
+ RTCDataChannelEventInit, RTCDataChannelEventMethods,
+};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -13,9 +18,6 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::rtcdatachannel::RTCDataChannel;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct RTCDataChannelEvent {
diff --git a/components/script/dom/rtcerror.rs b/components/script/dom/rtcerror.rs
index bb1bb9c1225..d4cb4d454af 100644
--- a/components/script/dom/rtcerror.rs
+++ b/components/script/dom/rtcerror.rs
@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorDetailType;
-use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorInit;
-use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorMethods;
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
+use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::{
+ RTCErrorDetailType, RTCErrorInit, RTCErrorMethods,
+};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::domexception::{DOMErrorName, DOMException};
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct RTCError {
diff --git a/components/script/dom/rtcerrorevent.rs b/components/script/dom/rtcerrorevent.rs
index de95817e759..0cf9a4ed196 100644
--- a/components/script/dom/rtcerrorevent.rs
+++ b/components/script/dom/rtcerrorevent.rs
@@ -2,9 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::RTCErrorEventBinding::RTCErrorEventInit;
-use crate::dom::bindings::codegen::Bindings::RTCErrorEventBinding::RTCErrorEventMethods;
+use crate::dom::bindings::codegen::Bindings::RTCErrorEventBinding::{
+ RTCErrorEventInit, RTCErrorEventMethods,
+};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -13,9 +18,6 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::rtcerror::RTCError;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct RTCErrorEvent {
diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs
index 0346224d19b..8d190662723 100644
--- a/components/script/dom/rtcicecandidate.rs
+++ b/components/script/dom/rtcicecandidate.rs
@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit;
-use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateMethods;
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
+use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::{
+ RTCIceCandidateInit, RTCIceCandidateMethods,
+};
use crate::dom::bindings::error::{Error, Fallible};
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::{DomObject, Reflector};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct RTCIceCandidate {
diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs
index 93600b4f209..86d11209369 100644
--- a/components/script/dom/rtcpeerconnection.rs
+++ b/components/script/dom/rtcpeerconnection.rs
@@ -2,24 +2,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::collections::HashMap;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::streams::registry::MediaStreamId;
+use servo_media::streams::MediaStreamType;
+use servo_media::webrtc::{
+ BundlePolicy, DataChannelEvent, DataChannelId, DataChannelState, GatheringState, IceCandidate,
+ IceConnectionState, SdpType, SessionDescription, SignalingState, WebRtcController,
+ WebRtcSignaller,
+};
+use servo_media::ServoMedia;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::RTCDataChannelInit;
use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit;
-use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods;
use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{
RTCAnswerOptions, RTCBundlePolicy, RTCConfiguration, RTCIceConnectionState,
- RTCIceGatheringState, RTCOfferOptions, RTCRtpTransceiverInit, RTCSignalingState,
+ RTCIceGatheringState, RTCOfferOptions, RTCPeerConnectionMethods, RTCRtpTransceiverInit,
+ RTCSignalingState,
};
use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{
RTCSdpType, RTCSessionDescriptionInit,
};
use crate::dom::bindings::codegen::UnionTypes::{MediaStreamTrackOrString, StringOrStringSequence};
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::DomObject;
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::str::USVString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
@@ -40,20 +53,6 @@ use crate::realms::{enter_realm, InRealm};
use crate::task::TaskCanceller;
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::streams::registry::MediaStreamId;
-use servo_media::streams::MediaStreamType;
-use servo_media::webrtc::{
- BundlePolicy, DataChannelEvent, DataChannelId, DataChannelState, GatheringState, IceCandidate,
- IceConnectionState, SdpType, SessionDescription, SignalingState, WebRtcController,
- WebRtcSignaller,
-};
-use servo_media::ServoMedia;
-
-use std::cell::Cell;
-use std::collections::HashMap;
-use std::rc::Rc;
#[dom_struct]
pub struct RTCPeerConnection {
diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs
index e0cae1d6bb6..2a77fd70d84 100644
--- a/components/script/dom/rtcpeerconnectioniceevent.rs
+++ b/components/script/dom/rtcpeerconnectioniceevent.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 https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::RTCPeerConnectionIceEventInit;
-use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::RTCPeerConnectionIceEventMethods;
+use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::{
+ RTCPeerConnectionIceEventInit, RTCPeerConnectionIceEventMethods,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::DomObject;
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::rtcicecandidate::RTCIceCandidate;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct RTCPeerConnectionIceEvent {
diff --git a/components/script/dom/rtcrtpsender.rs b/components/script/dom/rtcrtpsender.rs
index 10be5a6d79a..0526ec06303 100644
--- a/components/script/dom/rtcrtpsender.rs
+++ b/components/script/dom/rtcrtpsender.rs
@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::RTCRtpSenderBinding::RTCRtpSenderMethods;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::RTCRtpSenderBinding::{
- RTCRtcpParameters, RTCRtpParameters, RTCRtpSendParameters,
+ RTCRtcpParameters, RTCRtpParameters, RTCRtpSendParameters, RTCRtpSenderMethods,
};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
-use dom_struct::dom_struct;
-use std::rc::Rc;
#[dom_struct]
pub struct RTCRtpSender {
diff --git a/components/script/dom/rtcrtptransceiver.rs b/components/script/dom/rtcrtptransceiver.rs
index 5c041bb1ae6..ebf7cac6375 100644
--- a/components/script/dom/rtcrtptransceiver.rs
+++ b/components/script/dom/rtcrtptransceiver.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::RTCRtpTransceiverBinding::{
RTCRtpTransceiverDirection, RTCRtpTransceiverMethods,
};
@@ -9,8 +13,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::rtcrtpsender::RTCRtpSender;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct RTCRtpTransceiver {
diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs
index 07feb795d7f..46de2c33873 100644
--- a/components/script/dom/rtcsessiondescription.rs
+++ b/components/script/dom/rtcsessiondescription.rs
@@ -2,19 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::RTCSessionDescriptionMethods;
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{
- RTCSdpType, RTCSessionDescriptionInit,
+ RTCSdpType, RTCSessionDescriptionInit, RTCSessionDescriptionMethods,
};
use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::{DomObject, Reflector};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct RTCSessionDescription {
diff --git a/components/script/dom/rtctrackevent.rs b/components/script/dom/rtctrackevent.rs
index 74eebf49e97..55523607faa 100644
--- a/components/script/dom/rtctrackevent.rs
+++ b/components/script/dom/rtctrackevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::RTCTrackEventBinding::{self, RTCTrackEventMethods};
use crate::dom::bindings::error::Fallible;
@@ -13,9 +17,6 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::mediastreamtrack::MediaStreamTrack;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct RTCTrackEvent {
diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs
index 18e137346e5..8ee40adff25 100644
--- a/components/script/dom/screen.rs
+++ b/components/script/dom/screen.rs
@@ -2,14 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::num::Finite;
-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;
use dom_struct::dom_struct;
use euclid::Size2D;
use profile_traits::ipc;
@@ -17,6 +9,14 @@ use script_traits::ScriptMsg;
use style_traits::CSSPixel;
use webrender_api::units::DeviceIntSize;
+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::{reflect_dom_object, DomObject, Reflector};
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::globalscope::GlobalScope;
+use crate::dom::window::Window;
+
#[dom_struct]
pub struct Screen {
reflector_: Reflector,
diff --git a/components/script/dom/selection.rs b/components/script/dom/selection.rs
index 75348556ba0..ade8b3eff9f 100644
--- a/components/script/dom/selection.rs
+++ b/components/script/dom/selection.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, NodeMethods};
use crate::dom::bindings::codegen::Bindings::RangeBinding::RangeMethods;
use crate::dom::bindings::codegen::Bindings::SelectionBinding::SelectionMethods;
@@ -16,8 +20,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::node::{window_from_node, Node};
use crate::dom::range::Range;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
enum Direction {
diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs
index b01fc2a1d97..021192a95fa 100644
--- a/components/script/dom/serviceworker.rs
+++ b/components/script/dom/serviceworker.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject};
+use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
+use msg::constellation_msg::ServiceWorkerId;
+use script_traits::{DOMMessage, ScriptMsg};
+use servo_url::ServoUrl;
+
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::MessagePortBinding::PostMessageOptions;
@@ -20,13 +29,6 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
use crate::task::TaskOnce;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
-use msg::constellation_msg::ServiceWorkerId;
-use script_traits::{DOMMessage, ScriptMsg};
-use servo_url::ServoUrl;
-use std::cell::Cell;
pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>;
diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs
index b02b72e2c5b..f1a76b58493 100644
--- a/components/script/dom/serviceworkercontainer.rs
+++ b/components/script/dom/serviceworkercontainer.rs
@@ -2,8 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions;
-use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::ServiceWorkerContainerMethods;
+use std::default::Default;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use script_traits::{Job, JobError, JobResult, JobResultValue, JobType, ScriptMsg};
+
+use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{
+ RegistrationOptions, ServiceWorkerContainerMethods,
+};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::refcounted::TrustedPromise;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
@@ -15,18 +24,10 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::dom::serviceworker::ServiceWorker;
use crate::dom::serviceworkerregistration::ServiceWorkerRegistration;
-use crate::realms::enter_realm;
-use crate::realms::InRealm;
+use crate::realms::{enter_realm, InRealm};
use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
-use crate::task_source::TaskSource;
-use crate::task_source::TaskSourceName;
-use dom_struct::dom_struct;
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use script_traits::{Job, JobError, JobResult, JobResultValue, JobType, ScriptMsg};
-use std::default::Default;
-use std::rc::Rc;
+use crate::task_source::{TaskSource, TaskSourceName};
#[dom_struct]
pub struct ServiceWorkerContainer {
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index f5221e04be3..cbbb63ea998 100644
--- a/components/script/dom/serviceworkerglobalscope.rs
+++ b/components/script/dom/serviceworkerglobalscope.rs
@@ -2,6 +2,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::sync::atomic::AtomicBool;
+use std::sync::Arc;
+use std::thread::{self, JoinHandle};
+use std::time::{Duration, Instant};
+
+use crossbeam_channel::{after, unbounded, Receiver, Sender};
+use devtools_traits::DevtoolScriptControlMsg;
+use dom_struct::dom_struct;
+use ipc_channel::ipc::{IpcReceiver, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::jsapi::{JSContext, JS_AddInterruptCallback};
+use js::jsval::UndefinedValue;
+use msg::constellation_msg::PipelineId;
+use net_traits::request::{CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder};
+use net_traits::{CustomResponseMediator, IpcSend};
+use parking_lot::Mutex;
+use script_traits::{ScopeThings, ServiceWorkerMsg, WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
+use servo_config::pref;
+use servo_rand::random;
+use servo_url::ServoUrl;
+use style::thread_state::{self, ThreadState};
+
use crate::devtools;
use crate::dom::abstractworker::WorkerScriptMsg;
use crate::dom::abstractworkerglobalscope::{run_worker_event_loop, WorkerEventLoopMethods};
@@ -29,26 +51,6 @@ use crate::script_runtime::{
};
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
use crate::task_source::TaskSourceName;
-use crossbeam_channel::{after, unbounded, Receiver, Sender};
-use devtools_traits::DevtoolScriptControlMsg;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::{IpcReceiver, IpcSender};
-use ipc_channel::router::ROUTER;
-use js::jsapi::{JSContext, JS_AddInterruptCallback};
-use js::jsval::UndefinedValue;
-use msg::constellation_msg::PipelineId;
-use net_traits::request::{CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder};
-use net_traits::{CustomResponseMediator, IpcSend};
-use parking_lot::Mutex;
-use script_traits::{ScopeThings, ServiceWorkerMsg, WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
-use servo_config::pref;
-use servo_rand::random;
-use servo_url::ServoUrl;
-use std::sync::atomic::AtomicBool;
-use std::sync::Arc;
-use std::thread::{self, JoinHandle};
-use std::time::{Duration, Instant};
-use style::thread_state::{self, ThreadState};
/// Messages used to control service worker event loop
pub enum ServiceWorkerScriptMsg {
diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs
index d9438880f7b..6134979343b 100644
--- a/components/script/dom/serviceworkerregistration.rs
+++ b/components/script/dom/serviceworkerregistration.rs
@@ -2,9 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use devtools_traits::WorkerId;
+use dom_struct::dom_struct;
+use msg::constellation_msg::ServiceWorkerRegistrationId;
+use script_traits::{ScopeThings, WorkerScriptLoadOrigin};
+use servo_url::ServoUrl;
+use uuid::Uuid;
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::ServiceWorkerRegistrationMethods;
-use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::ServiceWorkerUpdateViaCache;
+use crate::dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{
+ ServiceWorkerRegistrationMethods, ServiceWorkerUpdateViaCache,
+};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::str::{ByteString, USVString};
@@ -13,13 +23,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::navigationpreloadmanager::NavigationPreloadManager;
use crate::dom::serviceworker::ServiceWorker;
use crate::dom::workerglobalscope::prepare_workerscope_init;
-use devtools_traits::WorkerId;
-use dom_struct::dom_struct;
-use msg::constellation_msg::ServiceWorkerRegistrationId;
-use script_traits::{ScopeThings, WorkerScriptLoadOrigin};
-use servo_url::ServoUrl;
-use std::cell::Cell;
-use uuid::Uuid;
#[dom_struct]
pub struct ServiceWorkerRegistration {
diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs
index 5b063dcc78a..a06749a7fd0 100644
--- a/components/script/dom/servoparser/async_html.rs
+++ b/components/script/dom/servoparser/async_html.rs
@@ -4,6 +4,27 @@
#![allow(unrooted_must_root)]
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::collections::vec_deque::VecDeque;
+use std::collections::HashMap;
+use std::thread;
+
+use crossbeam_channel::{unbounded, Receiver, Sender};
+use html5ever::buffer_queue::BufferQueue;
+use html5ever::tendril::fmt::UTF8;
+use html5ever::tendril::{SendTendril, StrTendril, Tendril};
+use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
+use html5ever::tree_builder::{
+ ElementFlags, NextParserState, NodeOrText as HtmlNodeOrText, QuirksMode, TreeBuilder,
+ TreeBuilderOpts, TreeSink,
+};
+use html5ever::{
+ local_name, namespace_url, ns, Attribute as HtmlAttribute, ExpandedName, QualName,
+};
+use servo_url::ServoUrl;
+use style::context::QuirksMode as ServoQuirksMode;
+
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -20,25 +41,6 @@ use crate::dom::node::Node;
use crate::dom::processinginstruction::ProcessingInstruction;
use crate::dom::servoparser::{create_element_for_token, ElementAttribute, ParsingAlgorithm};
use crate::dom::virtualmethods::vtable_for;
-use crossbeam_channel::{unbounded, Receiver, Sender};
-use html5ever::buffer_queue::BufferQueue;
-use html5ever::tendril::fmt::UTF8;
-use html5ever::tendril::{SendTendril, StrTendril, Tendril};
-use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
-use html5ever::tree_builder::{
- ElementFlags, NextParserState, NodeOrText as HtmlNodeOrText, QuirksMode, TreeSink,
-};
-use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
-use html5ever::{
- local_name, namespace_url, ns, Attribute as HtmlAttribute, ExpandedName, QualName,
-};
-use servo_url::ServoUrl;
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::collections::vec_deque::VecDeque;
-use std::collections::HashMap;
-use std::thread;
-use style::context::QuirksMode as ServoQuirksMode;
type ParseNodeId = usize;
diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs
index 3d1daad5424..cb98ca785a0 100644
--- a/components/script/dom/servoparser/html.rs
+++ b/components/script/dom/servoparser/html.rs
@@ -4,6 +4,17 @@
#![allow(unrooted_must_root)]
+use std::io;
+
+use html5ever::buffer_queue::BufferQueue;
+use html5ever::serialize::TraversalScope::IncludeNode;
+use html5ever::serialize::{AttrRef, Serialize, Serializer, TraversalScope};
+use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
+use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts};
+use html5ever::QualName;
+use js::jsapi::JSTracer;
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use crate::dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -18,16 +29,6 @@ use crate::dom::htmltemplateelement::HTMLTemplateElement;
use crate::dom::node::Node;
use crate::dom::processinginstruction::ProcessingInstruction;
use crate::dom::servoparser::{ParsingAlgorithm, Sink};
-use html5ever::buffer_queue::BufferQueue;
-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;
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs
index db5aed41962..ce99735e8b3 100644
--- a/components/script/dom/servoparser/mod.rs
+++ b/components/script/dom/servoparser/mod.rs
@@ -2,6 +2,38 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::mem;
+
+use base64::engine::general_purpose;
+use base64::Engine as _;
+use content_security_policy::{self as csp, CspList};
+use dom_struct::dom_struct;
+use embedder_traits::resources::{self, Resource};
+use encoding_rs::Encoding;
+use html5ever::buffer_queue::BufferQueue;
+use html5ever::tendril::fmt::UTF8;
+use html5ever::tendril::{ByteTendril, StrTendril, TendrilSink};
+use html5ever::tokenizer::TokenizerResult;
+use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksMode, TreeSink};
+use html5ever::{local_name, namespace_url, ns, Attribute, ExpandedName, LocalName, QualName};
+use hyper_serde::Serde;
+use mime::{self, Mime};
+use msg::constellation_msg::PipelineId;
+use net_traits::{
+ FetchMetadata, FetchResponseListener, Metadata, NetworkError, ResourceFetchTiming,
+ ResourceTimingType,
+};
+use profile_traits::time::{
+ profile, ProfilerCategory, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType,
+};
+use script_traits::DocumentActivity;
+use servo_config::pref;
+use servo_url::ServoUrl;
+use style::context::QuirksMode as ServoQuirksMode;
+use tendril::stream::LossyDecoder;
+
use crate::document_loader::{DocumentLoader, LoadType};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
@@ -36,33 +68,6 @@ use crate::dom::virtualmethods::vtable_for;
use crate::network_listener::PreInvoke;
use crate::realms::enter_realm;
use crate::script_thread::ScriptThread;
-use base64::{engine::general_purpose, Engine as _};
-use content_security_policy::{self as csp, CspList};
-use dom_struct::dom_struct;
-use embedder_traits::resources::{self, Resource};
-use encoding_rs::Encoding;
-use html5ever::buffer_queue::BufferQueue;
-use html5ever::tendril::fmt::UTF8;
-use html5ever::tendril::{ByteTendril, StrTendril, TendrilSink};
-use html5ever::tokenizer::TokenizerResult;
-use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksMode, TreeSink};
-use html5ever::{local_name, namespace_url, ns, Attribute, ExpandedName, LocalName, QualName};
-use hyper_serde::Serde;
-use mime::{self, Mime};
-use msg::constellation_msg::PipelineId;
-use net_traits::{FetchMetadata, FetchResponseListener, Metadata, NetworkError};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use profile_traits::time::{
- profile, ProfilerCategory, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType,
-};
-use script_traits::DocumentActivity;
-use servo_config::pref;
-use servo_url::ServoUrl;
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::mem;
-use style::context::QuirksMode as ServoQuirksMode;
-use tendril::stream::LossyDecoder;
mod async_html;
mod html;
diff --git a/components/script/dom/servoparser/prefetch.rs b/components/script/dom/servoparser/prefetch.rs
index 73db542984c..65c103e66df 100644
--- a/components/script/dom/servoparser/prefetch.rs
+++ b/components/script/dom/servoparser/prefetch.rs
@@ -2,6 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use html5ever::buffer_queue::BufferQueue;
+use html5ever::tokenizer::states::RawKind;
+use html5ever::tokenizer::{
+ Tag, TagKind, Token, TokenSink, TokenSinkResult, Tokenizer as HtmlTokenizer, TokenizerResult,
+};
+use html5ever::{local_name, Attribute, LocalName};
+use js::jsapi::JSTracer;
+use msg::constellation_msg::PipelineId;
+use net_traits::request::{CorsSettings, CredentialsMode, ParserMetadata, Referrer};
+use net_traits::{CoreResourceMsg, FetchChannels, IpcSend, ReferrerPolicy, ResourceThreads};
+use servo_url::{ImmutableOrigin, ServoUrl};
+
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};
use crate::dom::document::{determine_policy_for_token, Document};
@@ -9,30 +21,6 @@ use crate::dom::htmlimageelement::{image_fetch_request, FromPictureOrSrcSet};
use crate::dom::htmlscriptelement::script_fetch_request;
use crate::script_module::ScriptFetchOptions;
use crate::stylesheet_loader::stylesheet_fetch_request;
-use html5ever::buffer_queue::BufferQueue;
-use html5ever::tokenizer::states::RawKind;
-use html5ever::tokenizer::Tag;
-use html5ever::tokenizer::TagKind;
-use html5ever::tokenizer::Token;
-use html5ever::tokenizer::TokenSink;
-use html5ever::tokenizer::TokenSinkResult;
-use html5ever::tokenizer::Tokenizer as HtmlTokenizer;
-use html5ever::tokenizer::TokenizerResult;
-use html5ever::Attribute;
-use html5ever::{local_name, LocalName};
-use js::jsapi::JSTracer;
-use msg::constellation_msg::PipelineId;
-use net_traits::request::CorsSettings;
-use net_traits::request::CredentialsMode;
-use net_traits::request::ParserMetadata;
-use net_traits::request::Referrer;
-use net_traits::CoreResourceMsg;
-use net_traits::FetchChannels;
-use net_traits::IpcSend;
-use net_traits::ReferrerPolicy;
-use net_traits::ResourceThreads;
-use servo_url::ImmutableOrigin;
-use servo_url::ServoUrl;
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs
index 6ee1b464a6d..583c90fba61 100644
--- a/components/script/dom/servoparser/xml.rs
+++ b/components/script/dom/servoparser/xml.rs
@@ -4,12 +4,6 @@
#![allow(unrooted_must_root)]
-use crate::dom::bindings::root::{Dom, DomRoot};
-use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};
-use crate::dom::document::Document;
-use crate::dom::htmlscriptelement::HTMLScriptElement;
-use crate::dom::node::Node;
-use crate::dom::servoparser::{ParsingAlgorithm, Sink};
use html5ever::tokenizer::TokenizerResult;
use js::jsapi::JSTracer;
use servo_url::ServoUrl;
@@ -17,6 +11,13 @@ use xml5ever::buffer_queue::BufferQueue;
use xml5ever::tokenizer::XmlTokenizer;
use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder};
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};
+use crate::dom::document::Document;
+use crate::dom::htmlscriptelement::HTMLScriptElement;
+use crate::dom::node::Node;
+use crate::dom::servoparser::{ParsingAlgorithm, Sink};
+
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
pub struct Tokenizer {
diff --git a/components/script/dom/shadowroot.rs b/components/script/dom/shadowroot.rs
index 24441391f94..084a83650a4 100644
--- a/components/script/dom/shadowroot.rs
+++ b/components/script/dom/shadowroot.rs
@@ -2,6 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use servo_atoms::Atom;
+use style::author_styles::AuthorStyles;
+use style::dom::TElement;
+use style::shared_lock::SharedRwLockReadGuard;
+use style::stylesheets::Stylesheet;
+use style::stylist::{CascadeData, Stylist};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::ShadowRootBinding::ShadowRootMethods;
use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::ShadowRootMode;
@@ -18,14 +27,6 @@ use crate::dom::node::{Node, NodeDamage, NodeFlags, ShadowIncluding, UnbindConte
use crate::dom::stylesheetlist::{StyleSheetList, StyleSheetListOwner};
use crate::dom::window::Window;
use crate::stylesheet_set::StylesheetSetRef;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use servo_atoms::Atom;
-use style::author_styles::AuthorStyles;
-use style::dom::TElement;
-use style::shared_lock::SharedRwLockReadGuard;
-use style::stylesheets::Stylesheet;
-use style::stylist::{CascadeData, Stylist};
/// Whether a shadow root hosts an User Agent widget.
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
diff --git a/components/script/dom/stereopannernode.rs b/components/script/dom/stereopannernode.rs
index 96d5e8014bc..e8cd8701572 100644
--- a/components/script/dom/stereopannernode.rs
+++ b/components/script/dom/stereopannernode.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_media::audio::node::AudioNodeInit;
+use servo_media::audio::param::ParamType;
+use servo_media::audio::stereo_panner::StereoPannerOptions as ServoMediaStereoPannerOptions;
+
use crate::dom::audioparam::AudioParam;
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
use crate::dom::baseaudiocontext::BaseAudioContext;
@@ -9,17 +15,13 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelInterpretation,
};
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
-use crate::dom::bindings::codegen::Bindings::StereoPannerNodeBinding::StereoPannerNodeMethods;
-use crate::dom::bindings::codegen::Bindings::StereoPannerNodeBinding::StereoPannerOptions;
+use crate::dom::bindings::codegen::Bindings::StereoPannerNodeBinding::{
+ StereoPannerNodeMethods, StereoPannerOptions,
+};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_media::audio::node::AudioNodeInit;
-use servo_media::audio::param::ParamType;
-use servo_media::audio::stereo_panner::StereoPannerOptions as ServoMediaStereoPannerOptions;
#[dom_struct]
pub struct StereoPannerNode {
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 10746abe10b..7e02c2f1ca4 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use net_traits::storage_thread::{StorageThreadMsg, StorageType};
+use net_traits::IpcSend;
+use profile_traits::ipc;
+use script_traits::ScriptMsg;
+use servo_url::ServoUrl;
+
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::inheritance::Castable;
@@ -13,13 +21,6 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::storageevent::StorageEvent;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use net_traits::storage_thread::{StorageThreadMsg, StorageType};
-use net_traits::IpcSend;
-use profile_traits::ipc;
-use script_traits::ScriptMsg;
-use servo_url::ServoUrl;
#[dom_struct]
pub struct Storage {
diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs
index e9bc8e73063..eb17166d395 100644
--- a/components/script/dom/storageevent.rs
+++ b/components/script/dom/storageevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::StorageEventBinding;
@@ -14,9 +18,6 @@ use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::storage::Storage;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct StorageEvent {
diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs
index f64c9cfc54a..d2c84b1fecb 100644
--- a/components/script/dom/stylepropertymapreadonly.rs
+++ b/components/script/dom/stylepropertymapreadonly.rs
@@ -2,20 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods;
-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;
-use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use servo_atoms::Atom;
use std::cmp::Ordering;
use std::iter::Iterator;
+
+use dom_struct::dom_struct;
+use servo_atoms::Atom;
use style::custom_properties;
use super::bindings::trace::HashMapTracedValues;
+use crate::dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::bindings::str::DOMString;
+use crate::dom::cssstylevalue::CSSStyleValue;
+use crate::dom::globalscope::GlobalScope;
#[dom_struct]
pub struct StylePropertyMapReadOnly {
diff --git a/components/script/dom/stylesheet.rs b/components/script/dom/stylesheet.rs
index c03776dc7f6..d48356e4b92 100644
--- a/components/script/dom/stylesheet.rs
+++ b/components/script/dom/stylesheet.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::Reflector;
@@ -10,7 +12,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::element::Element;
use crate::dom::medialist::MediaList;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct StyleSheet {
diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs
index 7bd115f5084..4d561aa56fd 100644
--- a/components/script/dom/stylesheetlist.rs
+++ b/components/script/dom/stylesheetlist.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_arc::Arc;
+use style::stylesheets::Stylesheet;
+
use crate::dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -11,9 +15,6 @@ use crate::dom::element::Element;
use crate::dom::shadowroot::ShadowRoot;
use crate::dom::stylesheet::StyleSheet;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use servo_arc::Arc;
-use style::stylesheets::Stylesheet;
#[unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/submitevent.rs b/components/script/dom/submitevent.rs
index 01db87705b3..524b8a883ba 100644
--- a/components/script/dom/submitevent.rs
+++ b/components/script/dom/submitevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::SubmitEventBinding;
use crate::dom::bindings::codegen::Bindings::SubmitEventBinding::SubmitEventMethods;
@@ -13,9 +17,6 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
#[allow(non_snake_case)]
diff --git a/components/script/dom/svgelement.rs b/components/script/dom/svgelement.rs
index dc1620f2598..c4975d1178c 100644
--- a/components/script/dom/svgelement.rs
+++ b/components/script/dom/svgelement.rs
@@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use style::element_state::ElementState;
+
use crate::dom::bindings::codegen::Bindings::SVGElementBinding::SVGElementMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
use crate::dom::document::Document;
use crate::dom::element::Element;
-use crate::dom::node::window_from_node;
-use crate::dom::node::Node;
+use crate::dom::node::{window_from_node, Node};
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use style::element_state::ElementState;
#[dom_struct]
pub struct SVGElement {
diff --git a/components/script/dom/svggraphicselement.rs b/components/script/dom/svggraphicselement.rs
index f3322f98888..4ba18af76aa 100644
--- a/components/script/dom/svggraphicselement.rs
+++ b/components/script/dom/svggraphicselement.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{LocalName, Prefix};
+use style::element_state::ElementState;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::document::Document;
use crate::dom::svgelement::SVGElement;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
-use style::element_state::ElementState;
#[dom_struct]
pub struct SVGGraphicsElement {
diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs
index f903c3b2735..4240b3aa657 100644
--- a/components/script/dom/svgsvgelement.rs
+++ b/components/script/dom/svgsvgelement.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
+use js::rust::HandleObject;
+use script_layout_interface::SVGSVGData;
+use style::attr::AttrValue;
+
use crate::dom::attr::Attr;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{DomRoot, LayoutDom};
@@ -11,11 +17,6 @@ use crate::dom::element::{AttributeMutation, Element, LayoutElementHelpers};
use crate::dom::node::Node;
use crate::dom::svggraphicselement::SVGGraphicsElement;
use crate::dom::virtualmethods::VirtualMethods;
-use dom_struct::dom_struct;
-use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
-use js::rust::HandleObject;
-use script_layout_interface::SVGSVGData;
-use style::attr::AttrValue;
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 369b9a8a058..071bccdec75 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -4,37 +4,35 @@
// check-tidy: no specs after this line
+use std::borrow::ToOwned;
+use std::ptr;
+use std::ptr::NonNull;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::jsapi::{Heap, JSObject, JS_NewPlainObject, JS_NewUint8ClampedArray};
+use js::jsval::{JSVal, NullValue};
+use js::rust::{CustomAutoRooterGuard, HandleObject, HandleValue};
+use js::typedarray;
+use script_traits::serializable::BlobImpl;
+use script_traits::MsDuration;
+use servo_config::prefs;
+
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::SimpleCallback;
-use crate::dom::bindings::codegen::Bindings::TestBindingBinding::TestDictionaryParent;
-use crate::dom::bindings::codegen::Bindings::TestBindingBinding::TestDictionaryWithParent;
use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{
- TestBindingMethods, TestDictionary,
-};
-use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{
- TestDictionaryDefaults, TestEnum, TestURLLike,
+ SimpleCallback, TestBindingMethods, TestDictionary, TestDictionaryDefaults,
+ TestDictionaryParent, TestDictionaryWithParent, TestEnum, TestURLLike,
};
use crate::dom::bindings::codegen::UnionTypes;
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::{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::{StringOrBoolean, UnsignedLongOrBoolean};
-use crate::dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence};
-use crate::dom::bindings::codegen::UnionTypes::{
- StringOrUnsignedLong, StringSequenceOrUnsignedLong,
+ BlobOrBlobSequence, BlobOrBoolean, BlobOrString, BlobOrUnsignedLong, ByteStringOrLong,
+ ByteStringSequenceOrLong, ByteStringSequenceOrLongOrString, DocumentOrTestTypedef,
+ EventOrString, EventOrUSVString, HTMLElementOrLong, HTMLElementOrUnsignedLongOrStringOrBoolean,
+ LongOrLongSequenceSequence, LongSequenceOrBoolean, LongSequenceOrTestTypedef, StringOrBoolean,
+ StringOrLongSequence, StringOrStringSequence, StringOrUnsignedLong,
+ StringSequenceOrUnsignedLong, UnsignedLongOrBoolean,
};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::num::Finite;
@@ -54,20 +52,6 @@ use crate::dom::url::URL;
use crate::realms::InRealm;
use crate::script_runtime::JSContext as SafeJSContext;
use crate::timers::OneshotTimerCallback;
-use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSObject};
-use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray};
-use js::jsval::{JSVal, NullValue};
-use js::rust::CustomAutoRooterGuard;
-use js::rust::{HandleObject, HandleValue};
-use js::typedarray;
-use script_traits::serializable::BlobImpl;
-use script_traits::MsDuration;
-use servo_config::prefs;
-use std::borrow::ToOwned;
-use std::ptr;
-use std::ptr::NonNull;
-use std::rc::Rc;
#[dom_struct]
pub struct TestBinding {
diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs
index bfbc4478cc2..a60569f5510 100644
--- a/components/script/dom/testbindingiterable.rs
+++ b/components/script/dom/testbindingiterable.rs
@@ -4,6 +4,9 @@
// check-tidy: no specs after this line
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestBindingIterableBinding::TestBindingIterableMethods;
use crate::dom::bindings::error::Fallible;
@@ -11,8 +14,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct TestBindingIterable {
diff --git a/components/script/dom/testbindingmaplike.rs b/components/script/dom/testbindingmaplike.rs
index 83ebcce4646..19dbcf9da8f 100644
--- a/components/script/dom/testbindingmaplike.rs
+++ b/components/script/dom/testbindingmaplike.rs
@@ -4,6 +4,11 @@
// check-tidy: no specs after this line
+use dom_struct::dom_struct;
+use indexmap::IndexMap;
+use js::rust::HandleObject;
+
+use super::bindings::error::Error;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeBinding::TestBindingMaplikeMethods;
use crate::dom::bindings::error::Fallible;
@@ -13,11 +18,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::maplike;
-use dom_struct::dom_struct;
-use indexmap::IndexMap;
-use js::rust::HandleObject;
-
-use super::bindings::error::Error;
/// maplike<DOMString, long>
#[dom_struct]
diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs
index 4f394ce84bb..15ff3c2c752 100644
--- a/components/script/dom/testbindingpairiterable.rs
+++ b/components/script/dom/testbindingpairiterable.rs
@@ -4,6 +4,9 @@
// check-tidy: no specs after this line
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindingPairIterableMethods;
use crate::dom::bindings::error::Fallible;
@@ -12,8 +15,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct TestBindingPairIterable {
diff --git a/components/script/dom/testbindingproxy.rs b/components/script/dom/testbindingproxy.rs
index 3b352acb097..55be0bfc28b 100644
--- a/components/script/dom/testbindingproxy.rs
+++ b/components/script/dom/testbindingproxy.rs
@@ -4,10 +4,11 @@
// check-tidy: no specs after this line
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TestBindingProxyBinding::TestBindingProxyMethods;
use crate::dom::bindings::str::DOMString;
use crate::dom::testbinding::TestBinding;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct TestBindingProxy {
diff --git a/components/script/dom/testbindingsetlike.rs b/components/script/dom/testbindingsetlike.rs
index 9d62afaf653..f39e8f69514 100644
--- a/components/script/dom/testbindingsetlike.rs
+++ b/components/script/dom/testbindingsetlike.rs
@@ -4,6 +4,11 @@
// check-tidy: no specs after this line
+use dom_struct::dom_struct;
+use indexmap::IndexSet;
+use js::rust::HandleObject;
+
+use super::bindings::like::Setlike;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestBindingSetlikeBinding::TestBindingSetlikeMethods;
use crate::dom::bindings::error::Fallible;
@@ -12,11 +17,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::setlike;
-use dom_struct::dom_struct;
-use indexmap::IndexSet;
-use js::rust::HandleObject;
-
-use super::bindings::like::Setlike;
// setlike<DOMString>
#[dom_struct]
diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs
index ac354905d25..6d9a68c9db4 100644
--- a/components/script/dom/testrunner.rs
+++ b/components/script/dom/testrunner.rs
@@ -2,16 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use bluetooth_traits::BluetoothRequest;
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use profile_traits::ipc;
+
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use bluetooth_traits::BluetoothRequest;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use profile_traits::ipc;
// https://webbluetoothcg.github.io/web-bluetooth/tests#test-runner
#[dom_struct]
diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs
index f9d5591758a..fbc25a06dea 100644
--- a/components/script/dom/testworklet.rs
+++ b/components/script/dom/testworklet.rs
@@ -3,24 +3,24 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// check-tidy: no specs after this line
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::TestWorkletBinding::TestWorkletMethods;
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::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::Reflector;
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
-use crate::dom::bindings::str::DOMString;
-use crate::dom::bindings::str::USVString;
+use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::promise::Promise;
use crate::dom::window::Window;
use crate::dom::worklet::Worklet;
use crate::dom::workletglobalscope::WorkletGlobalScopeType;
use crate::realms::InRealm;
use crate::script_thread::ScriptThread;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::rc::Rc;
#[dom_struct]
pub struct TestWorklet {
diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs
index c67e1536457..71c20ad9966 100644
--- a/components/script/dom/testworkletglobalscope.rs
+++ b/components/script/dom/testworkletglobalscope.rs
@@ -2,21 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashMap;
+
+use crossbeam_channel::Sender;
+use dom_struct::dom_struct;
+use js::rust::Runtime;
+use msg::constellation_msg::PipelineId;
+use servo_url::ServoUrl;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding;
use crate::dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding::TestWorkletGlobalScopeMethods;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::worklet::WorkletExecutor;
-use crate::dom::workletglobalscope::WorkletGlobalScope;
-use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
+use crate::dom::workletglobalscope::{WorkletGlobalScope, WorkletGlobalScopeInit};
use crate::script_runtime::JSContext;
-use crossbeam_channel::Sender;
-use dom_struct::dom_struct;
-use js::rust::Runtime;
-use msg::constellation_msg::PipelineId;
-use servo_url::ServoUrl;
-use std::collections::HashMap;
// check-tidy: no specs after this line
diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs
index bc436517cd2..cdacdb85024 100644
--- a/components/script/dom/text.rs
+++ b/components/script/dom/text.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
@@ -15,8 +18,6 @@ use crate::dom::characterdata::CharacterData;
use crate::dom::document::Document;
use crate::dom::node::Node;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
/// An HTML text node.
#[dom_struct]
diff --git a/components/script/dom/textcontrol.rs b/components/script/dom/textcontrol.rs
index 0f215b4cbc8..38ffb5eccf6 100644
--- a/components/script/dom/textcontrol.rs
+++ b/components/script/dom/textcontrol.rs
@@ -7,6 +7,8 @@
//!
//! https://html.spec.whatwg.org/multipage/#textFieldSelection
+use script_traits::ScriptToConstellationChan;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLFormElementBinding::SelectionMode;
use crate::dom::bindings::conversions::DerivedFrom;
@@ -16,7 +18,6 @@ use crate::dom::event::{EventBubbles, EventCancelable};
use crate::dom::eventtarget::EventTarget;
use crate::dom::node::{window_from_node, Node, NodeDamage};
use crate::textinput::{SelectionDirection, SelectionState, TextInput, UTF8Bytes};
-use script_traits::ScriptToConstellationChan;
pub trait TextControlElement: DerivedFrom<EventTarget> + DerivedFrom<Node> {
fn selection_api_applies(&self) -> bool;
diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs
index dad1568a293..5a5eaeeb7a1 100644
--- a/components/script/dom/textdecoder.rs
+++ b/components/script/dom/textdecoder.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::cell::{Cell, RefCell};
+
+use dom_struct::dom_struct;
+use encoding_rs::{Decoder, DecoderResult, Encoding};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::TextDecoderBinding;
use crate::dom::bindings::codegen::Bindings::TextDecoderBinding::{
TextDecodeOptions, TextDecoderMethods,
@@ -12,11 +19,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, 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 encoding_rs::{Decoder, DecoderResult, Encoding};
-use js::rust::HandleObject;
-use std::borrow::ToOwned;
-use std::cell::{Cell, RefCell};
#[dom_struct]
#[allow(non_snake_case)]
diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs
index 3956683c0e4..f81679fe298 100644
--- a/components/script/dom/textencoder.rs
+++ b/components/script/dom/textencoder.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr;
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::JSObject;
+use js::rust::HandleObject;
+use js::typedarray::{CreateWith, Uint8Array};
+
use crate::dom::bindings::codegen::Bindings::TextEncoderBinding::TextEncoderMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
@@ -9,12 +17,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JSObject;
-use js::rust::HandleObject;
-use js::typedarray::{CreateWith, Uint8Array};
-use std::ptr;
-use std::ptr::NonNull;
#[dom_struct]
pub struct TextEncoder {
diff --git a/components/script/dom/textmetrics.rs b/components/script/dom/textmetrics.rs
index 675fcf1aa1d..665588b86f1 100644
--- a/components/script/dom/textmetrics.rs
+++ b/components/script/dom/textmetrics.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TextMetricsBinding::TextMetricsMethods;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
#[dom_struct]
#[allow(non_snake_case)]
diff --git a/components/script/dom/texttrack.rs b/components/script/dom/texttrack.rs
index 0e6cd2e48c7..be76479feb6 100644
--- a/components/script/dom/texttrack.rs
+++ b/components/script/dom/texttrack.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TextTrackBinding::{
TextTrackKind, TextTrackMethods, TextTrackMode,
@@ -15,8 +19,6 @@ use crate::dom::texttrackcue::TextTrackCue;
use crate::dom::texttrackcuelist::TextTrackCueList;
use crate::dom::texttracklist::TextTrackList;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct TextTrack {
diff --git a/components/script/dom/texttrackcue.rs b/components/script/dom/texttrackcue.rs
index 7a219f0f417..5a0f7f3abef 100644
--- a/components/script/dom/texttrackcue.rs
+++ b/components/script/dom/texttrackcue.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TextTrackCueBinding::TextTrackCueMethods;
use crate::dom::bindings::num::Finite;
@@ -11,8 +15,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::eventtarget::EventTarget;
use crate::dom::texttrack::TextTrack;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct TextTrackCue {
diff --git a/components/script/dom/texttrackcuelist.rs b/components/script/dom/texttrackcuelist.rs
index a51b95a965f..912faff815a 100644
--- a/components/script/dom/texttrackcuelist.rs
+++ b/components/script/dom/texttrackcuelist.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TextTrackCueListBinding::TextTrackCueListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,7 +11,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::texttrackcue::TextTrackCue;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct TextTrackCueList {
diff --git a/components/script/dom/texttracklist.rs b/components/script/dom/texttracklist.rs
index faeb9f0cd6d..b86b5b213d8 100644
--- a/components/script/dom/texttracklist.rs
+++ b/components/script/dom/texttracklist.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TextTrackListBinding::TextTrackListMethods;
use crate::dom::bindings::codegen::UnionTypes::VideoTrackOrAudioTrackOrTextTrack;
@@ -16,7 +18,6 @@ use crate::dom::texttrack::TextTrack;
use crate::dom::trackevent::TrackEvent;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct TextTrackList {
diff --git a/components/script/dom/timeranges.rs b/components/script/dom/timeranges.rs
index 7a60210b0e0..21476f3fcd3 100644
--- a/components/script/dom/timeranges.rs
+++ b/components/script/dom/timeranges.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::fmt;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TimeRangesBinding::TimeRangesMethods;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::fmt;
#[derive(Clone, JSTraceable, MallocSizeOf)]
struct TimeRange {
diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs
index 60e69a48ca3..2d257ee2107 100644
--- a/components/script/dom/touch.rs
+++ b/components/script/dom/touch.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TouchBinding::TouchMethods;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{DomRoot, MutDom};
use crate::dom::eventtarget::EventTarget;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct Touch {
diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs
index 4dfbed55147..02fc3533442 100644
--- a/components/script/dom/touchevent.rs
+++ b/components/script/dom/touchevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods;
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -12,8 +16,6 @@ use crate::dom::event::{EventBubbles, EventCancelable};
use crate::dom::touchlist::TouchList;
use crate::dom::uievent::UIEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct TouchEvent {
diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs
index 46400df8ca1..ede60a456ce 100644
--- a/components/script/dom/touchlist.rs
+++ b/components/script/dom/touchlist.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::touch::Touch;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct TouchList {
diff --git a/components/script/dom/trackevent.rs b/components/script/dom/trackevent.rs
index f8766b766f8..45223666a04 100644
--- a/components/script/dom/trackevent.rs
+++ b/components/script/dom/trackevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::audiotrack::AudioTrack;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::TrackEventBinding;
@@ -17,9 +21,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::texttrack::TextTrack;
use crate::dom::videotrack::VideoTrack;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs
index cba2856b57e..217d4297f0f 100644
--- a/components/script/dom/transitionevent.rs
+++ b/components/script/dom/transitionevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::TransitionEventBinding::{
TransitionEventInit, TransitionEventMethods,
@@ -14,9 +18,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct TransitionEvent {
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index 2cd8de9fdb3..a3e5e399222 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -2,19 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::callback::ExceptionHandling::Rethrow;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
-use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilter;
-use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
+use crate::dom::bindings::codegen::Bindings::NodeFilterBinding::{NodeFilter, NodeFilterConstants};
use crate::dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, MutDom};
use crate::dom::document::Document;
use crate::dom::node::Node;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::rc::Rc;
// https://dom.spec.whatwg.org/#interface-treewalker
#[dom_struct]
diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs
index 57950f6bf87..b28bda898e7 100644
--- a/components/script/dom/uievent.rs
+++ b/components/script/dom/uievent.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::UIEventBinding;
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
@@ -12,11 +19,6 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
-use std::cell::Cell;
-use std::default::Default;
// https://w3c.github.io/uievents/#interface-uievent
#[dom_struct]
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs
index 9868ba0655b..31fef976678 100644
--- a/components/script/dom/url.rs
+++ b/components/script/dom/url.rs
@@ -2,6 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+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 uuid::Uuid;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::URLBinding::URLMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -12,15 +23,6 @@ use crate::dom::blob::Blob;
use crate::dom::globalscope::GlobalScope;
use crate::dom::urlhelper::UrlHelper;
use crate::dom::urlsearchparams::URLSearchParams;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-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;
-use uuid::Uuid;
// https://url.spec.whatwg.org/#url
#[dom_struct]
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index 834d7e20d18..03a3c3150ae 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -2,11 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::str::USVString;
-use servo_url::ServoUrl;
use std::borrow::ToOwned;
+
+use servo_url::ServoUrl;
use url::quirks;
+use crate::dom::bindings::str::USVString;
+
#[derive(MallocSizeOf)]
pub struct UrlHelper;
diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs
index f23991ab098..4df702981de 100644
--- a/components/script/dom/urlsearchparams.rs
+++ b/components/script/dom/urlsearchparams.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use url::form_urlencoded;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchParamsMethods;
use crate::dom::bindings::codegen::UnionTypes::USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString;
@@ -13,9 +17,6 @@ use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::bindings::weakref::MutableWeakRef;
use crate::dom::globalscope::GlobalScope;
use crate::dom::url::URL;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use url::form_urlencoded;
// https://url.spec.whatwg.org/#interface-urlsearchparams
#[dom_struct]
diff --git a/components/script/dom/userscripts.rs b/components/script/dom/userscripts.rs
index 047b3345b0c..2b64c606b06 100644
--- a/components/script/dom/userscripts.rs
+++ b/components/script/dom/userscripts.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::fs::{read_dir, File};
+use std::io::Read;
+use std::path::PathBuf;
+use std::rc::Rc;
+
+use js::jsval::UndefinedValue;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::str::DOMString;
@@ -10,11 +17,6 @@ use crate::dom::htmlheadelement::HTMLHeadElement;
use crate::dom::htmlscriptelement::SourceCode;
use crate::dom::node::document_from_node;
use crate::script_module::ScriptFetchOptions;
-use js::jsval::UndefinedValue;
-use std::fs::{read_dir, File};
-use std::io::Read;
-use std::path::PathBuf;
-use std::rc::Rc;
pub fn load_script(head: &HTMLHeadElement) {
let doc = document_from_node(head);
diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs
index 38f700ea542..6d71181a426 100755
--- a/components/script/dom/validitystate.rs
+++ b/components/script/dom/validitystate.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::fmt;
+
+use bitflags::bitflags;
+use dom_struct::dom_struct;
+use itertools::Itertools;
+use style::element_state::ElementState;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -13,12 +21,6 @@ use crate::dom::htmlfieldsetelement::HTMLFieldSetElement;
use crate::dom::htmlformelement::FormControlElementHelpers;
use crate::dom::node::Node;
use crate::dom::window::Window;
-use bitflags::bitflags;
-use dom_struct::dom_struct;
-use itertools::Itertools;
-use std::cell::Cell;
-use std::fmt;
-use style::element_state::ElementState;
// https://html.spec.whatwg.org/multipage/#validity-states
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/vertexarrayobject.rs b/components/script/dom/vertexarrayobject.rs
index eef71e32a86..4021fe49e5f 100644
--- a/components/script/dom/vertexarrayobject.rs
+++ b/components/script/dom/vertexarrayobject.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 https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::webgl::{
+ ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVersion, WebGLVertexArrayId,
+};
+
use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants2;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use crate::dom::bindings::root::{Dom, MutNullableDom};
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{
- ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVersion, WebGLVertexArrayId,
-};
-use std::cell::Cell;
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
diff --git a/components/script/dom/videotrack.rs b/components/script/dom/videotrack.rs
index 8f904284fd9..f0decb69c82 100644
--- a/components/script/dom/videotrack.rs
+++ b/components/script/dom/videotrack.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::VideoTrackBinding::VideoTrackMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@@ -9,8 +13,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::videotracklist::VideoTrackList;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct VideoTrack {
diff --git a/components/script/dom/videotracklist.rs b/components/script/dom/videotracklist.rs
index a56e29d1470..cf19e0d17bf 100644
--- a/components/script/dom/videotracklist.rs
+++ b/components/script/dom/videotracklist.rs
@@ -2,20 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::VideoTrackListBinding::VideoTrackListMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::videotrack::VideoTrack;
use crate::dom::window::Window;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct VideoTrackList {
diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs
index 9f175d8d621..889eab07380 100644
--- a/components/script/dom/virtualmethods.rs
+++ b/components/script/dom/virtualmethods.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 https://mozilla.org/MPL/2.0/. */
+use html5ever::LocalName;
+use style::attr::AttrValue;
+
use crate::dom::attr::Attr;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::inheritance::ElementTypeId;
-use crate::dom::bindings::inheritance::HTMLElementTypeId;
-use crate::dom::bindings::inheritance::HTMLMediaElementTypeId;
-use crate::dom::bindings::inheritance::NodeTypeId;
-use crate::dom::bindings::inheritance::SVGElementTypeId;
-use crate::dom::bindings::inheritance::SVGGraphicsElementTypeId;
+use crate::dom::bindings::inheritance::{
+ Castable, ElementTypeId, HTMLElementTypeId, HTMLMediaElementTypeId, NodeTypeId,
+ SVGElementTypeId, SVGGraphicsElementTypeId,
+};
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::element::{AttributeMutation, Element};
@@ -54,8 +54,6 @@ use crate::dom::htmlvideoelement::HTMLVideoElement;
use crate::dom::node::{BindContext, ChildrenMutation, CloneChildrenFlag, Node, UnbindContext};
use crate::dom::svgelement::SVGElement;
use crate::dom::svgsvgelement::SVGSVGElement;
-use html5ever::LocalName;
-use style::attr::AttrValue;
/// Trait to allow DOM nodes to opt-in to overriding (or adding to) common
/// behaviours. Replicates the effect of C++ virtual methods.
diff --git a/components/script/dom/vttcue.rs b/components/script/dom/vttcue.rs
index fa84fae363b..a4740fd3e30 100644
--- a/components/script/dom/vttcue.rs
+++ b/components/script/dom/vttcue.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::VTTCueBinding::{
self, AlignSetting, AutoKeyword, DirectionSetting, LineAlignSetting, PositionAlignSetting,
@@ -17,9 +22,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::texttrackcue::TextTrackCue;
use crate::dom::vttregion::VTTRegion;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::cell::Cell;
#[dom_struct]
pub struct VTTCue {
diff --git a/components/script/dom/vttregion.rs b/components/script/dom/vttregion.rs
index 24069ded2cd..87482b8b97e 100644
--- a/components/script/dom/vttregion.rs
+++ b/components/script/dom/vttregion.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::VTTRegionBinding::{ScrollSetting, VTTRegionMethods};
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -11,9 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::cell::Cell;
#[dom_struct]
pub struct VTTRegion {
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index b438056e622..bca22a9931f 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -2,18 +2,42 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
-use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
-use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer;
-use crate::dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence;
-use crate::dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
-use crate::dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence;
-use crate::dom::bindings::codegen::UnionTypes::Uint32ArrayOrUnsignedLongSequence;
+use std::cell::Cell;
+use std::cmp;
+use std::ptr::{self, NonNull};
+
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{
+ webgl_channel, GLContextAttributes, InternalFormatParameter, WebGLCommand, WebGLResult,
+ WebGLVersion,
+};
+use dom_struct::dom_struct;
+use euclid::default::{Point2D, Rect, Size2D};
+use ipc_channel::ipc::{self, IpcSharedMemory};
+use js::jsapi::{JSObject, Type};
+use js::jsval::{
+ BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, ObjectValue, UInt32Value,
+ UndefinedValue,
+};
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{ArrayBufferView, CreateWith, Float32, Int32Array, Uint32, Uint32Array};
+use script_layout_interface::HTMLCanvasDataSource;
+use servo_config::pref;
+use url::Host;
+
+use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::{
+ WebGL2RenderingContextConstants as constants, WebGL2RenderingContextMethods,
+};
+use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{
+ WebGLContextAttributes, WebGLRenderingContextMethods,
+};
+use crate::dom::bindings::codegen::UnionTypes::{
+ ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence,
+ ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement, Int32ArrayOrLongSequence,
+ Uint32ArrayOrUnsignedLongSequence,
+};
use crate::dom::bindings::error::{ErrorResult, Fallible};
-use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
@@ -43,25 +67,6 @@ use crate::dom::webglvertexarrayobject::WebGLVertexArrayObject;
use crate::dom::window::Window;
use crate::js::conversions::ToJSValConvertible;
use crate::script_runtime::JSContext;
-use canvas_traits::webgl::WebGLError::*;
-use canvas_traits::webgl::{
- webgl_channel, GLContextAttributes, InternalFormatParameter, WebGLCommand, WebGLResult,
- WebGLVersion,
-};
-use dom_struct::dom_struct;
-use euclid::default::{Point2D, Rect, Size2D};
-use ipc_channel::ipc::{self, IpcSharedMemory};
-use js::jsapi::{JSObject, Type};
-use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value};
-use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
-use js::rust::{CustomAutoRooterGuard, HandleObject};
-use js::typedarray::{ArrayBufferView, CreateWith, Float32, Int32Array, Uint32, Uint32Array};
-use script_layout_interface::HTMLCanvasDataSource;
-use servo_config::pref;
-use std::cell::Cell;
-use std::cmp;
-use std::ptr::{self, NonNull};
-use url::Host;
#[unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
diff --git a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
index 4d03f25781b..5c79a692adb 100644
--- a/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
+++ b/components/script/dom/webgl_extensions/ext/angleinstancedarrays.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
-use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysMethods;
+use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::{
+ ANGLEInstancedArraysConstants, ANGLEInstancedArraysMethods,
+};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct ANGLEInstancedArrays {
diff --git a/components/script/dom/webgl_extensions/ext/extblendminmax.rs b/components/script/dom/webgl_extensions/ext/extblendminmax.rs
index 122aac6c861..97c4a642f9b 100644
--- a/components/script/dom/webgl_extensions/ext/extblendminmax.rs
+++ b/components/script/dom/webgl_extensions/ext/extblendminmax.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct EXTBlendMinmax {
diff --git a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
index bb4a630d537..48d69b78ab4 100644
--- a/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
+++ b/components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct EXTColorBufferHalfFloat {
diff --git a/components/script/dom/webgl_extensions/ext/extfragdepth.rs b/components/script/dom/webgl_extensions/ext/extfragdepth.rs
index 182b30bf754..056286137a4 100644
--- a/components/script/dom/webgl_extensions/ext/extfragdepth.rs
+++ b/components/script/dom/webgl_extensions/ext/extfragdepth.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{WebGLSLVersion, WebGLVersion};
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::{WebGLSLVersion, WebGLVersion};
-use dom_struct::dom_struct;
#[dom_struct]
pub struct EXTFragDepth {
diff --git a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
index ea68b518dac..65c39edb6a2 100644
--- a/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
+++ b/components/script/dom/webgl_extensions/ext/extshadertexturelod.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct EXTShaderTextureLod {
diff --git a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
index 89a4d3ed6a4..c5de4cea880 100644
--- a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
+++ b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct EXTTextureFilterAnisotropic {
diff --git a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
index 096c22d3dc5..77ba300caef 100644
--- a/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
+++ b/components/script/dom/webgl_extensions/ext/oeselementindexuint.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct OESElementIndexUint {
diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
index dfafa7051a5..9a552216cc4 100644
--- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
+++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct OESStandardDerivatives {
diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
index e286095b7c7..b7d87594a42 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{TexFormat, WebGLVersion};
+use dom_struct::dom_struct;
+
use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::{TexFormat, WebGLVersion};
-use dom_struct::dom_struct;
#[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 9e5c021f0ef..eee682a4327 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
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;
#[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 4f2ef41c651..49724a1aa21 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{TexFormat, WebGLVersion};
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::{TexFormat, WebGLVersion};
-use dom_struct::dom_struct;
#[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 a1e5f3bf15d..c25bf855b6e 100644
--- a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs
+++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use dom_struct::dom_struct;
#[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 57a68142609..4ddb5c2fb52 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 https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
-use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
-use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectMethods;
+use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{
+ OESVertexArrayObjectConstants, 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 canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[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 c0d8dc13776..30466b49cdc 100644
--- a/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
+++ b/components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturefloat::OESTextureFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WEBGLColorBufferFloat {
diff --git a/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs b/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs
index 749c38abd82..c04dceebca0 100644
--- a/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs
+++ b/components/script/dom/webgl_extensions/ext/webglcompressedtextureetc1.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{TexFormat, WebGLVersion};
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::{TexCompression, TexCompressionValidation};
-use canvas_traits::webgl::{TexFormat, WebGLVersion};
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WEBGLCompressedTextureETC1 {
diff --git a/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs b/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs
index 362dbe67117..22d9899db43 100644
--- a/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs
+++ b/components/script/dom/webgl_extensions/ext/webglcompressedtextures3tc.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{TexFormat, WebGLVersion};
+use dom_struct::dom_struct;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::{TexCompression, TexCompressionValidation};
-use canvas_traits::webgl::{TexFormat, WebGLVersion};
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WEBGLCompressedTextureS3TC {
diff --git a/components/script/dom/webgl_extensions/extension.rs b/components/script/dom/webgl_extensions/extension.rs
index 3854acee122..876b19cb8a9 100644
--- a/components/script/dom/webgl_extensions/extension.rs
+++ b/components/script/dom/webgl_extensions/extension.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVersion;
+
use super::WebGLExtensions;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use canvas_traits::webgl::WebGLVersion;
/// Trait implemented by WebGL extensions.
pub trait WebGLExtension: Sized
diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs
index 4873b3638e8..4c1bf37d0e4 100644
--- a/components/script/dom/webgl_extensions/extensions.rs
+++ b/components/script/dom/webgl_extensions/extensions.rs
@@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashMap;
+use std::iter::FromIterator;
+use std::ptr::NonNull;
+
+use canvas_traits::webgl::{GlType, TexFormat, WebGLSLVersion, WebGLVersion};
+use fnv::{FnvHashMap, FnvHashSet};
+use js::jsapi::JSObject;
+use malloc_size_of::MallocSizeOf;
+use sparkle::gl::{self, GLenum};
+
use super::wrapper::{TypedWebGLExtensionWrapper, WebGLExtensionWrapper};
use super::{ext, WebGLExtension, WebGLExtensionSpec};
use crate::dom::bindings::cell::DomRefCell;
@@ -18,14 +28,6 @@ use crate::dom::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglcolorbufferfloat::WEBGLColorBufferFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::TexCompression;
-use canvas_traits::webgl::{GlType, TexFormat, WebGLSLVersion, WebGLVersion};
-use fnv::{FnvHashMap, FnvHashSet};
-use js::jsapi::JSObject;
-use malloc_size_of::MallocSizeOf;
-use sparkle::gl::{self, GLenum};
-use std::collections::HashMap;
-use std::iter::FromIterator;
-use std::ptr::NonNull;
// 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/mod.rs b/components/script/dom/webgl_extensions/mod.rs
index aa6dfd1c752..df91a5e00d1 100644
--- a/components/script/dom/webgl_extensions/mod.rs
+++ b/components/script/dom/webgl_extensions/mod.rs
@@ -7,6 +7,5 @@ mod extension;
mod extensions;
mod wrapper;
-pub use self::extension::WebGLExtension;
-pub use self::extension::WebGLExtensionSpec;
+pub use self::extension::{WebGLExtension, WebGLExtensionSpec};
pub use self::extensions::WebGLExtensions;
diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs
index bf8db31418c..84338640835 100644
--- a/components/script/dom/webgl_extensions/wrapper.rs
+++ b/components/script/dom/webgl_extensions/wrapper.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 https://mozilla.org/MPL/2.0/. */
+use std::any::Any;
+use std::ptr::NonNull;
+
+use js::jsapi::JSObject;
+use malloc_size_of::MallocSizeOf;
+
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::MutNullableDom;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use js::jsapi::JSObject;
-use malloc_size_of::MallocSizeOf;
-use std::any::Any;
-use std::ptr::NonNull;
/// 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 dece682d377..31ad93adbbf 100644
--- a/components/script/dom/webgl_validations/tex_image_2d.rs
+++ b/components/script/dom/webgl_validations/tex_image_2d.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::{self, cmp, fmt};
+
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{TexDataType, TexFormat};
+
use super::types::TexImageTarget;
use super::WebGLValidator;
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use crate::dom::webgltexture::{ImageInfo, WebGLTexture};
-use crate::dom::webgltexture::{TexCompression, TexCompressionValidation};
-use canvas_traits::webgl::{TexDataType, TexFormat, WebGLError::*};
-use std::{self, cmp, fmt};
+use crate::dom::webgltexture::{ImageInfo, TexCompression, TexCompressionValidation, WebGLTexture};
/// The errors that the texImage* family of functions can generate.
#[derive(Debug)]
diff --git a/components/script/dom/webgl_validations/types.rs b/components/script/dom/webgl_validations/types.rs
index b28664843e9..7e0164c9738 100644
--- a/components/script/dom/webgl_validations/types.rs
+++ b/components/script/dom/webgl_validations/types.rs
@@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use canvas_traits::gl_enums;
use serde::{Deserialize, Serialize};
+use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
+
gl_enums! {
pub enum TexImageTarget {
Texture2D = constants::TEXTURE_2D,
diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs
index 93cc0274f35..b63dc713389 100644
--- a/components/script/dom/webglactiveinfo.rs
+++ b/components/script/dom/webglactiveinfo.rs
@@ -3,12 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLActiveInfo {
diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs
index 7deb030e6c6..8817a06c505 100644
--- a/components/script/dom/webglbuffer.rs
+++ b/components/script/dom/webglbuffer.rs
@@ -3,6 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+
+use canvas_traits::webgl::{webgl_channel, WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
+use dom_struct::dom_struct;
+use ipc_channel::ipc;
+
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants;
use crate::dom::bindings::inheritance::Castable;
@@ -10,11 +16,6 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::webgl_channel;
-use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
-use dom_struct::dom_struct;
-use ipc_channel::ipc;
-use std::cell::Cell;
fn target_is_copy_buffer(target: u32) -> bool {
target == WebGL2RenderingContextConstants::COPY_READ_BUFFER ||
diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs
index cd3924c4da5..af970133f9f 100644
--- a/components/script/dom/webglcontextevent.rs
+++ b/components/script/dom/webglcontextevent.rs
@@ -2,9 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventInit;
-use crate::dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods;
+use crate::dom::bindings::codegen::Bindings::WebGLContextEventBinding::{
+ WebGLContextEventInit, WebGLContextEventMethods,
+};
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
@@ -12,9 +17,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct WebGLContextEvent {
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs
index 021ebb0fd0c..541795dc6ce 100644
--- a/components/script/dom/webglframebuffer.rs
+++ b/components/script/dom/webglframebuffer.rs
@@ -3,6 +3,16 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+
+use canvas_traits::webgl::{
+ webgl_channel, WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLFramebufferId,
+ WebGLRenderbufferId, WebGLResult, WebGLTextureId, WebGLVersion,
+};
+use dom_struct::dom_struct;
+use euclid::Size2D;
+use webxr_api::Viewport;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::inheritance::Castable;
@@ -13,14 +23,6 @@ use crate::dom::webglrenderbuffer::WebGLRenderbuffer;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::dom::webgltexture::WebGLTexture;
use crate::dom::xrsession::XRSession;
-use canvas_traits::webgl::WebGLFramebufferId;
-use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult, WebGLVersion};
-use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest};
-use canvas_traits::webgl::{WebGLRenderbufferId, WebGLTextureId};
-use dom_struct::dom_struct;
-use euclid::Size2D;
-use std::cell::Cell;
-use webxr_api::Viewport;
pub enum CompleteForRendering {
Complete,
diff --git a/components/script/dom/webglobject.rs b/components/script/dom/webglobject.rs
index 999c7797b10..fd6fe082c08 100644
--- a/components/script/dom/webglobject.rs
+++ b/components/script/dom/webglobject.rs
@@ -3,10 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use dom_struct::dom_struct;
+
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::Dom;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLObject {
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 3ea2e6afef4..486c8b4449a 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -3,6 +3,15 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+
+use canvas_traits::webgl::{
+ webgl_channel, ActiveAttribInfo, ActiveUniformBlockInfo, ActiveUniformInfo, WebGLCommand,
+ WebGLError, WebGLProgramId, WebGLResult,
+};
+use dom_struct::dom_struct;
+use fnv::FnvHashSet;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants2;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@@ -15,13 +24,6 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::dom::webglshader::WebGLShader;
use crate::dom::webgluniformlocation::WebGLUniformLocation;
-use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
-use canvas_traits::webgl::{
- ActiveAttribInfo, ActiveUniformBlockInfo, ActiveUniformInfo, WebGLCommand, WebGLError,
-};
-use dom_struct::dom_struct;
-use fnv::FnvHashSet;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLProgram {
diff --git a/components/script/dom/webglquery.rs b/components/script/dom/webglquery.rs
index c971d8442ff..1c890d23760 100644
--- a/components/script/dom/webglquery.rs
+++ b/components/script/dom/webglquery.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLQueryId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
@@ -10,10 +16,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::task_source::TaskSource;
-use canvas_traits::webgl::WebGLError::*;
-use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLQueryId};
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLQuery {
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index 6fe3d06d7fd..3afb4955040 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -3,6 +3,14 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+
+use canvas_traits::webgl::{
+ webgl_channel, GlType, InternalFormatIntVec, WebGLCommand, WebGLError, WebGLRenderbufferId,
+ WebGLResult, WebGLVersion,
+};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding::EXTColorBufferHalfFloatConstants;
use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding::WEBGLColorBufferFloatConstants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
@@ -12,12 +20,6 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::webglframebuffer::WebGLFramebuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{
- webgl_channel, GlType, InternalFormatIntVec, WebGLCommand, WebGLError, WebGLRenderbufferId,
- WebGLResult, WebGLVersion,
-};
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLRenderbuffer {
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 8127f8c5f3a..dc71cf3912a 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -2,18 +2,54 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::cmp;
+use std::ptr::{self, NonNull};
+use std::rc::Rc;
+
+#[cfg(feature = "webgl_backtrace")]
+use backtrace::Backtrace;
+use bitflags::bitflags;
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{
+ webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType,
+ TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace,
+ WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender,
+ WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion,
+ YAxisTreatment,
+};
+use dom_struct::dom_struct;
+use euclid::default::{Point2D, Rect, Size2D};
+use ipc_channel::ipc::{self, IpcSharedMemory};
+use js::jsapi::{JSContext, JSObject, Type};
+use js::jsval::{
+ BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, ObjectValue, UInt32Value,
+ UndefinedValue,
+};
+use js::rust::CustomAutoRooterGuard;
+use js::typedarray::{
+ ArrayBufferView, CreateWith, Float32, Float32Array, Int32, Int32Array, TypedArray,
+ TypedArrayElementCreator, Uint32Array,
+};
+use net_traits::image_cache::ImageResponse;
+use pixels::{self, PixelFormat};
+use script_layout_interface::HTMLCanvasDataSource;
+use serde::{Deserialize, Serialize};
+use servo_config::pref;
+use webrender_api::ImageKey;
+
use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut};
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding::EXTBlendMinmaxConstants;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::TexImageSource;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
-use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
-use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer;
-use crate::dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence;
-use crate::dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence;
+use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{
+ TexImageSource, WebGLContextAttributes, WebGLRenderingContextConstants as constants,
+ WebGLRenderingContextMethods,
+};
+use crate::dom::bindings::codegen::UnionTypes::{
+ ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence, Int32ArrayOrLongSequence,
+};
use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible};
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
@@ -22,8 +58,9 @@ use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot, LayoutDom, MutNullab
use crate::dom::bindings::str::DOMString;
use crate::dom::element::cors_setting_for_element;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
-use crate::dom::htmlcanvaselement::utils as canvas_utils;
-use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
+use crate::dom::htmlcanvaselement::{
+ utils as canvas_utils, HTMLCanvasElement, LayoutCanvasRenderingContextHelpers,
+};
use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage};
use crate::dom::promise::Promise;
use crate::dom::vertexarrayobject::VertexAttribData;
@@ -52,38 +89,6 @@ use crate::dom::webglvertexarrayobject::WebGLVertexArrayObject;
use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
use crate::dom::window::Window;
use crate::script_runtime::JSContext as SafeJSContext;
-#[cfg(feature = "webgl_backtrace")]
-use backtrace::Backtrace;
-use bitflags::bitflags;
-use canvas_traits::webgl::WebGLError::*;
-use canvas_traits::webgl::{
- webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType,
- TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace,
- WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender,
- WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion,
- YAxisTreatment,
-};
-use dom_struct::dom_struct;
-use euclid::default::{Point2D, Rect, Size2D};
-use ipc_channel::ipc::{self, IpcSharedMemory};
-use js::jsapi::{JSContext, JSObject, Type};
-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::{TypedArray, TypedArrayElementCreator};
-use net_traits::image_cache::ImageResponse;
-use pixels::{self, PixelFormat};
-use script_layout_interface::HTMLCanvasDataSource;
-use serde::{Deserialize, Serialize};
-use servo_config::pref;
-use std::cell::Cell;
-use std::cmp;
-use std::ptr::{self, NonNull};
-use std::rc::Rc;
-use webrender_api::ImageKey;
// From the GLES 2.0.25 spec, page 85:
//
diff --git a/components/script/dom/webglsampler.rs b/components/script/dom/webglsampler.rs
index ec68328fab9..37147d3d261 100644
--- a/components/script/dom/webglsampler.rs
+++ b/components/script/dom/webglsampler.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 https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::webgl::WebGLError::*;
+use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSamplerId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::WebGLError::*;
-use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSamplerId};
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLSampler {
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index ad61db47a5a..98afb686593 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -3,6 +3,17 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+use std::os::raw::c_int;
+use std::sync::Once;
+
+use canvas_traits::webgl::{
+ webgl_channel, GLLimits, GlType, WebGLCommand, WebGLError, WebGLResult, WebGLSLVersion,
+ WebGLShaderId, WebGLVersion,
+};
+use dom_struct::dom_struct;
+use mozangle::shaders::{ffi, BuiltInResources, Output, ShaderValidator};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
@@ -14,14 +25,6 @@ use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDeriva
use crate::dom::webgl_extensions::WebGLExtensions;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{webgl_channel, GlType, WebGLVersion};
-use canvas_traits::webgl::{GLLimits, WebGLCommand, WebGLError};
-use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
-use dom_struct::dom_struct;
-use mozangle::shaders::{ffi, BuiltInResources, Output, ShaderValidator};
-use std::cell::Cell;
-use std::os::raw::c_int;
-use std::sync::Once;
#[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 e1a7202ff8d..97c6f3fc22a 100644
--- a/components/script/dom/webglshaderprecisionformat.rs
+++ b/components/script/dom/webglshaderprecisionformat.rs
@@ -5,11 +5,12 @@
#![allow(dead_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLShaderPrecisionFormat {
diff --git a/components/script/dom/webglsync.rs b/components/script/dom/webglsync.rs
index c26eb839eed..dd94e8090e8 100644
--- a/components/script/dom/webglsync.rs
+++ b/components/script/dom/webglsync.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSyncId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
@@ -10,9 +15,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::task_source::TaskSource;
-use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSyncId};
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLSync {
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs
index fc1610281c8..ccae44da729 100644
--- a/components/script/dom/webgltexture.rs
+++ b/components/script/dom/webgltexture.rs
@@ -4,26 +4,26 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use std::cell::Cell;
+use std::cmp;
+
+use canvas_traits::webgl::{
+ webgl_channel, TexDataType, TexFormat, TexParameter, TexParameterBool, TexParameterInt,
+ WebGLCommand, WebGLError, WebGLResult, WebGLTextureId,
+};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::{DomRoot, MutNullableDom};
+use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::webgl_validations::types::TexImageTarget;
use crate::dom::webglframebuffer::WebGLFramebuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::dom::xrsession::XRSession;
-use canvas_traits::webgl::{
- webgl_channel, TexDataType, TexFormat, TexParameter, TexParameterBool, TexParameterInt,
- WebGLResult, WebGLTextureId,
-};
-use canvas_traits::webgl::{WebGLCommand, WebGLError};
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use std::cmp;
pub enum TexParameterValue {
Float(f32),
diff --git a/components/script/dom/webgltransformfeedback.rs b/components/script/dom/webgltransformfeedback.rs
index 3b0b2abf0a2..37c1f5117af 100644
--- a/components/script/dom/webgltransformfeedback.rs
+++ b/components/script/dom/webgltransformfeedback.rs
@@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use canvas_traits::webgl::{webgl_channel, WebGLCommand};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{webgl_channel, WebGLCommand};
-use dom_struct::dom_struct;
-use std::cell::Cell;
#[dom_struct]
pub struct WebGLTransformFeedback {
diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs
index a579743399b..509a42b1b6d 100644
--- a/components/script/dom/webgluniformlocation.rs
+++ b/components/script/dom/webgluniformlocation.rs
@@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
+use canvas_traits::webgl::{WebGLContextId, WebGLProgramId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
-use canvas_traits::webgl::WebGLContextId;
-use canvas_traits::webgl::WebGLProgramId;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLUniformLocation {
diff --git a/components/script/dom/webglvertexarrayobject.rs b/components/script/dom/webglvertexarrayobject.rs
index 07f53af0316..867513c5459 100644
--- a/components/script/dom/webglvertexarrayobject.rs
+++ b/components/script/dom/webglvertexarrayobject.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::Ref;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -9,8 +12,6 @@ use crate::dom::vertexarrayobject::{VertexArrayObject, VertexAttribData};
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId};
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLVertexArrayObject {
diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs
index 215d39c1a5a..f0e551e753b 100644
--- a/components/script/dom/webglvertexarrayobjectoes.rs
+++ b/components/script/dom/webglvertexarrayobjectoes.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId};
+use dom_struct::dom_struct;
+
use crate::dom::bindings::cell::Ref;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -9,8 +12,6 @@ use crate::dom::vertexarrayobject::{VertexArrayObject, VertexAttribData};
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
-use canvas_traits::webgl::{ActiveAttribInfo, WebGLResult, WebGLVertexArrayId};
-use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLVertexArrayObjectOES {
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 75b30001d21..5486587ce90 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -2,6 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::cell::Cell;
+use std::ptr;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::jsapi::{JSAutoRealm, JSObject};
+use js::jsval::UndefinedValue;
+use js::rust::{CustomAutoRooterGuard, HandleObject};
+use js::typedarray::{ArrayBuffer, ArrayBufferView, CreateWith};
+use net_traits::request::{Referrer, RequestBuilder, RequestMode};
+use net_traits::{
+ CoreResourceMsg, FetchChannels, MessageData, WebSocketDomAction, WebSocketNetworkEvent,
+};
+use profile_traits::ipc as ProfiledIpc;
+use script_traits::serializable::BlobImpl;
+use servo_url::{ImmutableOrigin, ServoUrl};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::WebSocketBinding::{BinaryType, WebSocketMethods};
@@ -24,23 +43,6 @@ use crate::script_runtime::ScriptThreadEventCategory::WebSocketEvent;
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 ipc_channel::router::ROUTER;
-use js::jsapi::{JSAutoRealm, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::{CustomAutoRooterGuard, HandleObject};
-use js::typedarray::{ArrayBuffer, ArrayBufferView, CreateWith};
-use net_traits::request::{Referrer, RequestBuilder, RequestMode};
-use net_traits::MessageData;
-use net_traits::{CoreResourceMsg, FetchChannels};
-use net_traits::{WebSocketDomAction, WebSocketNetworkEvent};
-use profile_traits::ipc as ProfiledIpc;
-use script_traits::serializable::BlobImpl;
-use servo_url::{ImmutableOrigin, ServoUrl};
-use std::borrow::ToOwned;
-use std::cell::Cell;
-use std::ptr;
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
enum WebSocketRequestState {
diff --git a/components/script/dom/wheelevent.rs b/components/script/dom/wheelevent.rs
index 33418a6f868..7cefd845ad4 100644
--- a/components/script/dom/wheelevent.rs
+++ b/components/script/dom/wheelevent.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use crate::dom::bindings::codegen::Bindings::WheelEventBinding;
use crate::dom::bindings::codegen::Bindings::WheelEventBinding::WheelEventMethods;
@@ -14,9 +19,6 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::mouseevent::MouseEvent;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use std::cell::Cell;
#[dom_struct]
pub struct WheelEvent {
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index b1b3399d823..ce7306e8e1b 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -2,6 +2,84 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::{Cow, ToOwned};
+use std::cell::Cell;
+use std::collections::hash_map::Entry;
+use std::collections::{HashMap, HashSet};
+use std::default::Default;
+use std::io::{stderr, stdout, Write};
+use std::ptr::NonNull;
+use std::rc::Rc;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::{Arc, Mutex};
+use std::{cmp, env, mem};
+
+use app_units::Au;
+use backtrace::Backtrace;
+use base64::Engine;
+use bluetooth_traits::BluetoothRequest;
+use canvas_traits::webgl::WebGLChan;
+use crossbeam_channel::{unbounded, Sender, TryRecvError};
+use cssparser::{Parser, ParserInput, SourceLocation};
+use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
+use dom_struct::dom_struct;
+use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult};
+use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect};
+use euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
+use ipc_channel::ipc::IpcSender;
+use ipc_channel::router::ROUTER;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::{GCReason, Heap, JSAutoRealm, JSObject, StackFormat, JSPROP_ENUMERATE, JS_GC};
+use js::jsval::{JSVal, NullValue, UndefinedValue};
+use js::rust::wrappers::JS_DefineProperty;
+use js::rust::{
+ CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleObject,
+};
+use malloc_size_of::MallocSizeOf;
+use media::WindowGLContext;
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use net_traits::image_cache::{
+ ImageCache, ImageResponder, ImageResponse, PendingImageId, PendingImageResponse,
+};
+use net_traits::storage_thread::StorageType;
+use net_traits::ResourceThreads;
+use num_traits::ToPrimitive;
+use parking_lot::Mutex as ParkMutex;
+use profile_traits::ipc as ProfiledIpc;
+use profile_traits::mem::ProfilerChan as MemProfilerChan;
+use profile_traits::time::{ProfilerChan as TimeProfilerChan, ProfilerMsg};
+use script_layout_interface::message::{Msg, QueryMsg, Reflow, ReflowGoal, ScriptReflow};
+use script_layout_interface::rpc::{
+ ContentBoxResponse, ContentBoxesResponse, LayoutRPC, NodeScrollIdResponse,
+ ResolvedStyleResponse, TextIndexResponse,
+};
+use script_layout_interface::{PendingImageState, TrustedNodeAddress};
+use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
+use script_traits::{
+ ConstellationControlMsg, DocumentState, HistoryEntryReplacement, LoadData, ScriptMsg,
+ ScriptToConstellationChan, ScrollState, StructuredSerializedData, TimerEventId,
+ TimerSchedulerMsg, WebrenderIpcSender, WindowSizeData, WindowSizeType,
+};
+use selectors::attr::CaseSensitivity;
+use servo_arc::Arc as ServoArc;
+use servo_atoms::Atom;
+use servo_geometry::{f32_rect_to_au_rect, MaxRect};
+use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
+use style::dom::OpaqueNode;
+use style::error_reporting::{ContextualParseError, ParseErrorReporter};
+use style::media_queries;
+use style::parser::ParserContext as CssParserContext;
+use style::properties::style_structs::Font;
+use style::properties::{PropertyId, ShorthandId};
+use style::selector_parser::PseudoElement;
+use style::str::HTML_SPACE_CHARACTERS;
+use style::stylesheets::{CssRuleType, Origin};
+use style_traits::{CSSPixel, DevicePixel, ParsingMode};
+use url::Position;
+use webrender_api::units::{DeviceIntPoint, DeviceIntSize, LayoutPixel};
+use webrender_api::{DocumentId, ExternalScrollId};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
DocumentMethods, DocumentReadyState,
@@ -15,9 +93,9 @@ use crate::dom::bindings::codegen::Bindings::MediaQueryListBinding::MediaQueryLi
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction;
use crate::dom::bindings::codegen::Bindings::WindowBinding::{
- self, FrameRequestCallback, WindowMethods, WindowPostMessageOptions,
+ self, FrameRequestCallback, ScrollBehavior, ScrollToOptions, WindowMethods,
+ WindowPostMessageOptions,
};
-use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
use crate::dom::bindings::codegen::UnionTypes::{RequestOrUSVString, StringOrFunction};
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
@@ -60,104 +138,21 @@ use crate::dom::webglrenderingcontext::WebGLCommandSender;
use crate::dom::windowproxy::WindowProxy;
use crate::dom::worklet::Worklet;
use crate::dom::workletglobalscope::WorkletGlobalScopeType;
-use crate::fetch;
use crate::layout_image::fetch_image_for_layout;
use crate::microtask::MicrotaskQueue;
use crate::realms::InRealm;
use crate::script_runtime::{
CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory,
};
-use crate::script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg};
-use crate::script_thread::{ScriptThread, SendableMainThreadScriptChan};
+use crate::script_thread::{
+ ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, ScriptThread,
+ SendableMainThreadScriptChan,
+};
use crate::task_manager::TaskManager;
use crate::task_source::{TaskSource, TaskSourceName};
use crate::timers::{IsInterval, TimerCallback};
use crate::webdriver_handlers::jsval_to_webdriver;
-use crate::window_named_properties;
-use app_units::Au;
-use backtrace::Backtrace;
-use base64::Engine;
-use bluetooth_traits::BluetoothRequest;
-use canvas_traits::webgl::WebGLChan;
-use crossbeam_channel::{unbounded, Sender, TryRecvError};
-use cssparser::{Parser, ParserInput, SourceLocation};
-use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
-use dom_struct::dom_struct;
-use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult};
-use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect};
-use euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
-use ipc_channel::ipc::IpcSender;
-use ipc_channel::router::ROUTER;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::Heap;
-use js::jsapi::JSAutoRealm;
-use js::jsapi::JSObject;
-use js::jsapi::JSPROP_ENUMERATE;
-use js::jsapi::{GCReason, StackFormat, JS_GC};
-use js::jsval::UndefinedValue;
-use js::jsval::{JSVal, NullValue};
-use js::rust::wrappers::JS_DefineProperty;
-use js::rust::{
- CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleObject,
-};
-use malloc_size_of::MallocSizeOf;
-use media::WindowGLContext;
-use msg::constellation_msg::{BrowsingContextId, PipelineId};
-use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse};
-use net_traits::image_cache::{PendingImageId, PendingImageResponse};
-use net_traits::storage_thread::StorageType;
-use net_traits::ResourceThreads;
-use num_traits::ToPrimitive;
-use parking_lot::Mutex as ParkMutex;
-use profile_traits::ipc as ProfiledIpc;
-use profile_traits::mem::ProfilerChan as MemProfilerChan;
-use profile_traits::time::{ProfilerChan as TimeProfilerChan, ProfilerMsg};
-use script_layout_interface::message::{Msg, QueryMsg, Reflow, ReflowGoal, ScriptReflow};
-use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
-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, HistoryEntryReplacement, LoadData};
-use script_traits::{
- ScriptMsg, ScriptToConstellationChan, ScrollState, StructuredSerializedData, TimerEventId,
-};
-use script_traits::{TimerSchedulerMsg, WebrenderIpcSender, WindowSizeData, WindowSizeType};
-use selectors::attr::CaseSensitivity;
-use servo_arc::Arc as ServoArc;
-use servo_atoms::Atom;
-use servo_geometry::{f32_rect_to_au_rect, MaxRect};
-use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
-use std::borrow::Cow;
-use std::borrow::ToOwned;
-use std::cell::Cell;
-use std::cmp;
-use std::collections::hash_map::Entry;
-use std::collections::{HashMap, HashSet};
-use std::default::Default;
-use std::env;
-use std::io::{stderr, stdout, Write};
-use std::mem;
-use std::ptr::NonNull;
-use std::rc::Rc;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::{Arc, Mutex};
-use style::dom::OpaqueNode;
-use style::error_reporting::{ContextualParseError, ParseErrorReporter};
-use style::media_queries;
-use style::parser::ParserContext as CssParserContext;
-use style::properties::style_structs::Font;
-use style::properties::{PropertyId, ShorthandId};
-use style::selector_parser::PseudoElement;
-use style::str::HTML_SPACE_CHARACTERS;
-use style::stylesheets::{CssRuleType, Origin};
-use style_traits::{CSSPixel, DevicePixel, ParsingMode};
-use url::Position;
-use webrender_api::units::{DeviceIntPoint, DeviceIntSize, LayoutPixel};
-use webrender_api::{DocumentId, ExternalScrollId};
-
-use super::bindings::trace::HashMapTracedValues;
+use crate::{fetch, window_named_properties};
/// Current state of the window object
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs
index f4aae865000..2d023e02f8a 100644
--- a/components/script/dom/windowproxy.rs
+++ b/components/script/dom/windowproxy.rs
@@ -2,6 +2,41 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::ptr;
+
+use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
+use html5ever::local_name;
+use indexmap::map::IndexMap;
+use ipc_channel::ipc;
+use js::glue::{
+ CreateWrapperProxyHandler, GetProxyPrivate, GetProxyReservedSlot, ProxyTraps,
+ SetProxyReservedSlot,
+};
+use js::jsapi::{
+ GCContext, Handle as RawHandle, HandleId as RawHandleId, HandleObject as RawHandleObject,
+ HandleValue as RawHandleValue, JSAutoRealm, JSContext, JSErrNum, JSObject, JSTracer,
+ JS_DefinePropertyById, JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo,
+ JS_GetOwnPropertyDescriptorById, JS_HasOwnPropertyById, JS_HasPropertyById,
+ JS_IsExceptionPending, MutableHandle as RawMutableHandle,
+ MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
+ ObjectOpResult, PropertyDescriptor, JSPROP_ENUMERATE, JSPROP_READONLY,
+};
+use js::jsval::{JSVal, NullValue, PrivateValue, UndefinedValue};
+use js::rust::wrappers::{JS_TransplantObject, NewWindowProxy, SetWindowProxy};
+use js::rust::{get_object_class, Handle, MutableHandle};
+use js::JSCLASS_IS_GLOBAL;
+use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
+use net_traits::request::Referrer;
+use script_traits::{
+ AuxiliaryBrowsingContextLoadInfo, HistoryEntryReplacement, LoadData, LoadOrigin, NewLayoutInfo,
+ ScriptMsg,
+};
+use serde::{Deserialize, Serialize};
+use servo_url::{ImmutableOrigin, ServoUrl};
+use style::attr::parse_integer;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::conversions::{root_from_handleobject, ToJSValConvertible};
use crate::dom::bindings::error::{throw_dom_exception, Error, Fallible};
@@ -20,44 +55,6 @@ use crate::dom::window::Window;
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
use crate::script_thread::ScriptThread;
-use dom_struct::dom_struct;
-use embedder_traits::EmbedderMsg;
-use html5ever::local_name;
-use indexmap::map::IndexMap;
-use ipc_channel::ipc;
-use js::glue::{CreateWrapperProxyHandler, ProxyTraps};
-use js::glue::{GetProxyPrivate, GetProxyReservedSlot, SetProxyReservedSlot};
-use js::jsapi::Handle as RawHandle;
-use js::jsapi::HandleId as RawHandleId;
-use js::jsapi::HandleObject as RawHandleObject;
-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::jsapi::{GCContext, JSAutoRealm, JSContext, JSErrNum, 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::{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;
-use net_traits::request::Referrer;
-use script_traits::{
- AuxiliaryBrowsingContextLoadInfo, HistoryEntryReplacement, LoadData, LoadOrigin,
-};
-use script_traits::{NewLayoutInfo, ScriptMsg};
-use serde::{Deserialize, Serialize};
-use servo_url::{ImmutableOrigin, ServoUrl};
-use std::cell::Cell;
-use std::ptr;
-use style::attr::parse_integer;
#[dom_struct]
// NOTE: the browsing context for a window is managed in two places:
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index 321474f31ee..7899da4b471 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -2,8 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::abstractworker::SimpleWorkerErrorHandler;
-use crate::dom::abstractworker::WorkerScriptMsg;
+use std::cell::Cell;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+
+use crossbeam_channel::{unbounded, Sender};
+use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg, WorkerId};
+use dom_struct::dom_struct;
+use ipc_channel::ipc;
+use js::jsapi::{Heap, JSObject};
+use js::jsval::UndefinedValue;
+use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue};
+use script_traits::{StructuredSerializedData, WorkerScriptLoadOrigin};
+use uuid::Uuid;
+
+use crate::dom::abstractworker::{SimpleWorkerErrorHandler, WorkerScriptMsg};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::MessagePortBinding::PostMessageOptions;
use crate::dom::bindings::codegen::Bindings::WorkerBinding::{WorkerMethods, WorkerOptions};
@@ -26,18 +39,6 @@ use crate::dom::workerglobalscope::prepare_workerscope_init;
use crate::realms::enter_realm;
use crate::script_runtime::{ContextForRequestInterrupt, JSContext};
use crate::task::TaskOnce;
-use crossbeam_channel::{unbounded, Sender};
-use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg, WorkerId};
-use dom_struct::dom_struct;
-use ipc_channel::ipc;
-use js::jsapi::{Heap, JSObject};
-use js::jsval::UndefinedValue;
-use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue};
-use script_traits::{StructuredSerializedData, WorkerScriptLoadOrigin};
-use std::cell::Cell;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use uuid::Uuid;
pub type TrustedWorkerAddress = Trusted<Worker>;
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index a41946926db..eb9b200a935 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -2,6 +2,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::default::Default;
+use std::rc::Rc;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+
+use crossbeam_channel::Receiver;
+use devtools_traits::{DevtoolScriptControlMsg, WorkerId};
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use js::jsval::UndefinedValue;
+use js::panic::maybe_resume_unwind;
+use js::rust::{HandleValue, ParentRuntime};
+use msg::constellation_msg::{PipelineId, PipelineNamespace};
+use net_traits::request::{
+ CredentialsMode, Destination, ParserMetadata, RequestBuilder as NetRequestInit,
+};
+use net_traits::IpcSend;
+use parking_lot::Mutex;
+use script_traits::WorkerGlobalScopeInit;
+use servo_url::{MutableOrigin, ServoUrl};
+use time::precise_time_ns;
+use uuid::Uuid;
+
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::ImageBitmapBinding::{
ImageBitmapOptions, ImageBitmapSource,
@@ -30,8 +53,10 @@ use crate::dom::workerlocation::WorkerLocation;
use crate::dom::workernavigator::WorkerNavigator;
use crate::fetch;
use crate::realms::{enter_realm, InRealm};
-use crate::script_runtime::{get_reports, CommonScriptMsg, Runtime, ScriptChan, ScriptPort};
-use crate::script_runtime::{ContextForRequestInterrupt, JSContext};
+use crate::script_runtime::{
+ get_reports, CommonScriptMsg, ContextForRequestInterrupt, JSContext, Runtime, ScriptChan,
+ ScriptPort,
+};
use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
use crate::task_source::file_reading::FileReadingTaskSource;
@@ -42,27 +67,6 @@ use crate::task_source::remote_event::RemoteEventTaskSource;
use crate::task_source::timer::TimerTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
use crate::timers::{IsInterval, TimerCallback};
-use crossbeam_channel::Receiver;
-use devtools_traits::{DevtoolScriptControlMsg, WorkerId};
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use js::jsval::UndefinedValue;
-use js::panic::maybe_resume_unwind;
-use js::rust::{HandleValue, ParentRuntime};
-use msg::constellation_msg::{PipelineId, PipelineNamespace};
-use net_traits::request::{
- CredentialsMode, Destination, ParserMetadata, RequestBuilder as NetRequestInit,
-};
-use net_traits::IpcSend;
-use parking_lot::Mutex;
-use script_traits::WorkerGlobalScopeInit;
-use servo_url::{MutableOrigin, ServoUrl};
-use std::default::Default;
-use std::rc::Rc;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use time::precise_time_ns;
-use uuid::Uuid;
pub fn prepare_workerscope_init(
global: &GlobalScope,
diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs
index cbe7996899c..a592dfe0154 100644
--- a/components/script/dom/workerlocation.rs
+++ b/components/script/dom/workerlocation.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use servo_url::{ImmutableOrigin, ServoUrl};
+
use crate::dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::urlhelper::UrlHelper;
use crate::dom::workerglobalscope::WorkerGlobalScope;
-use dom_struct::dom_struct;
-use servo_url::{ImmutableOrigin, ServoUrl};
// https://html.spec.whatwg.org/multipage/#worker-locations
#[dom_struct]
diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs
index 7f7b656068f..ba7da3fa783 100644
--- a/components/script/dom/workernavigator.rs
+++ b/components/script/dom/workernavigator.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::jsval::JSVal;
+
use crate::dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
@@ -12,8 +15,6 @@ use crate::dom::navigatorinfo;
use crate::dom::permissions::Permissions;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsval::JSVal;
// https://html.spec.whatwg.org/multipage/#workernavigator
#[dom_struct]
diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs
index 75acc13c650..67c0f053dbb 100644
--- a/components/script/dom/worklet.rs
+++ b/components/script/dom/worklet.rs
@@ -10,62 +10,48 @@
//! thread pool implementation, which only performs GC or code loading on
//! a backup thread, not on the primary worklet thread.
+use std::cmp::max;
+use std::collections::{hash_map, HashMap};
+use std::rc::Rc;
+use std::sync::atomic::{AtomicIsize, Ordering};
+use std::sync::Arc;
+use std::thread;
+
+use crossbeam_channel::{unbounded, Receiver, Sender};
+use dom_struct::dom_struct;
+use js::jsapi::{GCReason, JSGCParamKey, JSTracer, JS_GetGCParameter, JS_GC};
+use malloc_size_of::malloc_size_of_is_0;
+use msg::constellation_msg::PipelineId;
+use net_traits::request::{Destination, RequestBuilder, RequestMode};
+use net_traits::IpcSend;
+use servo_url::{ImmutableOrigin, ServoUrl};
+use style::thread_state::{self, ThreadState};
+use swapper::{swapper, Swapper};
+use uuid::Uuid;
+
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentials;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletMethods;
-use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions;
+use crate::dom::bindings::codegen::Bindings::WorkletBinding::{WorkletMethods, WorkletOptions};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::TrustedPromise;
-use crate::dom::bindings::reflector::reflect_dom_object;
-use crate::dom::bindings::reflector::Reflector;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, RootCollection, ThreadLocalStackRoots};
use crate::dom::bindings::str::USVString;
-use crate::dom::bindings::trace::JSTraceable;
-use crate::dom::bindings::trace::RootedTraceableBox;
+use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::dom::testworkletglobalscope::TestWorkletTask;
use crate::dom::window::Window;
-use crate::dom::workletglobalscope::WorkletGlobalScope;
-use crate::dom::workletglobalscope::WorkletGlobalScopeInit;
-use crate::dom::workletglobalscope::WorkletGlobalScopeType;
-use crate::dom::workletglobalscope::WorkletTask;
+use crate::dom::workletglobalscope::{
+ WorkletGlobalScope, WorkletGlobalScopeInit, WorkletGlobalScopeType, WorkletTask,
+};
use crate::fetch::load_whole_resource;
use crate::realms::InRealm;
-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, CommonScriptMsg, Runtime, ScriptThreadEventCategory};
use crate::script_thread::{MainThreadScriptMsg, ScriptThread};
use crate::task::TaskBox;
use crate::task_source::TaskSourceName;
-use crossbeam_channel::{unbounded, Receiver, Sender};
-use dom_struct::dom_struct;
-use js::jsapi::JSGCParamKey;
-use js::jsapi::JSTracer;
-use js::jsapi::JS_GetGCParameter;
-use js::jsapi::{GCReason, JS_GC};
-use malloc_size_of::malloc_size_of_is_0;
-use msg::constellation_msg::PipelineId;
-use net_traits::request::Destination;
-use net_traits::request::RequestBuilder;
-use net_traits::request::RequestMode;
-use net_traits::IpcSend;
-use servo_url::ImmutableOrigin;
-use servo_url::ServoUrl;
-use std::cmp::max;
-use std::collections::hash_map;
-use std::collections::HashMap;
-use std::rc::Rc;
-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 uuid::Uuid;
// Magic numbers
const WORKLET_THREAD_POOL_SIZE: u32 = 3;
diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs
index 888a2058bc3..0e9a31a57a4 100644
--- a/components/script/dom/workletglobalscope.rs
+++ b/components/script/dom/workletglobalscope.rs
@@ -2,18 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::globalscope::GlobalScope;
-use crate::dom::identityhub::Identities;
-use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
-use crate::dom::paintworkletglobalscope::PaintWorkletTask;
-use crate::dom::testworkletglobalscope::TestWorkletGlobalScope;
-use crate::dom::testworkletglobalscope::TestWorkletTask;
-use crate::dom::worklet::WorkletExecutor;
-use crate::script_module::ScriptFetchOptions;
-use crate::script_runtime::JSContext;
-use crate::script_thread::MainThreadScriptMsg;
+use std::borrow::Cow;
+use std::sync::Arc;
+
use crossbeam_channel::Sender;
use devtools_traits::ScriptToDevtoolsControlMsg;
use dom_struct::dom_struct;
@@ -24,16 +15,21 @@ use msg::constellation_msg::PipelineId;
use net_traits::image_cache::ImageCache;
use net_traits::ResourceThreads;
use parking_lot::Mutex;
-use profile_traits::mem;
-use profile_traits::time;
-use script_traits::{Painter, ScriptMsg};
-use script_traits::{ScriptToConstellationChan, TimerSchedulerMsg};
+use profile_traits::{mem, time};
+use script_traits::{Painter, ScriptMsg, ScriptToConstellationChan, TimerSchedulerMsg};
use servo_atoms::Atom;
-use servo_url::ImmutableOrigin;
-use servo_url::MutableOrigin;
-use servo_url::ServoUrl;
-use std::borrow::Cow;
-use std::sync::Arc;
+use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
+
+use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use crate::dom::identityhub::Identities;
+use crate::dom::paintworkletglobalscope::{PaintWorkletGlobalScope, PaintWorkletTask};
+use crate::dom::testworkletglobalscope::{TestWorkletGlobalScope, TestWorkletTask};
+use crate::dom::worklet::WorkletExecutor;
+use crate::script_module::ScriptFetchOptions;
+use crate::script_runtime::JSContext;
+use crate::script_thread::MainThreadScriptMsg;
#[dom_struct]
/// <https://drafts.css-houdini.org/worklets/#workletglobalscope>
diff --git a/components/script/dom/xmldocument.rs b/components/script/dom/xmldocument.rs
index f4908922ec3..389a1aa9cd4 100644
--- a/components/script/dom/xmldocument.rs
+++ b/components/script/dom/xmldocument.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use js::jsapi::JSObject;
+use mime::Mime;
+use script_traits::DocumentActivity;
+use servo_url::{MutableOrigin, ServoUrl};
+
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::XMLDocumentBinding::XMLDocumentMethods;
@@ -14,12 +22,6 @@ use crate::dom::location::Location;
use crate::dom::node::Node;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsapi::JSObject;
-use mime::Mime;
-use script_traits::DocumentActivity;
-use servo_url::{MutableOrigin, ServoUrl};
-use std::ptr::NonNull;
// https://dom.spec.whatwg.org/#xmldocument
#[dom_struct]
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 669edfb1c71..48c55d44717 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -2,12 +2,50 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::borrow::ToOwned;
+use std::cell::Cell;
+use std::default::Default;
+use std::ptr::NonNull;
+use std::str::{self, FromStr};
+use std::sync::{Arc, Mutex};
+use std::{cmp, ptr, slice};
+
+use dom_struct::dom_struct;
+use encoding_rs::{Encoding, UTF_8};
+use euclid::Length;
+use headers::{ContentLength, ContentType, HeaderMapExt};
+use html5ever::serialize;
+use html5ever::serialize::SerializeOpts;
+use http::header::{self, HeaderMap, HeaderName, HeaderValue};
+use http::Method;
+use hyper_serde::Serde;
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::jsapi::{Heap, JSObject, JS_ClearPendingException};
+use js::jsval::{JSVal, NullValue, UndefinedValue};
+use js::rust::wrappers::JS_ParseJSON;
+use js::rust::HandleObject;
+use js::typedarray::{ArrayBuffer, CreateWith};
+use mime::{self, Mime, Name};
+use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder, RequestMode};
+use net_traits::CoreResourceMsg::Fetch;
+use net_traits::{
+ trim_http_whitespace, FetchChannels, FetchMetadata, FetchResponseListener, FilteredMetadata,
+ NetworkError, ReferrerPolicy, ResourceFetchTiming, ResourceTimingType,
+};
+use script_traits::serializable::BlobImpl;
+use script_traits::DocumentActivity;
+use servo_atoms::Atom;
+use servo_url::ServoUrl;
+use url::Position;
+
use crate::body::{BodySource, Extractable, ExtractedBody};
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
-use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestMethods;
-use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestResponseType;
+use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::{
+ XMLHttpRequestMethods, XMLHttpRequestResponseType,
+};
use crate::dom::bindings::codegen::UnionTypes::DocumentOrXMLHttpRequestBodyInit;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
@@ -17,8 +55,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::str::{is_token, ByteString, DOMString, USVString};
use crate::dom::blob::{normalize_type_string, Blob};
-use crate::dom::document::DocumentSource;
-use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
+use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
@@ -38,44 +75,6 @@ use crate::script_runtime::JSContext;
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};
-use euclid::Length;
-use headers::{ContentLength, ContentType, HeaderMapExt};
-use html5ever::serialize;
-use html5ever::serialize::SerializeOpts;
-use http::header::{self, HeaderMap, HeaderName, HeaderValue};
-use http::Method;
-use hyper_serde::Serde;
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::jsapi::JS_ClearPendingException;
-use js::jsapi::{Heap, JSObject};
-use js::jsval::{JSVal, NullValue, UndefinedValue};
-use js::rust::wrappers::JS_ParseJSON;
-use js::rust::HandleObject;
-use js::typedarray::{ArrayBuffer, CreateWith};
-use mime::{self, Mime, Name};
-use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder, 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 net_traits::{ResourceFetchTiming, ResourceTimingType};
-use script_traits::serializable::BlobImpl;
-use script_traits::DocumentActivity;
-use servo_atoms::Atom;
-use servo_url::ServoUrl;
-use std::borrow::ToOwned;
-use std::cell::Cell;
-use std::cmp;
-use std::default::Default;
-use std::ptr;
-use std::ptr::NonNull;
-use std::slice;
-use std::str::{self, FromStr};
-use std::sync::{Arc, Mutex};
-use url::Position;
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
enum XMLHttpRequestState {
diff --git a/components/script/dom/xmlhttprequesteventtarget.rs b/components/script/dom/xmlhttprequesteventtarget.rs
index 44f0fb7c1fc..af33da13b0c 100644
--- a/components/script/dom/xmlhttprequesteventtarget.rs
+++ b/components/script/dom/xmlhttprequesteventtarget.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::XMLHttpRequestEventTargetBinding::XMLHttpRequestEventTargetMethods;
use crate::dom::eventtarget::EventTarget;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct XMLHttpRequestEventTarget {
diff --git a/components/script/dom/xmlhttprequestupload.rs b/components/script/dom/xmlhttprequestupload.rs
index 7e7b5893395..47ebae74a5a 100644
--- a/components/script/dom/xmlhttprequestupload.rs
+++ b/components/script/dom/xmlhttprequestupload.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct XMLHttpRequestUpload {
diff --git a/components/script/dom/xmlserializer.rs b/components/script/dom/xmlserializer.rs
index 55f0753d8f4..dfbd49e306d 100644
--- a/components/script/dom/xmlserializer.rs
+++ b/components/script/dom/xmlserializer.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use xml5ever::serialize::{serialize, SerializeOpts, TraversalScope};
+
use crate::dom::bindings::codegen::Bindings::XMLSerializerBinding::XMLSerializerMethods;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
@@ -9,9 +13,6 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::node::Node;
use crate::dom::window::Window;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use xml5ever::serialize::{serialize, SerializeOpts, TraversalScope};
#[dom_struct]
pub struct XMLSerializer {
diff --git a/components/script/dom/xrcompositionlayer.rs b/components/script/dom/xrcompositionlayer.rs
index 5a4aa85d2fa..fbb71149716 100644
--- a/components/script/dom/xrcompositionlayer.rs
+++ b/components/script/dom/xrcompositionlayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrlayer::XRLayer;
use dom_struct::dom_struct;
+use crate::dom::xrlayer::XRLayer;
+
#[dom_struct]
pub struct XRCompositionLayer {
xr_layer: XRLayer,
diff --git a/components/script/dom/xrcubelayer.rs b/components/script/dom/xrcubelayer.rs
index 71296ddc238..587d088e88b 100644
--- a/components/script/dom/xrcubelayer.rs
+++ b/components/script/dom/xrcubelayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrcompositionlayer::XRCompositionLayer;
use dom_struct::dom_struct;
+use crate::dom::xrcompositionlayer::XRCompositionLayer;
+
#[dom_struct]
pub struct XRCubeLayer {
composition_layer: XRCompositionLayer,
diff --git a/components/script/dom/xrcylinderlayer.rs b/components/script/dom/xrcylinderlayer.rs
index 2abe935f525..f468380bb36 100644
--- a/components/script/dom/xrcylinderlayer.rs
+++ b/components/script/dom/xrcylinderlayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrcompositionlayer::XRCompositionLayer;
use dom_struct::dom_struct;
+use crate::dom::xrcompositionlayer::XRCompositionLayer;
+
#[dom_struct]
pub struct XRCylinderLayer {
composition_layer: XRCompositionLayer,
diff --git a/components/script/dom/xrequirectlayer.rs b/components/script/dom/xrequirectlayer.rs
index d6da61a5a9c..25cc04595ef 100644
--- a/components/script/dom/xrequirectlayer.rs
+++ b/components/script/dom/xrequirectlayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrcompositionlayer::XRCompositionLayer;
use dom_struct::dom_struct;
+use crate::dom::xrcompositionlayer::XRCompositionLayer;
+
#[dom_struct]
pub struct XREquirectLayer {
composition_layer: XRCompositionLayer,
diff --git a/components/script/dom/xrframe.rs b/components/script/dom/xrframe.rs
index 6274ca78387..7afb14d6453 100644
--- a/components/script/dom/xrframe.rs
+++ b/components/script/dom/xrframe.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use webxr_api::{Frame, LayerId, SubImages};
+
use crate::dom::bindings::codegen::Bindings::XRFrameBinding::XRFrameMethods;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::inheritance::Castable;
@@ -17,11 +22,6 @@ use crate::dom::xrreferencespace::XRReferenceSpace;
use crate::dom::xrsession::{ApiPose, XRSession};
use crate::dom::xrspace::XRSpace;
use crate::dom::xrviewerpose::XRViewerPose;
-use dom_struct::dom_struct;
-use std::cell::Cell;
-use webxr_api::Frame;
-use webxr_api::LayerId;
-use webxr_api::SubImages;
#[dom_struct]
pub struct XRFrame {
diff --git a/components/script/dom/xrhand.rs b/components/script/dom/xrhand.rs
index 1d04083c7aa..6d232587f2e 100644
--- a/components/script/dom/xrhand.rs
+++ b/components/script/dom/xrhand.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webxr_api::{FingerJoint, Hand, Joint};
+
use crate::dom::bindings::codegen::Bindings::XRHandBinding::{XRHandConstants, XRHandMethods};
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrinputsource::XRInputSource;
use crate::dom::xrjointspace::XRJointSpace;
-use dom_struct::dom_struct;
-use webxr_api::{FingerJoint, Hand, Joint};
#[dom_struct]
pub struct XRHand {
diff --git a/components/script/dom/xrhittestresult.rs b/components/script/dom/xrhittestresult.rs
index dd35043e187..e7e6c9713b4 100644
--- a/components/script/dom/xrhittestresult.rs
+++ b/components/script/dom/xrhittestresult.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webxr_api::HitTestResult;
+
use crate::dom::bindings::codegen::Bindings::XRHitTestResultBinding::XRHitTestResultMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -9,8 +12,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::xrframe::XRFrame;
use crate::dom::xrpose::XRPose;
use crate::dom::xrspace::XRSpace;
-use dom_struct::dom_struct;
-use webxr_api::HitTestResult;
#[dom_struct]
pub struct XRHitTestResult {
diff --git a/components/script/dom/xrhittestsource.rs b/components/script/dom/xrhittestsource.rs
index 913193cfae3..d816a4415db 100644
--- a/components/script/dom/xrhittestsource.rs
+++ b/components/script/dom/xrhittestsource.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webxr_api::HitTestId;
+
use crate::dom::bindings::codegen::Bindings::XRHitTestSourceBinding::XRHitTestSourceMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrsession::XRSession;
-use dom_struct::dom_struct;
-use webxr_api::HitTestId;
#[dom_struct]
pub struct XRHitTestSource {
diff --git a/components/script/dom/xrinputsource.rs b/components/script/dom/xrinputsource.rs
index 8b3f3f793e4..3317c2a014d 100644
--- a/components/script/dom/xrinputsource.rs
+++ b/components/script/dom/xrinputsource.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::Heap;
+use js::jsval::{JSVal, UndefinedValue};
+use webxr_api::{Handedness, InputId, InputSource, TargetRayMode};
+
use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{
XRHandedness, XRInputSourceMethods, XRTargetRayMode,
};
@@ -13,11 +19,6 @@ use crate::dom::xrsession::XRSession;
use crate::dom::xrspace::XRSpace;
use crate::realms::enter_realm;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::Heap;
-use js::jsval::{JSVal, UndefinedValue};
-use webxr_api::{Handedness, InputId, InputSource, TargetRayMode};
#[dom_struct]
pub struct XRInputSource {
diff --git a/components/script/dom/xrinputsourcearray.rs b/components/script/dom/xrinputsourcearray.rs
index b26f7bd3da7..c293aad549a 100644
--- a/components/script/dom/xrinputsourcearray.rs
+++ b/components/script/dom/xrinputsourcearray.rs
@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use webxr_api::{InputId, InputSource};
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::XRInputSourceArrayBinding::XRInputSourceArrayMethods;
use crate::dom::bindings::inheritance::Castable;
@@ -12,8 +15,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::xrinputsource::XRInputSource;
use crate::dom::xrinputsourceschangeevent::XRInputSourcesChangeEvent;
use crate::dom::xrsession::XRSession;
-use dom_struct::dom_struct;
-use webxr_api::{InputId, InputSource};
#[dom_struct]
pub struct XRInputSourceArray {
diff --git a/components/script/dom/xrinputsourceevent.rs b/components/script/dom/xrinputsourceevent.rs
index 836aa8f981e..aff56aa59e7 100644
--- a/components/script/dom/xrinputsourceevent.rs
+++ b/components/script/dom/xrinputsourceevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::XRInputSourceEventBinding::{
self, XRInputSourceEventMethods,
@@ -16,9 +20,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::dom::xrframe::XRFrame;
use crate::dom::xrinputsource::XRInputSource;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct XRInputSourceEvent {
diff --git a/components/script/dom/xrinputsourceschangeevent.rs b/components/script/dom/xrinputsourceschangeevent.rs
index ae2fcdfa45f..16a47cca8dc 100644
--- a/components/script/dom/xrinputsourceschangeevent.rs
+++ b/components/script/dom/xrinputsourceschangeevent.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::Heap;
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::XRInputSourcesChangeEventBinding::{
self, XRInputSourcesChangeEventMethods,
@@ -17,12 +24,6 @@ use crate::dom::xrinputsource::XRInputSource;
use crate::dom::xrsession::XRSession;
use crate::realms::enter_realm;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::Heap;
-use js::jsval::{JSVal, UndefinedValue};
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct XRInputSourcesChangeEvent {
diff --git a/components/script/dom/xrjointpose.rs b/components/script/dom/xrjointpose.rs
index c4b610b3327..d889cb7bb14 100644
--- a/components/script/dom/xrjointpose.rs
+++ b/components/script/dom/xrjointpose.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::XRJointPoseBinding::XRJointPoseMethods;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object;
@@ -10,7 +12,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::xrpose::XRPose;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::ApiRigidTransform;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct XRJointPose {
diff --git a/components/script/dom/xrjointspace.rs b/components/script/dom/xrjointspace.rs
index 57b0b88f761..34750b7814b 100644
--- a/components/script/dom/xrjointspace.rs
+++ b/components/script/dom/xrjointspace.rs
@@ -2,14 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::RigidTransform3D;
+use webxr_api::{BaseSpace, Frame, InputId, Joint, JointFrame, Space};
+
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrsession::{ApiPose, XRSession};
use crate::dom::xrspace::XRSpace;
-use dom_struct::dom_struct;
-use euclid::RigidTransform3D;
-use webxr_api::{BaseSpace, Frame, InputId, Joint, JointFrame, Space};
#[dom_struct]
pub struct XRJointSpace {
diff --git a/components/script/dom/xrlayer.rs b/components/script/dom/xrlayer.rs
index 7319eb482dd..3dc3b4dfeea 100644
--- a/components/script/dom/xrlayer.rs
+++ b/components/script/dom/xrlayer.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLContextId;
+use dom_struct::dom_struct;
+use webxr_api::LayerId;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::Dom;
use crate::dom::eventtarget::EventTarget;
@@ -9,9 +13,6 @@ use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::xrframe::XRFrame;
use crate::dom::xrsession::XRSession;
use crate::dom::xrwebgllayer::XRWebGLLayer;
-use canvas_traits::webgl::WebGLContextId;
-use dom_struct::dom_struct;
-use webxr_api::LayerId;
#[dom_struct]
pub struct XRLayer {
diff --git a/components/script/dom/xrlayerevent.rs b/components/script/dom/xrlayerevent.rs
index 6671a4d1f10..c2f15ee3959 100644
--- a/components/script/dom/xrlayerevent.rs
+++ b/components/script/dom/xrlayerevent.rs
@@ -2,19 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
-use crate::dom::bindings::codegen::Bindings::XRLayerEventBinding::XRLayerEventInit;
-use crate::dom::bindings::codegen::Bindings::XRLayerEventBinding::XRLayerEventMethods;
+use crate::dom::bindings::codegen::Bindings::XRLayerEventBinding::{
+ XRLayerEventInit, XRLayerEventMethods,
+};
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::window::Window;
use crate::dom::xrlayer::XRLayer;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
// https://w3c.github.io/uievents/#interface-uievent
#[dom_struct]
diff --git a/components/script/dom/xrmediabinding.rs b/components/script/dom/xrmediabinding.rs
index 045d4812c1c..c65ce882c65 100644
--- a/components/script/dom/xrmediabinding.rs
+++ b/components/script/dom/xrmediabinding.rs
@@ -2,22 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::XRMediaBindingBinding::XRMediaBindingBinding::XRMediaBindingMethods;
use crate::dom::bindings::codegen::Bindings::XRMediaBindingBinding::XRMediaLayerInit;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::Reflector;
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::error::{Error, Fallible};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::htmlvideoelement::HTMLVideoElement;
use crate::dom::window::Window;
use crate::dom::xrcylinderlayer::XRCylinderLayer;
use crate::dom::xrequirectlayer::XREquirectLayer;
use crate::dom::xrquadlayer::XRQuadLayer;
use crate::dom::xrsession::XRSession;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct XRMediaBinding {
diff --git a/components/script/dom/xrpose.rs b/components/script/dom/xrpose.rs
index bc9fb3a4be5..90b9629757e 100644
--- a/components/script/dom/xrpose.rs
+++ b/components/script/dom/xrpose.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::XRPoseBinding::XRPoseMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::ApiRigidTransform;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct XRPose {
diff --git a/components/script/dom/xrprojectionlayer.rs b/components/script/dom/xrprojectionlayer.rs
index f5d6f68de67..489c3a9e706 100644
--- a/components/script/dom/xrprojectionlayer.rs
+++ b/components/script/dom/xrprojectionlayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrcompositionlayer::XRCompositionLayer;
use dom_struct::dom_struct;
+use crate::dom::xrcompositionlayer::XRCompositionLayer;
+
#[dom_struct]
pub struct XRProjectionLayer {
composition_layer: XRCompositionLayer,
diff --git a/components/script/dom/xrquadlayer.rs b/components/script/dom/xrquadlayer.rs
index 86358a7d7b5..dd93aea9c0a 100644
--- a/components/script/dom/xrquadlayer.rs
+++ b/components/script/dom/xrquadlayer.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::xrcompositionlayer::XRCompositionLayer;
use dom_struct::dom_struct;
+use crate::dom::xrcompositionlayer::XRCompositionLayer;
+
#[dom_struct]
pub struct XRQuadLayer {
composition_layer: XRCompositionLayer,
diff --git a/components/script/dom/xrray.rs b/components/script/dom/xrray.rs
index 1847e985362..1bb925a03a1 100644
--- a/components/script/dom/xrray.rs
+++ b/components/script/dom/xrray.rs
@@ -2,6 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use euclid::{Angle, RigidTransform3D, Rotation3D, Vector3D};
+use js::jsapi::{Heap, JSObject};
+use js::rust::HandleObject;
+use webxr_api::{ApiSpace, Ray};
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::XRRayBinding::{XRRayDirectionInit, XRRayMethods};
use crate::dom::bindings::error::{Error, Fallible};
@@ -13,12 +21,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use euclid::{Angle, RigidTransform3D, Rotation3D, Vector3D};
-use js::jsapi::{Heap, JSObject};
-use js::rust::HandleObject;
-use std::ptr::NonNull;
-use webxr_api::{ApiSpace, Ray};
#[dom_struct]
pub struct XRRay {
diff --git a/components/script/dom/xrreferencespace.rs b/components/script/dom/xrreferencespace.rs
index 1bd368c5834..52dab15f7bb 100644
--- a/components/script/dom/xrreferencespace.rs
+++ b/components/script/dom/xrreferencespace.rs
@@ -2,8 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceMethods;
-use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType;
+use dom_struct::dom_struct;
+use euclid::RigidTransform3D;
+use webxr_api::{self, Frame, Space};
+
+use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::{
+ XRReferenceSpaceMethods, XRReferenceSpaceType,
+};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -11,9 +16,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::{cast_transform, ApiPose, BaseTransform, XRSession};
use crate::dom::xrspace::XRSpace;
-use dom_struct::dom_struct;
-use euclid::RigidTransform3D;
-use webxr_api::{self, Frame, Space};
#[dom_struct]
pub struct XRReferenceSpace {
diff --git a/components/script/dom/xrrenderstate.rs b/components/script/dom/xrrenderstate.rs
index 71e6d873814..efbb5c43b34 100644
--- a/components/script/dom/xrrenderstate.rs
+++ b/components/script/dom/xrrenderstate.rs
@@ -2,21 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+
+use dom_struct::dom_struct;
+use js::jsval::JSVal;
+use webxr_api::SubImages;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::{DomRoot, MutNullableDom};
+use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::utils::to_frozen_array;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrlayer::XRLayer;
use crate::dom::xrwebgllayer::XRWebGLLayer;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use js::jsval::JSVal;
-use std::cell::Cell;
-use webxr_api::SubImages;
#[dom_struct]
pub struct XRRenderState {
diff --git a/components/script/dom/xrrigidtransform.rs b/components/script/dom/xrrigidtransform.rs
index 1ee7f4304ea..3fabb23a297 100644
--- a/components/script/dom/xrrigidtransform.rs
+++ b/components/script/dom/xrrigidtransform.rs
@@ -2,12 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use euclid::{RigidTransform3D, Rotation3D, Vector3D};
+use js::jsapi::{Heap, JSObject};
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding::XRRigidTransformMethods;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
+use crate::dom::bindings::error::{Error, Fallible};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject, Reflector};
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::utils::create_typed_array;
use crate::dom::dompointreadonly::DOMPointReadOnly;
@@ -15,11 +20,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::dom::xrsession::ApiRigidTransform;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use euclid::{RigidTransform3D, Rotation3D, Vector3D};
-use js::jsapi::{Heap, JSObject};
-use js::rust::HandleObject;
-use std::ptr::NonNull;
#[dom_struct]
pub struct XRRigidTransform {
diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs
index 0afa821211f..dec495b2c82 100644
--- a/components/script/dom/xrsession.rs
+++ b/components/script/dom/xrsession.rs
@@ -2,19 +2,38 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::f64::consts::{FRAC_PI_2, PI};
+use std::mem;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use euclid::{RigidTransform3D, Transform3D, Vector3D};
+use ipc_channel::ipc::IpcReceiver;
+use ipc_channel::router::ROUTER;
+use metrics::ToMs;
+use profile_traits::ipc;
+use webxr_api::{
+ self, util, ApiSpace, ContextId as WebXRContextId, Display, EntityTypes, EnvironmentBlendMode,
+ Event as XREvent, Frame, FrameUpdateEvent, HitTestId, HitTestSource, Ray, SelectEvent,
+ SelectKind, Session, SessionId, View, Viewer, Visibility,
+};
+
+use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
-use crate::dom::bindings::codegen::Bindings::XRHitTestSourceBinding::XRHitTestOptionsInit;
-use crate::dom::bindings::codegen::Bindings::XRHitTestSourceBinding::XRHitTestTrackableType;
+use crate::dom::bindings::codegen::Bindings::XRHitTestSourceBinding::{
+ XRHitTestOptionsInit, XRHitTestTrackableType,
+};
use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType;
-use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateInit;
-use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
-use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XREnvironmentBlendMode;
-use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCallback;
-use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
-use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState;
+use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::{
+ XRRenderStateInit, XRRenderStateMethods,
+};
+use crate::dom::bindings::codegen::Bindings::XRSessionBinding::{
+ XREnvironmentBlendMode, XRFrameRequestCallback, XRSessionMethods, XRVisibilityState,
+};
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionMode;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::inheritance::Castable;
@@ -36,24 +55,6 @@ use crate::dom::xrsessionevent::XRSessionEvent;
use crate::dom::xrspace::XRSpace;
use crate::realms::InRealm;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use euclid::{RigidTransform3D, Transform3D, Vector3D};
-use ipc_channel::ipc::IpcReceiver;
-use ipc_channel::router::ROUTER;
-use metrics::ToMs;
-use profile_traits::ipc;
-use std::cell::Cell;
-use std::f64::consts::{FRAC_PI_2, PI};
-use std::mem;
-use std::rc::Rc;
-use webxr_api::ContextId as WebXRContextId;
-use webxr_api::{
- self, util, ApiSpace, Display, EntityTypes, EnvironmentBlendMode, Event as XREvent, Frame,
- FrameUpdateEvent, HitTestId, HitTestSource, Ray, SelectEvent, SelectKind, Session, SessionId,
- View, Viewer, Visibility,
-};
-
-use super::bindings::trace::HashMapTracedValues;
#[dom_struct]
pub struct XRSession {
diff --git a/components/script/dom/xrsessionevent.rs b/components/script/dom/xrsessionevent.rs
index 68eb1903c82..1dd503de606 100644
--- a/components/script/dom/xrsessionevent.rs
+++ b/components/script/dom/xrsessionevent.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+use servo_atoms::Atom;
+
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::XRSessionEventBinding::{self, XRSessionEventMethods};
use crate::dom::bindings::error::Fallible;
@@ -13,9 +17,6 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::dom::xrsession::XRSession;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
-use servo_atoms::Atom;
#[dom_struct]
pub struct XRSessionEvent {
diff --git a/components/script/dom/xrspace.rs b/components/script/dom/xrspace.rs
index 66dd5b44e70..d810d5c07f0 100644
--- a/components/script/dom/xrspace.rs
+++ b/components/script/dom/xrspace.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::RigidTransform3D;
+use webxr_api::{BaseSpace, Frame, Space};
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
@@ -11,9 +15,6 @@ use crate::dom::xrinputsource::XRInputSource;
use crate::dom::xrjointspace::XRJointSpace;
use crate::dom::xrreferencespace::XRReferenceSpace;
use crate::dom::xrsession::{cast_transform, ApiPose, XRSession};
-use dom_struct::dom_struct;
-use euclid::RigidTransform3D;
-use webxr_api::{BaseSpace, Frame, Space};
#[dom_struct]
pub struct XRSpace {
diff --git a/components/script/dom/xrsubimage.rs b/components/script/dom/xrsubimage.rs
index 2be59d48d3b..a5265a3aa76 100644
--- a/components/script/dom/xrsubimage.rs
+++ b/components/script/dom/xrsubimage.rs
@@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+
use crate::dom::bindings::codegen::Bindings::XRSubImageBinding::XRSubImageBinding::XRSubImageMethods;
use crate::dom::bindings::reflector::Reflector;
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::xrviewport::XRViewport;
-use dom_struct::dom_struct;
#[dom_struct]
pub struct XRSubImage {
diff --git a/components/script/dom/xrsystem.rs b/components/script/dom/xrsystem.rs
index 907aa2935d1..e4e158605e0 100644
--- a/components/script/dom/xrsystem.rs
+++ b/components/script/dom/xrsystem.rs
@@ -2,9 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc::{self as ipc_crate, IpcReceiver};
+use ipc_channel::router::ROUTER;
+use msg::constellation_msg::PipelineId;
+use profile_traits::ipc;
+use servo_config::pref;
+use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
+
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionInit;
-use crate::dom::bindings::codegen::Bindings::XRSystemBinding::{XRSessionMode, XRSystemMethods};
+use crate::dom::bindings::codegen::Bindings::XRSystemBinding::{
+ XRSessionInit, XRSessionMode, XRSystemMethods,
+};
use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::inheritance::Castable;
@@ -22,15 +34,6 @@ use crate::dom::xrtest::XRTest;
use crate::realms::InRealm;
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::{self as ipc_crate, IpcReceiver};
-use ipc_channel::router::ROUTER;
-use msg::constellation_msg::PipelineId;
-use profile_traits::ipc;
-use servo_config::pref;
-use std::cell::Cell;
-use std::rc::Rc;
-use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
#[dom_struct]
pub struct XRSystem {
diff --git a/components/script/dom/xrtest.rs b/components/script/dom/xrtest.rs
index 37707c3ce8e..7327154e79d 100644
--- a/components/script/dom/xrtest.rs
+++ b/components/script/dom/xrtest.rs
@@ -6,6 +6,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::rc::Rc;
+
+use dom_struct::dom_struct;
+use ipc_channel::ipc::IpcSender;
+use ipc_channel::router::ROUTER;
+use profile_traits::ipc;
+use webxr_api::{self, Error as XRError, MockDeviceInit, MockDeviceMsg};
+
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function;
@@ -19,12 +27,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
-use dom_struct::dom_struct;
-use ipc_channel::ipc::IpcSender;
-use ipc_channel::router::ROUTER;
-use profile_traits::ipc;
-use std::rc::Rc;
-use webxr_api::{self, Error as XRError, MockDeviceInit, MockDeviceMsg};
#[dom_struct]
pub struct XRTest {
diff --git a/components/script/dom/xrview.rs b/components/script/dom/xrview.rs
index ec3edde82e0..747bee2fd8f 100644
--- a/components/script/dom/xrview.rs
+++ b/components/script/dom/xrview.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr::NonNull;
+
+use dom_struct::dom_struct;
+use euclid::RigidTransform3D;
+use js::jsapi::{Heap, JSObject};
+use webxr_api::{ApiSpace, View};
+
use crate::dom::bindings::codegen::Bindings::XRViewBinding::{XREye, XRViewMethods};
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -10,11 +17,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::{cast_transform, BaseSpace, BaseTransform, XRSession};
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use euclid::RigidTransform3D;
-use js::jsapi::{Heap, JSObject};
-use std::ptr::NonNull;
-use webxr_api::{ApiSpace, View};
#[dom_struct]
pub struct XRView {
diff --git a/components/script/dom/xrviewerpose.rs b/components/script/dom/xrviewerpose.rs
index e9b072e5e5d..7105d593737 100644
--- a/components/script/dom/xrviewerpose.rs
+++ b/components/script/dom/xrviewerpose.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::RigidTransform3D;
+use js::conversions::ToJSValConvertible;
+use js::jsapi::Heap;
+use js::jsval::{JSVal, UndefinedValue};
+use webxr_api::{Viewer, ViewerPose, Views};
+
use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye;
use crate::dom::bindings::codegen::Bindings::XRViewerPoseBinding::XRViewerPoseMethods;
use crate::dom::bindings::reflector::reflect_dom_object;
@@ -13,12 +20,6 @@ use crate::dom::xrsession::{cast_transform, BaseSpace, BaseTransform, XRSession}
use crate::dom::xrview::XRView;
use crate::realms::enter_realm;
use crate::script_runtime::JSContext;
-use dom_struct::dom_struct;
-use euclid::RigidTransform3D;
-use js::conversions::ToJSValConvertible;
-use js::jsapi::Heap;
-use js::jsval::{JSVal, UndefinedValue};
-use webxr_api::{Viewer, ViewerPose, Views};
#[dom_struct]
pub struct XRViewerPose {
diff --git a/components/script/dom/xrviewport.rs b/components/script/dom/xrviewport.rs
index 968cb573264..d9c90505034 100644
--- a/components/script/dom/xrviewport.rs
+++ b/components/script/dom/xrviewport.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use euclid::Rect;
+use webxr_api::Viewport;
+
use crate::dom::bindings::codegen::Bindings::XRViewportBinding::XRViewportMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
-use dom_struct::dom_struct;
-use euclid::Rect;
-use webxr_api::Viewport;
#[dom_struct]
pub struct XRViewport {
diff --git a/components/script/dom/xrwebglbinding.rs b/components/script/dom/xrwebglbinding.rs
index 60e2d1be6b4..4ff845b055a 100644
--- a/components/script/dom/xrwebglbinding.rs
+++ b/components/script/dom/xrwebglbinding.rs
@@ -2,21 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use dom_struct::dom_struct;
+use js::rust::HandleObject;
+
use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRCubeLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRCylinderLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XREquirectLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRProjectionLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRQuadLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRTextureType;
use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRWebGLBindingBinding::XRWebGLBindingMethods;
+use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::{
+ XRCubeLayerInit, XRCylinderLayerInit, XREquirectLayerInit, XRProjectionLayerInit,
+ XRQuadLayerInit, XRTextureType,
+};
use crate::dom::bindings::codegen::UnionTypes::WebGLRenderingContextOrWebGL2RenderingContext;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
-use crate::dom::bindings::reflector::Reflector;
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::error::{Error, Fallible};
+use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::window::Window;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
@@ -29,8 +27,6 @@ use crate::dom::xrquadlayer::XRQuadLayer;
use crate::dom::xrsession::XRSession;
use crate::dom::xrview::XRView;
use crate::dom::xrwebglsubimage::XRWebGLSubImage;
-use dom_struct::dom_struct;
-use js::rust::HandleObject;
#[dom_struct]
pub struct XRWebGLBinding {
diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs
index 1e414d95779..b876fa0b7ce 100644
--- a/components/script/dom/xrwebgllayer.rs
+++ b/components/script/dom/xrwebgllayer.rs
@@ -2,13 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::convert::TryInto;
+
+use canvas_traits::webgl::{WebGLCommand, WebGLContextId, WebGLTextureId};
+use dom_struct::dom_struct;
+use euclid::{Rect, Size2D};
+use js::rust::HandleObject;
+use webxr_api::{ContextId as WebXRContextId, LayerId, LayerInit, Viewport};
+
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
-use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerInit;
-use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerMethods;
-use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLRenderingContext;
-use crate::dom::bindings::error::Error;
-use crate::dom::bindings::error::Fallible;
+use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
+ XRWebGLLayerInit, XRWebGLLayerMethods, XRWebGLRenderingContext,
+};
+use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
@@ -23,17 +30,6 @@ use crate::dom::xrlayer::XRLayer;
use crate::dom::xrsession::XRSession;
use crate::dom::xrview::XRView;
use crate::dom::xrviewport::XRViewport;
-use canvas_traits::webgl::WebGLCommand;
-use canvas_traits::webgl::WebGLContextId;
-use canvas_traits::webgl::WebGLTextureId;
-use dom_struct::dom_struct;
-use euclid::{Rect, Size2D};
-use js::rust::HandleObject;
-use std::convert::TryInto;
-use webxr_api::ContextId as WebXRContextId;
-use webxr_api::LayerId;
-use webxr_api::LayerInit;
-use webxr_api::Viewport;
impl<'a> From<&'a XRWebGLLayerInit> for LayerInit {
fn from(init: &'a XRWebGLLayerInit) -> LayerInit {
diff --git a/components/script/dom/xrwebglsubimage.rs b/components/script/dom/xrwebglsubimage.rs
index d9d5420dfe3..0bed4a51906 100644
--- a/components/script/dom/xrwebglsubimage.rs
+++ b/components/script/dom/xrwebglsubimage.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 https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::XRWebGLSubImageBinding::XRWebGLSubImageBinding::XRWebGLSubImageMethods;
-use crate::dom::bindings::root::Dom;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::webgltexture::WebGLTexture;
-use crate::dom::xrsubimage::XRSubImage;
use dom_struct::dom_struct;
use euclid::Size2D;
use webxr_api::Viewport;
+use crate::dom::bindings::codegen::Bindings::XRWebGLSubImageBinding::XRWebGLSubImageBinding::XRWebGLSubImageMethods;
+use crate::dom::bindings::root::{Dom, DomRoot};
+use crate::dom::webgltexture::WebGLTexture;
+use crate::dom::xrsubimage::XRSubImage;
+
#[dom_struct]
pub struct XRWebGLSubImage {
xr_sub_image: XRSubImage,
diff --git a/components/script/fetch.rs b/components/script/fetch.rs
index b3db51d2a1d..bb4b517a065 100644
--- a/components/script/fetch.rs
+++ b/components/script/fetch.rs
@@ -2,8 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo;
-use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use net_traits::request::{
+ CorsSettings, CredentialsMode, Destination, Referrer, Request as NetTraitsRequest,
+ RequestBuilder, RequestMode, ServiceWorkersMode,
+};
+use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch;
+use net_traits::{
+ CoreResourceMsg, CoreResourceThread, FetchChannels, FetchMetadata, FetchResponseListener,
+ FetchResponseMsg, FilteredMetadata, Metadata, NetworkError, ResourceFetchTiming,
+ ResourceTimingType,
+};
+use servo_url::ServoUrl;
+
+use crate::dom::bindings::codegen::Bindings::RequestBinding::{RequestInfo, RequestInit};
use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::ResponseMethods;
use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType;
use crate::dom::bindings::error::Error;
@@ -24,20 +40,6 @@ use crate::network_listener::{
};
use crate::realms::{enter_realm, InRealm};
use crate::task_source::TaskSourceName;
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use net_traits::request::{
- CorsSettings, CredentialsMode, Destination, RequestBuilder, RequestMode,
-};
-use net_traits::request::{Referrer, Request as NetTraitsRequest, ServiceWorkersMode};
-use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch;
-use net_traits::{CoreResourceMsg, CoreResourceThread, FetchResponseMsg};
-use net_traits::{FetchChannels, FetchResponseListener, NetworkError};
-use net_traits::{FetchMetadata, FilteredMetadata, Metadata};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use servo_url::ServoUrl;
-use std::rc::Rc;
-use std::sync::{Arc, Mutex};
struct FetchContext {
fetch_promise: Option<TrustedPromise>,
diff --git a/components/script/image_listener.rs b/components/script/image_listener.rs
index 7bf81c80d76..d43ac12e6b7 100644
--- a/components/script/image_listener.rs
+++ b/components/script/image_listener.rs
@@ -2,15 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use ipc_channel::ipc;
+use ipc_channel::ipc::IpcSender;
+use ipc_channel::router::ROUTER;
+use net_traits::image_cache::{ImageResponse, PendingImageResponse};
+
use crate::dom::bindings::conversions::DerivedFrom;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::node::{window_from_node, Node};
use crate::task_source::TaskSource;
-use ipc_channel::ipc;
-use ipc_channel::ipc::IpcSender;
-use ipc_channel::router::ROUTER;
-use net_traits::image_cache::{ImageResponse, PendingImageResponse};
pub trait ImageCacheListener {
fn generation_id(&self) -> u32;
diff --git a/components/script/init.rs b/components/script/init.rs
index 8fd59592f01..8cd93fe2aa0 100644
--- a/components/script/init.rs
+++ b/components/script/init.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use js::jsapi::JSObject;
+
use crate::dom::bindings::codegen::RegisterBindings;
use crate::dom::bindings::conversions::is_dom_proxy;
use crate::dom::bindings::proxyhandler;
use crate::dom::bindings::utils::is_platform_object_static;
use crate::script_runtime::JSEngineSetup;
-use js::jsapi::JSObject;
#[cfg(target_os = "linux")]
#[allow(unsafe_code)]
diff --git a/components/script/layout_dom/document.rs b/components/script/layout_dom/document.rs
index 392c1686f97..f068600a005 100644
--- a/components/script/layout_dom/document.rs
+++ b/components/script/layout_dom/document.rs
@@ -2,21 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::root::LayoutDom;
-use crate::dom::document::{Document, LayoutDocumentHelpers};
-use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
-use crate::layout_dom::ServoLayoutElement;
-use crate::layout_dom::ServoLayoutNode;
-use crate::layout_dom::ServoShadowRoot;
+use std::marker::PhantomData;
+
use script_layout_interface::wrapper_traits::LayoutDataTrait;
use selectors::matching::QuirksMode;
-use std::marker::PhantomData;
use style::dom::{TDocument, TNode};
use style::shared_lock::{
SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard as StyleSharedRwLockReadGuard,
};
use style::stylist::Stylist;
+use crate::dom::bindings::root::LayoutDom;
+use crate::dom::document::{Document, LayoutDocumentHelpers};
+use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
+use crate::layout_dom::{ServoLayoutElement, ServoLayoutNode, ServoShadowRoot};
+
// A wrapper around documents that ensures ayout can only ever access safe properties.
pub struct ServoLayoutDocument<'dom, LayoutDataType: LayoutDataTrait> {
/// The wrapped private DOM Document
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 2b1c199cbaa..b923cdb12f8 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -2,15 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::attr::AttrHelpersForLayout;
-use crate::dom::bindings::inheritance::{
- CharacterDataTypeId, DocumentFragmentTypeId, ElementTypeId,
-};
-use crate::dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId, TextTypeId};
-use crate::dom::bindings::root::LayoutDom;
-use crate::dom::characterdata::LayoutCharacterDataHelpers;
-use crate::dom::element::{Element, LayoutElementHelpers};
-use crate::dom::node::{LayoutNodeHelpers, NodeFlags};
+use std::fmt;
+use std::hash::{Hash, Hasher};
+use std::marker::PhantomData;
+use std::sync::atomic::Ordering;
+
use atomic_refcell::{AtomicRef, AtomicRefMut};
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace};
use script_layout_interface::wrapper_traits::{
@@ -23,10 +19,6 @@ use selectors::matching::{ElementSelectorFlags, MatchingContext, VisitedHandling
use selectors::sink::Push;
use servo_arc::{Arc, ArcBorrow};
use servo_atoms::Atom;
-use std::fmt;
-use std::hash::{Hash, Hasher};
-use std::marker::PhantomData;
-use std::sync::atomic::Ordering;
use style::animation::AnimationSetKey;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::attr::AttrValue;
@@ -43,9 +35,16 @@ use style::shared_lock::Locked as StyleLocked;
use style::values::{AtomIdent, AtomString};
use style::CaseSensitivityExt;
-use crate::layout_dom::ServoLayoutNode;
-use crate::layout_dom::ServoShadowRoot;
-use crate::layout_dom::ServoThreadSafeLayoutNode;
+use crate::dom::attr::AttrHelpersForLayout;
+use crate::dom::bindings::inheritance::{
+ CharacterDataTypeId, DocumentFragmentTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId,
+ TextTypeId,
+};
+use crate::dom::bindings::root::LayoutDom;
+use crate::dom::characterdata::LayoutCharacterDataHelpers;
+use crate::dom::element::{Element, LayoutElementHelpers};
+use crate::dom::node::{LayoutNodeHelpers, NodeFlags};
+use crate::layout_dom::{ServoLayoutNode, ServoShadowRoot, ServoThreadSafeLayoutNode};
/// A wrapper around elements that ensures layout can only ever access safe properties.
pub struct ServoLayoutElement<'dom, LayoutDataType: LayoutDataTrait> {
diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs
index 7674a10e743..521e20957f7 100644
--- a/components/script/layout_dom/node.rs
+++ b/components/script/layout_dom/node.rs
@@ -4,17 +4,11 @@
#![allow(unsafe_code)]
-use super::ServoLayoutDocument;
-use super::ServoLayoutElement;
-use super::ServoShadowRoot;
-use super::ServoThreadSafeLayoutElement;
-use crate::dom::bindings::inheritance::CharacterDataTypeId;
-use crate::dom::bindings::inheritance::{NodeTypeId, TextTypeId};
-use crate::dom::bindings::root::LayoutDom;
-use crate::dom::characterdata::LayoutCharacterDataHelpers;
-use crate::dom::element::{Element, LayoutElementHelpers};
-use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
-use crate::dom::text::Text;
+use std::borrow::Cow;
+use std::fmt;
+use std::marker::PhantomData;
+use std::sync::Arc as StdArc;
+
use atomic_refcell::AtomicRefCell;
use gfx_traits::ByteIndex;
use html5ever::{local_name, namespace_url, ns};
@@ -31,16 +25,22 @@ use script_layout_interface::{
};
use servo_arc::Arc;
use servo_url::ServoUrl;
-use std::borrow::Cow;
-use std::fmt;
-use std::marker::PhantomData;
-use std::sync::Arc as StdArc;
use style;
use style::context::SharedStyleContext;
use style::dom::{NodeInfo, TElement, TNode, TShadowRoot};
use style::properties::ComputedValues;
use style::str::is_whitespace;
+use super::{
+ ServoLayoutDocument, ServoLayoutElement, ServoShadowRoot, ServoThreadSafeLayoutElement,
+};
+use crate::dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId, TextTypeId};
+use crate::dom::bindings::root::LayoutDom;
+use crate::dom::characterdata::LayoutCharacterDataHelpers;
+use crate::dom::element::{Element, LayoutElementHelpers};
+use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
+use crate::dom::text::Text;
+
/// A wrapper around a `LayoutDom<Node>` which provides a safe interface that
/// can be used during layout. This implements the `LayoutNode` trait as well as
/// several style and selectors traits for use during layout. This version
diff --git a/components/script/layout_dom/shadow_root.rs b/components/script/layout_dom/shadow_root.rs
index 19336befe74..7bd57a8ee84 100644
--- a/components/script/layout_dom/shadow_root.rs
+++ b/components/script/layout_dom/shadow_root.rs
@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::root::LayoutDom;
-use crate::dom::shadowroot::{LayoutShadowRootHelpers, ShadowRoot};
-use crate::layout_dom::ServoLayoutElement;
-use crate::layout_dom::ServoLayoutNode;
-use script_layout_interface::wrapper_traits::LayoutDataTrait;
use std::fmt;
use std::marker::PhantomData;
+
+use script_layout_interface::wrapper_traits::LayoutDataTrait;
use style::dom::TShadowRoot;
use style::shared_lock::SharedRwLockReadGuard as StyleSharedRwLockReadGuard;
use style::stylist::{CascadeData, Stylist};
+use crate::dom::bindings::root::LayoutDom;
+use crate::dom::shadowroot::{LayoutShadowRootHelpers, ShadowRoot};
+use crate::layout_dom::{ServoLayoutElement, ServoLayoutNode};
+
pub struct ServoShadowRoot<'dom, LayoutDataType: LayoutDataTrait> {
/// The wrapped private DOM ShadowRoot.
shadow_root: LayoutDom<'dom, ShadowRoot>,
diff --git a/components/script/layout_image.rs b/components/script/layout_image.rs
index 68ece467ad7..a7e1d6fa06c 100644
--- a/components/script/layout_image.rs
+++ b/components/script/layout_image.rs
@@ -7,6 +7,18 @@
//! no guarantee that the responsible nodes will still exist in the future if the
//! layout thread holds on to them during asynchronous operations.
+use std::sync::{Arc, Mutex};
+
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use net_traits::image_cache::{ImageCache, PendingImageId};
+use net_traits::request::{Destination, RequestBuilder as FetchRequestInit};
+use net_traits::{
+ FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError, ResourceFetchTiming,
+ ResourceTimingType,
+};
+use servo_url::ServoUrl;
+
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
@@ -15,14 +27,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::node::{document_from_node, Node};
use crate::dom::performanceresourcetiming::InitiatorType;
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use net_traits::image_cache::{ImageCache, PendingImageId};
-use net_traits::request::{Destination, RequestBuilder as FetchRequestInit};
-use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use servo_url::ServoUrl;
-use std::sync::{Arc, Mutex};
struct LayoutImageContext {
id: PendingImageId,
diff --git a/components/script/mem.rs b/components/script/mem.rs
index 6762c56a237..56401d8a51e 100644
--- a/components/script/mem.rs
+++ b/components/script/mem.rs
@@ -4,9 +4,10 @@
//! Routines for handling measuring the memory usage of arbitrary DOM nodes.
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::os::raw::c_void;
+use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+
/// Used by codegen to include the pointer to the `MallocSizeOf` implementation of each
/// IDL interface. This way we don't have to find the most-derived interface of DOM
/// objects by hand in code.
diff --git a/components/script/microtask.rs b/components/script/microtask.rs
index 4a810fd0cfd..904925fc9db 100644
--- a/components/script/microtask.rs
+++ b/components/script/microtask.rs
@@ -6,6 +6,13 @@
//! microtask queues. It is up to implementations of event loops to store a queue and
//! perform checkpoints at appropriate times, as well as enqueue microtasks as required.
+use std::cell::Cell;
+use std::mem;
+use std::rc::Rc;
+
+use js::jsapi::{JSAutoRealm, JobQueueIsEmpty, JobQueueMayNotBeEmpty};
+use msg::constellation_msg::PipelineId;
+
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback;
@@ -18,11 +25,6 @@ use crate::dom::mutationobserver::MutationObserver;
use crate::realms::enter_realm;
use crate::script_runtime::{notify_about_rejected_promises, JSContext};
use crate::script_thread::ScriptThread;
-use js::jsapi::{JSAutoRealm, JobQueueIsEmpty, JobQueueMayNotBeEmpty};
-use msg::constellation_msg::PipelineId;
-use std::cell::Cell;
-use std::mem;
-use std::rc::Rc;
/// A collection of microtasks in FIFO order.
#[derive(Default, JSTraceable, MallocSizeOf)]
diff --git a/components/script/network_listener.rs b/components/script/network_listener.rs
index 29c43450aac..08fd3a2c88b 100644
--- a/components/script/network_listener.rs
+++ b/components/script/network_listener.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::sync::{Arc, Mutex};
+
+use net_traits::{
+ Action, FetchResponseListener, FetchResponseMsg, ResourceFetchTiming, ResourceTimingType,
+};
+use servo_url::ServoUrl;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
@@ -10,11 +17,6 @@ use crate::dom::performanceresourcetiming::{InitiatorType, PerformanceResourceTi
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::TaskSource;
-use net_traits::{
- Action, FetchResponseListener, FetchResponseMsg, ResourceFetchTiming, ResourceTimingType,
-};
-use servo_url::ServoUrl;
-use std::sync::{Arc, Mutex};
/// An off-thread sink for async network event tasks. All such events are forwarded to
/// a target thread, where they are invoked on the provided context object.
diff --git a/components/script/realms.rs b/components/script/realms.rs
index 48b141aae56..37ed21366a3 100644
--- a/components/script/realms.rs
+++ b/components/script/realms.rs
@@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use js::jsapi::{GetCurrentRealmOrNull, JSAutoRealm};
+
use crate::dom::bindings::reflector::DomObject;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::JSContext;
-use js::jsapi::{GetCurrentRealmOrNull, JSAutoRealm};
pub struct AlreadyInRealm(());
diff --git a/components/script/script_module.rs b/components/script/script_module.rs
index ad36507c3a3..ac829e244b7 100644
--- a/components/script/script_module.rs
+++ b/components/script/script_module.rs
@@ -5,12 +5,52 @@
//! The script module mod contains common traits and structs
//! related to `type=module` for script thread or worker threads.
+use std::collections::{HashMap, HashSet};
+use std::rc::Rc;
+use std::str::FromStr;
+use std::sync::{Arc, Mutex};
+use std::{mem, ptr};
+
+use encoding_rs::UTF_8;
+use html5ever::local_name;
+use hyper_serde::Serde;
+use indexmap::IndexSet;
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::jsapi::{
+ CompileModule1, ExceptionStackBehavior, FinishDynamicModuleImport, GetModuleRequestSpecifier,
+ GetModuleResolveHook, GetRequestedModules, Handle as RawHandle, HandleObject,
+ HandleValue as RawHandleValue, Heap, JSAutoRealm, JSContext, JSObject, JSRuntime, JSString,
+ JS_ClearPendingException, JS_DefineProperty4, JS_IsExceptionPending, JS_NewStringCopyN,
+ ModuleErrorBehaviour, ModuleEvaluate, ModuleLink, MutableHandleValue,
+ SetModuleDynamicImportHook, SetModuleMetadataHook, SetModulePrivate, SetModuleResolveHook,
+ SetScriptPrivateReferenceHooks, ThrowOnModuleEvaluationFailure, Value, JSPROP_ENUMERATE,
+};
+use js::jsval::{JSVal, PrivateValue, UndefinedValue};
+use js::rust::jsapi_wrapped::{
+ GetArrayLength, GetRequestedModuleSpecifier, JS_GetElement, JS_GetPendingException,
+};
+use js::rust::wrappers::JS_SetPendingException;
+use js::rust::{
+ transform_str_to_source_text, CompileOptionsWrapper, Handle, HandleValue, IntoHandle,
+};
+use mime::Mime;
+use net_traits::request::{
+ CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder, RequestMode,
+};
+use net_traits::{
+ CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, IpcSend, Metadata,
+ NetworkError, ReferrerPolicy, ResourceFetchTiming, ResourceTimingType,
+};
+use servo_url::ServoUrl;
+use url::ParseError as UrlParseError;
+use uuid::Uuid;
+
use crate::document_loader::LoadType;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::conversions::jsstring_to_str;
-use crate::dom::bindings::error::report_pending_exception;
-use crate::dom::bindings::error::Error;
+use crate::dom::bindings::error::{report_pending_exception, Error};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
@@ -22,63 +62,20 @@ use crate::dom::document::Document;
use crate::dom::dynamicmoduleowner::{DynamicModuleId, DynamicModuleOwner};
use crate::dom::element::Element;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::htmlscriptelement::{HTMLScriptElement, ScriptId};
-use crate::dom::htmlscriptelement::{ScriptOrigin, ScriptType, SCRIPT_JS_MIMES};
+use crate::dom::htmlscriptelement::{
+ HTMLScriptElement, ScriptId, ScriptOrigin, ScriptType, SCRIPT_JS_MIMES,
+};
use crate::dom::node::document_from_node;
use crate::dom::performanceresourcetiming::InitiatorType;
use crate::dom::promise::Promise;
use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler};
use crate::dom::window::Window;
use crate::dom::worker::TrustedWorkerAddress;
-use crate::network_listener::{self, NetworkListener};
-use crate::network_listener::{PreInvoke, ResourceTimingListener};
+use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
use crate::script_runtime::JSContext as SafeJSContext;
use crate::task::TaskBox;
use crate::task_source::TaskSourceName;
-use encoding_rs::UTF_8;
-use html5ever::local_name;
-use hyper_serde::Serde;
-use indexmap::IndexSet;
-use ipc_channel::ipc;
-use ipc_channel::router::ROUTER;
-use js::jsapi::Handle as RawHandle;
-use js::jsapi::HandleObject;
-use js::jsapi::HandleValue as RawHandleValue;
-use js::jsapi::MutableHandleValue;
-use js::jsapi::Value;
-use js::jsapi::{CompileModule1, ExceptionStackBehavior, FinishDynamicModuleImport};
-use js::jsapi::{GetModuleRequestSpecifier, GetRequestedModules, SetModuleMetadataHook};
-use js::jsapi::{GetModuleResolveHook, JSRuntime, SetModuleResolveHook};
-use js::jsapi::{Heap, JSContext, JS_ClearPendingException, SetModulePrivate};
-use js::jsapi::{JSAutoRealm, JSObject, JSString};
-use js::jsapi::{JS_DefineProperty4, JS_IsExceptionPending, JS_NewStringCopyN, JSPROP_ENUMERATE};
-use js::jsapi::{ModuleErrorBehaviour, ModuleEvaluate, ModuleLink, ThrowOnModuleEvaluationFailure};
-use js::jsapi::{SetModuleDynamicImportHook, SetScriptPrivateReferenceHooks};
-use js::jsval::{JSVal, PrivateValue, UndefinedValue};
-use js::rust::jsapi_wrapped::{GetArrayLength, JS_GetElement};
-use js::rust::jsapi_wrapped::{GetRequestedModuleSpecifier, JS_GetPendingException};
-use js::rust::transform_str_to_source_text;
-use js::rust::wrappers::JS_SetPendingException;
-use js::rust::CompileOptionsWrapper;
-use js::rust::{Handle, HandleValue, IntoHandle};
-use mime::Mime;
-use net_traits::request::{CredentialsMode, Destination, ParserMetadata};
-use net_traits::request::{Referrer, RequestBuilder, RequestMode};
-use net_traits::IpcSend;
-use net_traits::{CoreResourceMsg, FetchChannels};
-use net_traits::{FetchMetadata, Metadata, ReferrerPolicy};
-use net_traits::{FetchResponseListener, NetworkError};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use servo_url::ServoUrl;
-use std::collections::{HashMap, HashSet};
-use std::mem;
-use std::ptr;
-use std::rc::Rc;
-use std::str::FromStr;
-use std::sync::{Arc, Mutex};
-use url::ParseError as UrlParseError;
-use uuid::Uuid;
#[allow(unsafe_code)]
unsafe fn gen_type_error(global: &GlobalScope, string: String) -> RethrowError {
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 3d88c50a671..239c056a99d 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -7,23 +7,68 @@
#![allow(dead_code)]
+use core::ffi::c_char;
+use std::cell::Cell;
+use std::ffi::CString;
+use std::io::{stdout, Write};
+use std::ops::Deref;
+use std::os::raw::c_void;
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+use std::time::Duration;
+use std::{fmt, os, ptr, thread};
+
+use js::glue::{
+ CollectServoSizes, CreateJobQueue, DeleteJobQueue, DispatchableRun, JobQueueTraps,
+ RUST_js_GetErrorMessage, SetBuildId, StreamConsumerConsumeChunk,
+ StreamConsumerNoteResponseURLs, StreamConsumerStreamEnd, StreamConsumerStreamError,
+};
+use js::jsapi::{
+ BuildIdCharVector, ContextOptionsRef, DisableIncrementalGC, Dispatchable as JSRunnable,
+ Dispatchable_MaybeShuttingDown, GCDescription, GCOptions, GCProgress, GCReason,
+ GetPromiseUserInputEventHandlingState, HandleObject, Heap, InitConsumeStreamCallback,
+ InitDispatchToEventLoop, JSContext as RawJSContext, JSGCParamKey, JSGCStatus,
+ JSJitCompilerOption, JSObject, JSSecurityCallbacks, JSTracer, JS_AddExtraGCRootsTracer,
+ JS_InitDestroyPrincipalsCallback, JS_RequestInterruptCallback, JS_SetGCCallback,
+ JS_SetGCParameter, JS_SetGlobalJitCompilerOption, JS_SetOffthreadIonCompilationEnabled,
+ JS_SetParallelParsingEnabled, JS_SetSecurityCallbacks, JobQueue, MimeType,
+ PromiseRejectionHandlingState, PromiseUserInputEventHandlingState, SetDOMCallbacks,
+ SetGCSliceCallback, SetJobQueue, SetPreserveWrapperCallbacks, SetProcessBuildIdOp,
+ SetPromiseRejectionTrackerCallback, StreamConsumer as JSStreamConsumer,
+};
+use js::jsval::UndefinedValue;
+use js::panic::wrap_panic;
+use js::rust::wrappers::{GetPromiseIsHandled, JS_GetPromiseResult};
+use js::rust::{
+ Handle, HandleObject as RustHandleObject, IntoHandle, JSEngine, JSEngineHandle, ParentRuntime,
+ Runtime as RustRuntime,
+};
+use lazy_static::lazy_static;
+use malloc_size_of::MallocSizeOfOps;
+use msg::constellation_msg::PipelineId;
+use profile_traits::mem::{Report, ReportKind, ReportsChan};
+use profile_traits::path;
+use servo_config::{opts, pref};
+use style::thread_state::{self, ThreadState};
+use time::{now, Tm};
+
use crate::body::BodyMixin;
use crate::dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback;
use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::ResponseMethods;
use crate::dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType;
-use crate::dom::bindings::conversions::get_dom_class;
-use crate::dom::bindings::conversions::private_from_object;
-use crate::dom::bindings::conversions::root_from_handleobject;
+use crate::dom::bindings::conversions::{
+ get_dom_class, private_from_object, root_from_handleobject,
+};
use crate::dom::bindings::error::{throw_dom_exception, Error};
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::principals;
-use crate::dom::bindings::refcounted::{trace_refcounted_objects, LiveDOMReferences};
-use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
+use crate::dom::bindings::refcounted::{
+ trace_refcounted_objects, LiveDOMReferences, 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;
use crate::dom::bindings::utils::DOM_CALLBACKS;
+use crate::dom::bindings::{principals, settings_stack};
use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
@@ -37,64 +82,6 @@ use crate::script_thread::trace_thread;
use crate::task::TaskBox;
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::{TaskSource, TaskSourceName};
-use core::ffi::c_char;
-use js::glue::{CollectServoSizes, CreateJobQueue, DeleteJobQueue, DispatchableRun};
-use js::glue::{JobQueueTraps, RUST_js_GetErrorMessage, SetBuildId, StreamConsumerConsumeChunk};
-use js::glue::{
- StreamConsumerNoteResponseURLs, StreamConsumerStreamEnd, StreamConsumerStreamError,
-};
-use js::jsapi::ContextOptionsRef;
-use js::jsapi::GetPromiseUserInputEventHandlingState;
-use js::jsapi::InitConsumeStreamCallback;
-use js::jsapi::InitDispatchToEventLoop;
-use js::jsapi::MimeType;
-use js::jsapi::PromiseUserInputEventHandlingState;
-use js::jsapi::StreamConsumer as JSStreamConsumer;
-use js::jsapi::{BuildIdCharVector, DisableIncrementalGC, GCDescription, GCProgress};
-use js::jsapi::{Dispatchable as JSRunnable, Dispatchable_MaybeShuttingDown};
-use js::jsapi::{
- GCOptions, GCReason, JSGCStatus, JS_AddExtraGCRootsTracer, JS_RequestInterruptCallback,
- JS_SetGCCallback,
-};
-use js::jsapi::{HandleObject, Heap, JobQueue};
-use js::jsapi::{JSContext as RawJSContext, JSTracer, SetDOMCallbacks, SetGCSliceCallback};
-use js::jsapi::{JSGCParamKey, JS_SetGCParameter, JS_SetGlobalJitCompilerOption};
-use js::jsapi::{
- JSJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled,
-};
-use js::jsapi::{JSObject, PromiseRejectionHandlingState, SetPreserveWrapperCallbacks};
-use js::jsapi::{JSSecurityCallbacks, JS_InitDestroyPrincipalsCallback, JS_SetSecurityCallbacks};
-use js::jsapi::{SetJobQueue, SetProcessBuildIdOp, SetPromiseRejectionTrackerCallback};
-use js::jsval::UndefinedValue;
-use js::panic::wrap_panic;
-use js::rust::wrappers::{GetPromiseIsHandled, JS_GetPromiseResult};
-use js::rust::Handle;
-use js::rust::HandleObject as RustHandleObject;
-use js::rust::IntoHandle;
-use js::rust::ParentRuntime;
-use js::rust::Runtime as RustRuntime;
-use js::rust::{JSEngine, JSEngineHandle};
-use lazy_static::lazy_static;
-use malloc_size_of::MallocSizeOfOps;
-use msg::constellation_msg::PipelineId;
-use profile_traits::mem::{Report, ReportKind, ReportsChan};
-use profile_traits::path;
-use servo_config::opts;
-use servo_config::pref;
-use std::cell::Cell;
-use std::ffi::CString;
-use std::fmt;
-use std::io::{stdout, Write};
-use std::ops::Deref;
-use std::os;
-use std::os::raw::c_void;
-use std::ptr;
-use std::rc::Rc;
-use std::sync::{Arc, Mutex};
-use std::thread;
-use std::time::Duration;
-use style::thread_state::{self, ThreadState};
-use time::{now, Tm};
static JOB_QUEUE_TRAPS: JobQueueTraps = JobQueueTraps {
getIncumbentGlobal: Some(get_incumbent_global),
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index be456b8d1f7..4ded0c6632a 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -17,7 +17,86 @@
//! a page runs its course and the script thread returns to processing events in the main event
//! loop.
-use crate::devtools;
+use std::borrow::Cow;
+use std::cell::{Cell, RefCell};
+use std::collections::{hash_map, HashMap, HashSet};
+use std::default::Default;
+use std::ops::Deref;
+use std::option::Option;
+use std::rc::Rc;
+use std::result::Result;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+use std::time::{Duration, SystemTime};
+use std::{ptr, thread};
+
+use bluetooth_traits::BluetoothRequest;
+use canvas_traits::webgl::WebGLPipeline;
+use crossbeam_channel::{select, unbounded, Receiver, Sender};
+use devtools_traits::{
+ CSSError, DevtoolScriptControlMsg, DevtoolsPageInfo, NavigationState,
+ ScriptToDevtoolsControlMsg, WorkerId,
+};
+use embedder_traits::EmbedderMsg;
+use euclid::default::{Point2D, Rect};
+use euclid::Vector2D;
+use headers::{HeaderMapExt, LastModified, ReferrerPolicy as ReferrerPolicyHeader};
+use html5ever::{local_name, namespace_url, ns};
+use hyper_serde::Serde;
+use ipc_channel::ipc::{self, IpcSender};
+use ipc_channel::router::ROUTER;
+use js::glue::GetWindowProxyClass;
+use js::jsapi::{
+ JSContext as UnsafeJSContext, JSTracer, JS_AddInterruptCallback, SetWindowProxyClass,
+};
+use js::jsval::UndefinedValue;
+use js::rust::ParentRuntime;
+use media::WindowGLContext;
+use metrics::{PaintTimeMetrics, MAX_TASK_NS};
+use mime::{self, Mime};
+use msg::constellation_msg::{
+ BackgroundHangMonitor, BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister,
+ BrowsingContextId, HangAnnotation, HistoryStateId, MonitoredComponentId,
+ MonitoredComponentType, PipelineId, PipelineNamespace, ScriptHangAnnotation,
+ TopLevelBrowsingContextId,
+};
+use net_traits::image_cache::{ImageCache, PendingImageResponse};
+use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestBuilder};
+use net_traits::storage_thread::StorageType;
+use net_traits::{
+ FetchMetadata, FetchResponseListener, FetchResponseMsg, Metadata, NetworkError, ReferrerPolicy,
+ ResourceFetchTiming, ResourceThreads, ResourceTimingType,
+};
+use parking_lot::Mutex;
+use percent_encoding::percent_decode;
+use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
+use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
+use script_layout_interface::message::{self, LayoutThreadInit, Msg, ReflowGoal};
+use script_traits::webdriver_msg::WebDriverScriptCommand;
+use script_traits::CompositorEvent::{
+ CompositionEvent, IMEDismissedEvent, KeyboardEvent, MouseButtonEvent, MouseMoveEvent,
+ ResizeEvent, TouchEvent, WheelEvent,
+};
+use script_traits::{
+ AnimationTickType, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
+ DocumentActivity, EventResult, HistoryEntryReplacement, InitialScriptState, JsEvalResult,
+ LayoutMsg, LoadData, LoadOrigin, MediaSessionActionType, MouseButton, MouseEventType,
+ NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptMsg, ScriptThreadFactory,
+ ScriptToConstellationChan, StructuredSerializedData, TimerSchedulerMsg, TouchEventType,
+ TouchId, UntrustedNodeAddress, UpdatePipelineIdReason, WebrenderIpcSender, WheelDelta,
+ WindowSizeData, WindowSizeType,
+};
+use servo_atoms::Atom;
+use servo_config::opts;
+use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
+use style::dom::OpaqueNode;
+use style::thread_state::{self, ThreadState};
+use time::{at_utc, get_time, precise_time_ns, Timespec};
+use url::Position;
+use webgpu::identity::WebGPUMsg;
+use webrender_api::units::LayoutPixel;
+use webrender_api::DocumentId;
+
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
@@ -31,8 +110,9 @@ use crate::dom::bindings::conversions::{
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::root::ThreadLocalStackRoots;
-use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootCollection};
+use crate::dom::bindings::root::{
+ Dom, DomRoot, MutNullableDom, RootCollection, ThreadLocalStackRoots,
+};
use crate::dom::bindings::str::DOMString;
use crate::dom::bindings::trace::{HashMapTracedValues, JSTraceable};
use crate::dom::customelementregistry::{
@@ -64,9 +144,9 @@ use crate::microtask::{Microtask, MicrotaskQueue};
use crate::realms::enter_realm;
use crate::script_module::ScriptFetchOptions;
use crate::script_runtime::{
- get_reports, new_rt_and_cx, ContextForRequestInterrupt, JSContext, Runtime, ScriptPort,
+ get_reports, new_rt_and_cx, CommonScriptMsg, ContextForRequestInterrupt, JSContext, Runtime,
+ ScriptChan, ScriptPort, ScriptThreadEventCategory,
};
-use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task_manager::TaskManager;
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
@@ -80,91 +160,8 @@ use crate::task_source::remote_event::RemoteEventTaskSource;
use crate::task_source::timer::TimerTaskSource;
use crate::task_source::user_interaction::UserInteractionTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
-use crate::task_source::TaskSource;
-use crate::task_source::TaskSourceName;
-use crate::webdriver_handlers;
-use bluetooth_traits::BluetoothRequest;
-use canvas_traits::webgl::WebGLPipeline;
-use crossbeam_channel::{select, unbounded, Receiver, Sender};
-use devtools_traits::CSSError;
-use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
-use devtools_traits::{NavigationState, ScriptToDevtoolsControlMsg, WorkerId};
-use embedder_traits::EmbedderMsg;
-use euclid::default::{Point2D, Rect};
-use euclid::Vector2D;
-use headers::ReferrerPolicy as ReferrerPolicyHeader;
-use headers::{HeaderMapExt, LastModified};
-use html5ever::{local_name, namespace_url, ns};
-use hyper_serde::Serde;
-use ipc_channel::ipc::{self, IpcSender};
-use ipc_channel::router::ROUTER;
-use js::glue::GetWindowProxyClass;
-use js::jsapi::{
- JSContext as UnsafeJSContext, JSTracer, JS_AddInterruptCallback, SetWindowProxyClass,
-};
-use js::jsval::UndefinedValue;
-use js::rust::ParentRuntime;
-use media::WindowGLContext;
-use metrics::{PaintTimeMetrics, MAX_TASK_NS};
-use mime::{self, Mime};
-use msg::constellation_msg::{
- BackgroundHangMonitor, BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister,
- ScriptHangAnnotation,
-};
-use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId};
-use msg::constellation_msg::{HangAnnotation, MonitoredComponentId, MonitoredComponentType};
-use msg::constellation_msg::{PipelineNamespace, TopLevelBrowsingContextId};
-use net_traits::image_cache::{ImageCache, PendingImageResponse};
-use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestBuilder};
-use net_traits::storage_thread::StorageType;
-use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg};
-use net_traits::{
- Metadata, NetworkError, ReferrerPolicy, ResourceFetchTiming, ResourceThreads,
- ResourceTimingType,
-};
-use parking_lot::Mutex;
-use percent_encoding::percent_decode;
-use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
-use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
-use script_layout_interface::message::{self, LayoutThreadInit, Msg, ReflowGoal};
-use script_traits::webdriver_msg::WebDriverScriptCommand;
-use script_traits::CompositorEvent::{
- CompositionEvent, IMEDismissedEvent, KeyboardEvent, MouseButtonEvent, MouseMoveEvent,
- ResizeEvent, TouchEvent, WheelEvent,
-};
-use script_traits::{
- AnimationTickType, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
- DocumentActivity, EventResult, HistoryEntryReplacement, InitialScriptState, JsEvalResult,
- LayoutMsg, LoadData, LoadOrigin, MediaSessionActionType, MouseButton, MouseEventType,
- NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptMsg, ScriptThreadFactory,
- ScriptToConstellationChan, StructuredSerializedData, TimerSchedulerMsg, TouchEventType,
- TouchId, UntrustedNodeAddress, UpdatePipelineIdReason, WebrenderIpcSender, WheelDelta,
- WindowSizeData, WindowSizeType,
-};
-use servo_atoms::Atom;
-use servo_config::opts;
-use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::cell::RefCell;
-use std::collections::{hash_map, HashMap, HashSet};
-use std::default::Default;
-use std::ops::Deref;
-use std::option::Option;
-use std::ptr;
-use std::rc::Rc;
-use std::result::Result;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use std::thread;
-use std::time::{Duration, SystemTime};
-use style::dom::OpaqueNode;
-use style::thread_state::{self, ThreadState};
-use time::{at_utc, get_time, precise_time_ns, Timespec};
-use url::Position;
-use webgpu::identity::WebGPUMsg;
-use webrender_api::units::LayoutPixel;
-use webrender_api::DocumentId;
+use crate::task_source::{TaskSource, TaskSourceName};
+use crate::{devtools, webdriver_handlers};
pub type ImageCacheMsg = (PipelineId, PendingImageResponse);
@@ -1457,9 +1454,8 @@ impl ScriptThread {
/// Handle incoming control messages.
fn handle_msgs(&self) -> bool {
- use self::MixedMessage::FromScript;
use self::MixedMessage::{
- FromConstellation, FromDevtools, FromImageCache, FromWebGPUServer,
+ FromConstellation, FromDevtools, FromImageCache, FromScript, FromWebGPUServer,
};
// Handle pending resize events.
diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs
index 7b222546bd8..4bb28c65d56 100644
--- a/components/script/serviceworker_manager.rs
+++ b/components/script/serviceworker_manager.rs
@@ -7,29 +7,29 @@
//! If an active service worker timeouts, then it removes the descriptor entry from its
//! active_workers map
-use crate::dom::abstractworker::WorkerScriptMsg;
-use crate::dom::serviceworkerglobalscope::{
- ServiceWorkerControlMsg, ServiceWorkerGlobalScope, ServiceWorkerScriptMsg,
-};
-use crate::dom::serviceworkerregistration::longest_prefix_match;
-use crate::script_runtime::ContextForRequestInterrupt;
+use std::collections::HashMap;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+use std::thread::{self, JoinHandle};
+
use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
-use msg::constellation_msg::PipelineNamespace;
-use msg::constellation_msg::{ServiceWorkerId, ServiceWorkerRegistrationId};
+use msg::constellation_msg::{PipelineNamespace, ServiceWorkerId, ServiceWorkerRegistrationId};
use net_traits::{CoreResourceMsg, CustomResponseMediator};
use script_traits::{
DOMMessage, Job, JobError, JobResult, JobResultValue, JobType, SWManagerMsg, SWManagerSenders,
ScopeThings, ServiceWorkerManagerFactory, ServiceWorkerMsg,
};
use servo_config::pref;
-use servo_url::ImmutableOrigin;
-use servo_url::ServoUrl;
-use std::collections::HashMap;
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use std::thread::{self, JoinHandle};
+use servo_url::{ImmutableOrigin, ServoUrl};
+
+use crate::dom::abstractworker::WorkerScriptMsg;
+use crate::dom::serviceworkerglobalscope::{
+ ServiceWorkerControlMsg, ServiceWorkerGlobalScope, ServiceWorkerScriptMsg,
+};
+use crate::dom::serviceworkerregistration::longest_prefix_match;
+use crate::script_runtime::ContextForRequestInterrupt;
enum Message {
FromResource(CustomResponseMediator),
diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs
index b7f47b1fcfd..d045f4b52df 100644
--- a/components/script/stylesheet_loader.rs
+++ b/components/script/stylesheet_loader.rs
@@ -2,22 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::document_loader::LoadType;
-use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::refcounted::Trusted;
-use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::root::DomRoot;
-use crate::dom::document::Document;
-use crate::dom::element::Element;
-use crate::dom::eventtarget::EventTarget;
-use crate::dom::globalscope::GlobalScope;
-use crate::dom::htmlelement::HTMLElement;
-use crate::dom::htmllinkelement::{HTMLLinkElement, RequestGenerationId};
-use crate::dom::node::{containing_shadow_root, document_from_node, window_from_node};
-use crate::dom::performanceresourcetiming::InitiatorType;
-use crate::dom::shadowroot::ShadowRoot;
-use crate::fetch::create_a_potential_cors_request;
-use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
+use std::mem;
+use std::sync::atomic::AtomicBool;
+use std::sync::Mutex;
+
use cssparser::SourceLocation;
use encoding_rs::UTF_8;
use ipc_channel::ipc;
@@ -27,22 +15,37 @@ use msg::constellation_msg::PipelineId;
use net_traits::request::{CorsSettings, Destination, Referrer, RequestBuilder};
use net_traits::{
FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy,
+ ResourceFetchTiming, ResourceTimingType,
};
-use net_traits::{ResourceFetchTiming, ResourceTimingType};
use servo_arc::Arc;
-use servo_url::ImmutableOrigin;
-use servo_url::ServoUrl;
-use std::mem;
-use std::sync::atomic::AtomicBool;
-use std::sync::Mutex;
+use servo_url::{ImmutableOrigin, ServoUrl};
use style::media_queries::MediaList;
use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::import_rule::{ImportLayer, ImportSheet};
-use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
-use style::stylesheets::{CssRules, ImportRule, Origin, Stylesheet, StylesheetContents};
+use style::stylesheets::{
+ CssRules, ImportRule, Origin, Stylesheet, StylesheetContents,
+ StylesheetLoader as StyleStylesheetLoader,
+};
use style::values::CssUrl;
+use crate::document_loader::LoadType;
+use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::refcounted::Trusted;
+use crate::dom::bindings::reflector::DomObject;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::document::Document;
+use crate::dom::element::Element;
+use crate::dom::eventtarget::EventTarget;
+use crate::dom::globalscope::GlobalScope;
+use crate::dom::htmlelement::HTMLElement;
+use crate::dom::htmllinkelement::{HTMLLinkElement, RequestGenerationId};
+use crate::dom::node::{containing_shadow_root, document_from_node, window_from_node};
+use crate::dom::performanceresourcetiming::InitiatorType;
+use crate::dom::shadowroot::ShadowRoot;
+use crate::fetch::create_a_potential_cors_request;
+use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
+
pub trait StylesheetOwner {
/// Returns whether this element was inserted by the parser (i.e., it should
/// trigger a document-load-blocking load).
diff --git a/components/script/task_manager.rs b/components/script/task_manager.rs
index 184b427cfcb..a64355b6882 100644
--- a/components/script/task_manager.rs
+++ b/components/script/task_manager.rs
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::collections::HashMap;
+use std::sync::atomic::AtomicBool;
+use std::sync::Arc;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
@@ -16,9 +20,6 @@ use crate::task_source::timer::TimerTaskSource;
use crate::task_source::user_interaction::UserInteractionTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
use crate::task_source::TaskSourceName;
-use std::collections::HashMap;
-use std::sync::atomic::AtomicBool;
-use std::sync::Arc;
macro_rules! task_source_functions {
($self:ident,$with_canceller:ident,$task_source:ident,$task_source_type:ident,$task_source_name:ident) => {
diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs
index 3ed835563a3..38acc7ed04b 100644
--- a/components/script/task_queue.rs
+++ b/components/script/task_queue.rs
@@ -4,17 +4,19 @@
//! Machinery for [task-queue](https://html.spec.whatwg.org/multipage/#task-queue).
+use std::cell::Cell;
+use std::collections::{HashMap, HashSet, VecDeque};
+use std::default::Default;
+
+use crossbeam_channel::{self, Receiver, Sender};
+use msg::constellation_msg::PipelineId;
+
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::worker::TrustedWorkerAddress;
use crate::script_runtime::ScriptThreadEventCategory;
use crate::script_thread::ScriptThread;
use crate::task::TaskBox;
use crate::task_source::TaskSourceName;
-use crossbeam_channel::{self, Receiver, Sender};
-use msg::constellation_msg::PipelineId;
-use std::cell::Cell;
-use std::collections::{HashMap, HashSet, VecDeque};
-use std::default::Default;
pub type QueuedTask = (
Option<TrustedWorkerAddress>,
diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs
index 68316b79fe3..64c2b3a33c6 100644
--- a/components/script/task_source/dom_manipulation.rs
+++ b/components/script/task_source/dom_manipulation.rs
@@ -2,6 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::fmt;
+use std::result::Result;
+
+use msg::constellation_msg::PipelineId;
+use servo_atoms::Atom;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::event::{EventBubbles, EventCancelable, EventTask, SimpleEventTask};
@@ -10,10 +16,6 @@ use crate::dom::window::Window;
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
-use servo_atoms::Atom;
-use std::fmt;
-use std::result::Result;
#[derive(JSTraceable)]
pub struct DOMManipulationTaskSource(pub Box<dyn ScriptChan + Send>, #[no_trace] pub PipelineId);
diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs
index 646778ffea5..ebf37249b59 100644
--- a/components/script/task_source/file_reading.rs
+++ b/components/script/task_source/file_reading.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use msg::constellation_msg::PipelineId;
+
use crate::dom::domexception::DOMErrorName;
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;
#[derive(JSTraceable)]
pub struct FileReadingTaskSource(
diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs
index ecabbddfa55..1676461fa99 100644
--- a/components/script/task_source/history_traversal.rs
+++ b/components/script/task_source/history_traversal.rs
@@ -2,12 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crossbeam_channel::Sender;
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
use crate::script_thread::MainThreadScriptMsg;
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use crossbeam_channel::Sender;
-use msg::constellation_msg::PipelineId;
#[derive(Clone, JSTraceable)]
pub struct HistoryTraversalTaskSource(
diff --git a/components/script/task_source/media_element.rs b/components/script/task_source/media_element.rs
index 16922a0ec87..64d2f6c2764 100644
--- a/components/script/task_source/media_element.rs
+++ b/components/script/task_source/media_element.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::fmt;
+use std::result::Result;
+
+use crossbeam_channel::Sender;
+use msg::constellation_msg::PipelineId;
+use servo_atoms::Atom;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::event::SimpleEventTask;
@@ -11,11 +18,6 @@ use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
use crate::script_thread::MainThreadScriptMsg;
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use crossbeam_channel::Sender;
-use msg::constellation_msg::PipelineId;
-use servo_atoms::Atom;
-use std::fmt;
-use std::result::Result;
#[derive(Clone, JSTraceable)]
pub struct MediaElementTaskSource(
diff --git a/components/script/task_source/mod.rs b/components/script/task_source/mod.rs
index 7defd922779..b67b87c8caf 100644
--- a/components/script/task_source/mod.rs
+++ b/components/script/task_source/mod.rs
@@ -14,10 +14,12 @@ pub mod timer;
pub mod user_interaction;
pub mod websocket;
+use std::result::Result;
+
+use enum_iterator::IntoEnumIterator;
+
use crate::dom::globalscope::GlobalScope;
use crate::task::{TaskCanceller, TaskOnce};
-use enum_iterator::IntoEnumIterator;
-use std::result::Result;
// The names of all task sources, used to differentiate TaskCancellers.
// Note: When adding a task source, update this enum.
diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs
index 0193cb22839..b95e20aa9fe 100644
--- a/components/script/task_source/networking.rs
+++ b/components/script/task_source/networking.rs
@@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct NetworkingTaskSource(
diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs
index 58e2660e6fd..b66f1c496b8 100644
--- a/components/script/task_source/performance_timeline.rs
+++ b/components/script/task_source/performance_timeline.rs
@@ -6,14 +6,16 @@
// a low priority task and it should be processed during idle periods.
// We are currently treating this task queue as a normal priority queue.
+use std::fmt;
+use std::result::Result;
+
+use msg::constellation_msg::PipelineId;
+
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
-use std::fmt;
-use std::result::Result;
#[derive(JSTraceable)]
pub struct PerformanceTimelineTaskSource(
diff --git a/components/script/task_source/port_message.rs b/components/script/task_source/port_message.rs
index e21230f8099..30fe007cbf4 100644
--- a/components/script/task_source/port_message.rs
+++ b/components/script/task_source/port_message.rs
@@ -2,11 +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 std::fmt;
+
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
-use std::fmt;
#[derive(JSTraceable)]
pub struct PortMessageQueue(
diff --git a/components/script/task_source/remote_event.rs b/components/script/task_source/remote_event.rs
index 91e132ed719..061558af6c9 100644
--- a/components/script/task_source/remote_event.rs
+++ b/components/script/task_source/remote_event.rs
@@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct RemoteEventTaskSource(
diff --git a/components/script/task_source/timer.rs b/components/script/task_source/timer.rs
index 9c4d03bdda5..f5bfdbb8f52 100644
--- a/components/script/task_source/timer.rs
+++ b/components/script/task_source/timer.rs
@@ -2,11 +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 std::fmt;
+
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
-use std::fmt;
#[derive(JSTraceable)]
/// https://html.spec.whatwg.org/multipage/#timer-task-source
diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs
index 1f543d88cfd..a16277f2781 100644
--- a/components/script/task_source/user_interaction.rs
+++ b/components/script/task_source/user_interaction.rs
@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::fmt;
+use std::result::Result;
+
+use crossbeam_channel::Sender;
+use msg::constellation_msg::PipelineId;
+use servo_atoms::Atom;
+
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::event::{EventBubbles, EventCancelable, EventTask};
@@ -11,11 +18,6 @@ use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
use crate::script_thread::MainThreadScriptMsg;
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use crossbeam_channel::Sender;
-use msg::constellation_msg::PipelineId;
-use servo_atoms::Atom;
-use std::fmt;
-use std::result::Result;
#[derive(Clone, JSTraceable)]
pub struct UserInteractionTaskSource(
diff --git a/components/script/task_source/websocket.rs b/components/script/task_source/websocket.rs
index 843a9632a8a..ec5e263fe09 100644
--- a/components/script/task_source/websocket.rs
+++ b/components/script/task_source/websocket.rs
@@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use msg::constellation_msg::PipelineId;
+
use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use crate::task::{TaskCanceller, TaskOnce};
use crate::task_source::{TaskSource, TaskSourceName};
-use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct WebsocketTaskSource(
diff --git a/components/script/test.rs b/components/script/test.rs
index 247acb80940..406190b0717 100644
--- a/components/script/test.rs
+++ b/components/script/test.rs
@@ -2,13 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-pub use crate::dom::bindings::str::{ByteString, DOMString};
-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::bindings::str::{ByteString, DOMString};
+pub use crate::dom::headers::normalize_value;
pub use crate::dom::node::Node;
pub mod area {
@@ -17,6 +16,8 @@ pub mod area {
#[allow(non_snake_case)]
pub mod size_of {
+ use std::mem::size_of;
+
use crate::dom::characterdata::CharacterData;
use crate::dom::element::Element;
use crate::dom::eventtarget::EventTarget;
@@ -25,7 +26,6 @@ pub mod size_of {
use crate::dom::htmlspanelement::HTMLSpanElement;
use crate::dom::node::Node;
use crate::dom::text::Text;
- use std::mem::size_of;
pub fn CharacterData() -> usize {
size_of::<CharacterData>()
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 623085ccd19..758d620badd 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -4,18 +4,20 @@
//! Common handling of keyboard input and state management for text input controls
-use crate::clipboard_provider::ClipboardProvider;
-use crate::dom::bindings::str::DOMString;
-use crate::dom::compositionevent::CompositionEvent;
-use crate::dom::keyboardevent::KeyboardEvent;
-use keyboard_types::{Key, KeyState, Modifiers, ShortcutMatcher};
use std::borrow::ToOwned;
use std::cmp::min;
use std::default::Default;
use std::ops::{Add, AddAssign, Range};
use std::usize;
+
+use keyboard_types::{Key, KeyState, Modifiers, ShortcutMatcher};
use unicode_segmentation::UnicodeSegmentation;
+use crate::clipboard_provider::ClipboardProvider;
+use crate::dom::bindings::str::DOMString;
+use crate::dom::compositionevent::CompositionEvent;
+use crate::dom::keyboardevent::KeyboardEvent;
+
#[derive(Clone, Copy, PartialEq)]
pub enum Selection {
Selected,
diff --git a/components/script/timers.rs b/components/script/timers.rs
index c7c2d15ef38..2289c9aac8c 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -2,6 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cell::Cell;
+use std::cmp::{self, Ord, Ordering};
+use std::collections::HashMap;
+use std::default::Default;
+use std::rc::Rc;
+
+use deny_public_fields::DenyPublicFields;
+use euclid::Length;
+use ipc_channel::ipc::IpcSender;
+use js::jsapi::Heap;
+use js::jsval::{JSVal, UndefinedValue};
+use js::rust::HandleValue;
+use script_traits::{
+ precise_time_ms, MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSchedulerMsg,
+ TimerSource,
+};
+use servo_config::pref;
+
use crate::dom::bindings::callback::ExceptionHandling::Report;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function;
@@ -14,21 +32,6 @@ use crate::dom::testbinding::TestBindingCallback;
use crate::dom::xmlhttprequest::XHRTimeoutCallback;
use crate::script_module::ScriptFetchOptions;
use crate::script_thread::ScriptThread;
-use deny_public_fields::DenyPublicFields;
-use euclid::Length;
-use ipc_channel::ipc::IpcSender;
-use js::jsapi::Heap;
-use js::jsval::{JSVal, UndefinedValue};
-use js::rust::HandleValue;
-use script_traits::{precise_time_ms, MsDuration};
-use script_traits::{TimerEvent, TimerEventId, TimerEventRequest};
-use script_traits::{TimerSchedulerMsg, TimerSource};
-use servo_config::pref;
-use std::cell::Cell;
-use std::cmp::{self, Ord, Ordering};
-use std::collections::HashMap;
-use std::default::Default;
-use std::rc::Rc;
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub struct OneshotTimerHandle(i32);
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index d1b2471777b..a4014a699d9 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -2,6 +2,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::cmp;
+use std::collections::HashMap;
+use std::ffi::CString;
+
+use cookie::Cookie;
+use euclid::default::{Point2D, Rect, Size2D};
+use hyper_serde::Serde;
+use ipc_channel::ipc::{self, IpcSender};
+use js::jsapi::{HandleValueArray, JSAutoRealm, JSContext, JSType, JS_IsExceptionPending};
+use js::jsval::UndefinedValue;
+use js::rust::wrappers::{JS_CallFunctionName, JS_GetProperty, JS_HasOwnProperty, JS_TypeOfValue};
+use js::rust::{HandleObject, HandleValue};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
+use net_traits::CookieSource::{NonHTTP, HTTP};
+use net_traits::CoreResourceMsg::{DeleteCookies, GetCookiesDataForUrl, SetCookieForUrl};
+use net_traits::IpcSend;
+use script_traits::webdriver_msg::{
+ WebDriverCookieError, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue,
+};
+use servo_url::ServoUrl;
+use webdriver::common::{WebElement, WebFrame, WebWindow};
+use webdriver::error::ErrorStatus;
+
use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
@@ -14,10 +37,8 @@ use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, N
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::codegen::Bindings::XMLSerializerBinding::XMLSerializerMethods;
use crate::dom::bindings::conversions::{
- get_property, get_property_jsval, is_array_like, root_from_object,
-};
-use crate::dom::bindings::conversions::{
- ConversionBehavior, ConversionResult, FromJSValConvertible, StringificationBehavior,
+ get_property, get_property_jsval, is_array_like, root_from_object, ConversionBehavior,
+ ConversionResult, FromJSValConvertible, StringificationBehavior,
};
use crate::dom::bindings::error::{throw_dom_exception, Error};
use crate::dom::bindings::inheritance::Castable;
@@ -41,29 +62,6 @@ use crate::realms::enter_realm;
use crate::script_module::ScriptFetchOptions;
use crate::script_runtime::JSContext as SafeJSContext;
use crate::script_thread::{Documents, ScriptThread};
-use cookie::Cookie;
-use euclid::default::{Point2D, Rect, Size2D};
-use hyper_serde::Serde;
-use ipc_channel::ipc::{self, IpcSender};
-use js::jsapi::{HandleValueArray, JSAutoRealm, JSContext, JSType, JS_IsExceptionPending};
-use js::jsval::UndefinedValue;
-use js::rust::wrappers::{JS_CallFunctionName, JS_GetProperty, JS_HasOwnProperty, JS_TypeOfValue};
-use js::rust::{HandleObject, HandleValue};
-use msg::constellation_msg::BrowsingContextId;
-use msg::constellation_msg::PipelineId;
-use net_traits::CookieSource::{NonHTTP, HTTP};
-use net_traits::CoreResourceMsg::{DeleteCookies, GetCookiesDataForUrl, SetCookieForUrl};
-use net_traits::IpcSend;
-use script_traits::webdriver_msg::WebDriverCookieError;
-use script_traits::webdriver_msg::{
- WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue,
-};
-use servo_url::ServoUrl;
-use std::cmp;
-use std::collections::HashMap;
-use std::ffi::CString;
-use webdriver::common::{WebElement, WebFrame, WebWindow};
-use webdriver::error::ErrorStatus;
fn find_node_by_unique_id(
documents: &Documents,
diff --git a/components/script/window_named_properties.rs b/components/script/window_named_properties.rs
index 0a133d2cd34..0140bd7c46e 100644
--- a/components/script/window_named_properties.rs
+++ b/components/script/window_named_properties.rs
@@ -2,6 +2,25 @@
* 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 std::ptr;
+
+use js::conversions::jsstr_to_string;
+use js::glue::{AppendToIdVector, CreateProxyHandler, NewProxyObject, ProxyTraps};
+use js::jsapi::{
+ GetWellKnownSymbol, Handle, HandleId, HandleObject, JSClass, JSClass_NON_NATIVE, JSContext,
+ JSErrNum, JS_SetImmutablePrototype, MutableHandle, MutableHandleIdVector, MutableHandleObject,
+ ObjectOpResult, PropertyDescriptor, ProxyClassExtension, ProxyClassOps, ProxyObjectOps,
+ SymbolCode, UndefinedHandleValue, JSCLASS_DELAY_METADATA_BUILDER, JSCLASS_IS_PROXY,
+ JSCLASS_RESERVED_SLOTS_MASK, JSCLASS_RESERVED_SLOTS_SHIFT, JSPROP_READONLY,
+};
+use js::jsid::SymbolId;
+use js::jsval::UndefinedValue;
+use js::rust::{
+ Handle as RustHandle, HandleObject as RustHandleObject, IntoHandle,
+ MutableHandle as RustMutableHandle, MutableHandleObject as RustMutableHandleObject,
+};
+use libc;
+
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::proxyhandler::set_property_descriptor;
use crate::dom::bindings::root::Root;
@@ -10,25 +29,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::js::conversions::ToJSValConvertible;
use crate::script_runtime::JSContext as SafeJSContext;
-use js::conversions::jsstr_to_string;
-use js::glue::{AppendToIdVector, CreateProxyHandler, NewProxyObject, ProxyTraps};
-use js::jsapi::{GetWellKnownSymbol, JS_SetImmutablePrototype, SymbolCode, JSPROP_READONLY};
-use js::jsapi::{
- Handle, HandleObject, JSClass, JSContext, JSErrNum, MutableHandleObject, UndefinedHandleValue,
-};
-use js::jsapi::{
- HandleId, JSClass_NON_NATIVE, MutableHandle, MutableHandleIdVector, ObjectOpResult,
- PropertyDescriptor, ProxyClassExtension, ProxyClassOps, ProxyObjectOps,
- JSCLASS_DELAY_METADATA_BUILDER, JSCLASS_IS_PROXY, JSCLASS_RESERVED_SLOTS_MASK,
- JSCLASS_RESERVED_SLOTS_SHIFT,
-};
-use js::jsid::SymbolId;
-use js::jsval::UndefinedValue;
-use js::rust::IntoHandle;
-use js::rust::{Handle as RustHandle, MutableHandle as RustMutableHandle};
-use js::rust::{HandleObject as RustHandleObject, MutableHandleObject as RustMutableHandleObject};
-use libc;
-use std::ptr;
struct SyncWrapper(*const libc::c_void);
#[allow(unsafe_code)]